From 08e634afdc61d8c34f7d84faba9a68119bd4d563 Mon Sep 17 00:00:00 2001 From: mmcky Date: Fri, 4 Aug 2017 11:28:43 +1000 Subject: [PATCH] add some examples for the documentation on the nb_fetch utility (#320) --- quantecon/util/notebooks.py | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/quantecon/util/notebooks.py b/quantecon/util/notebooks.py index 804081c8b..82c31e0e6 100644 --- a/quantecon/util/notebooks.py +++ b/quantecon/util/notebooks.py @@ -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 ---------- @@ -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://") + + More than one file may be requested in the list provided + + >>> status = fetch_nb_dependencies(["test.csv", "data.csv"], repo="https://") + + A folder location can be added using ``folder=`` + + >>> status = fetch_nb_dependencies("test.csv", report="https://", 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-#