Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update docs to remove models subpackage and update the qe_api.py scri… #219

Merged
merged 1 commit into from
Jan 12, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 10 additions & 58 deletions docs/qe_apidoc.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,24 +58,6 @@
:show-inheritance:
"""

model_module_template = """{mod_name}
{equals}

.. automodule:: quantecon.models.{mod_name}
:members:
:undoc-members:
:show-inheritance:
"""

solow_model_module_template = """{mod_name}
{equals}

.. automodule:: quantecon.models.solow.{mod_name}
:members:
:undoc-members:
:show-inheritance:
"""

random_module_template = """{mod_name}
{equals}

Expand Down Expand Up @@ -132,7 +114,6 @@
:maxdepth: 2

markov
models
random
tools
util
Expand Down Expand Up @@ -170,7 +151,7 @@ def source_join(f_name):
def all_auto():
# Get list of module names
mod_names = glob("../quantecon/[a-z0-9]*.py")
mod_names = map(lambda x: x.split('/')[-1], mod_names)
mod_names = list(map(lambda x: x.split('/')[-1], mod_names))

# Ensure source/modules directory exists
if not os.path.exists(source_join("modules")):
Expand All @@ -185,51 +166,39 @@ def all_auto():

# write index.rst file to include these autogenerated files
with open(source_join("index.rst"), "w") as index:
generated = "\n ".join(map(lambda x: "modules/" + x.split(".")[0],
mod_names))
generated = "\n ".join(list(map(lambda x: "modules/" + x.split(".")[0],
mod_names)))
temp = all_index_template.format(generated=generated)
index.write(temp)


def model_tool():
# list file names with markov
markov_files = glob("../quantecon/markov/[a-z0-9]*.py")
markov = map(lambda x: x.split('/')[-1][:-3], markov_files)
markov = list(map(lambda x: x.split('/')[-1][:-3], markov_files))
# Alphabetize
markov.sort()

# list file names with models
mod_files = glob("../quantecon/models/[a-z0-9]*.py")
models = map(lambda x: x.split('/')[-1][:-3], mod_files)
# Alphabetize
models.sort()

# list file names with models.solow
solow_files = glob("../quantecon/models/solow/[a-z0-9]*.py")
solow = map(lambda x: x.split('/')[-1][:-3], solow_files)
# Alphabetize
solow.sort()

# list file names with random
random_files = glob("../quantecon/random/[a-z0-9]*.py")
random = map(lambda x: x.split('/')[-1][:-3], random_files)
random = list(map(lambda x: x.split('/')[-1][:-3], random_files))
# Alphabetize
random.sort()

# list file names of tools (base level modules)
tool_files = glob("../quantecon/[a-z0-9]*.py")
tools = map(lambda x: x.split('/')[-1][:-3], tool_files)
tools = list(map(lambda x: x.split('/')[-1][:-3], tool_files))
# Alphabetize
tools.remove("version")
tools.sort()

# list file names of utilities
util_files = glob("../quantecon/util/[a-z0-9]*.py")
util = map(lambda x: x.split('/')[-1][:-3], util_files)
util = list(map(lambda x: x.split('/')[-1][:-3], util_files))
# Alphabetize
util.sort()

for folder in ["markov","models","models/solow","random","tools","util"]:
for folder in ["markov","random","tools","util"]:
if not os.path.exists(source_join(folder)):
os.makedirs(source_join(folder))

Expand All @@ -238,21 +207,7 @@ def model_tool():
new_path = os.path.join("source", "markov", mod + ".rst")
with open(new_path, "w") as f:
equals = "=" * len(mod)
f.write(markov_module_template.format(mod_name=mod, equals=equals))

# Write file for each model
for mod in models:
new_path = os.path.join("source", "models", mod + ".rst")
with open(new_path, "w") as f:
equals = "=" * len(mod)
f.write(model_module_template.format(mod_name=mod, equals=equals))

# Write file for each model.solow
for mod in solow:
new_path = os.path.join("source", "models", "solow", mod + ".rst")
with open(new_path, "w") as f:
equals = "=" * len(mod)
f.write(solow_model_module_template.format(mod_name=mod, equals=equals))
f.write(markov_module_template.format(mod_name=mod, equals=equals))

# Write file for each random file
for mod in random:
Expand Down Expand Up @@ -280,20 +235,17 @@ def model_tool():
index.write(split_index_template)

mark = "markov/" + "\n markov/".join(markov)
mods = "models/" + "\n models/".join(models)
mods = mods + "\n solow/" #Add solow sub directory to models
rand = "random/" + "\n random/".join(random)
tlz = "tools/" + "\n tools/".join(tools)
utls = "util/" + "\n util/".join(util)
#-TocTree-#
toc_tree_list = {"markov":mark,
"models": mods,
"tools": tlz,
"random":rand,
"util":utls,
}

for f_name in ("markov","models","random","tools","util"):
for f_name in ("markov","random","tools","util"):
with open(source_join(f_name + ".rst"), "w") as f:
temp = split_file_template.format(name=f_name.capitalize(),
equals="="*len(f_name),
Expand Down
1 change: 0 additions & 1 deletion docs/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ econ.net <http://quant-econ.net>`_.
:maxdepth: 2

markov
models
random
tools
util
Expand Down
1 change: 1 addition & 0 deletions docs/source/util.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,6 @@ Util
util/array
util/common_messages
util/external
util/notebooks
util/random
util/timing
7 changes: 7 additions & 0 deletions docs/source/util/notebooks.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
notebooks
=========

.. automodule:: quantecon.util.notebooks
:members:
:undoc-members:
:show-inheritance: