Skip to content
New issue

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

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

Already on GitHub? # to your account

add some examples for the documentation on the nb_fetch utility #320

Merged
merged 1 commit into from
Aug 4, 2017
Merged
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
26 changes: 25 additions & 1 deletion quantecon/util/notebooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@

def fetch_nb_dependencies(files, repo=REPO, raw=RAW, branch=BRANCH, folder=FOLDER, overwrite=False, verbose=True):
"""
Retrieve raw files from QuantEcon.notebooks or any other Github repo
Retrieve raw files from QuantEcon.notebooks or other Github repo

Parameters
----------
Expand All @@ -47,6 +47,30 @@ def fetch_nb_dependencies(files, repo=REPO, raw=RAW, branch=BRANCH, folder=FOLDE
overwrite bool, optional(default=False)
verbose bool, optional(default=True)

Examples
--------
Consider a notebook that is dependant on a ``csv`` file to execute. If this file is
located in a Github repository then it can be fetched using this utility

Assuming the file is at the root level in the ``master`` branch then:

>>> from quantecon.util import fetch_nb_dependencies
>>> status = fetch_nb_dependencies(["test.csv"], repo="https://<github_address>")

More than one file may be requested in the list provided

>>> status = fetch_nb_dependencies(["test.csv", "data.csv"], repo="https://<github_address>")

A folder location can be added using ``folder=``

>>> status = fetch_nb_dependencies("test.csv", report="https://<github_address>", folder="data")

You can also specify a specific branch using ``branch=`` keyword argument.

This will download the requested file(s) to your local working directory. The default
behaviour is **not** to overwrite a local file if it is present. This can be switched off
by setting ``overwrite=True``.

"""

#-Generate Common Data Structure-#
Expand Down