Skip to content

Commit

Permalink
Merge pull request #416 from fastai/fix-none
Browse files Browse the repository at this point in the history
fix default arg issue with nbdev_update_lib
  • Loading branch information
Hamel Husain authored Feb 5, 2021
2 parents f8d6ed2 + c593b45 commit b9be3c2
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 45 deletions.
6 changes: 3 additions & 3 deletions docs/sync.html
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ <h4 id="relimport2name" class="doc_header"><code>relimport2name</code><a href="h


<div class="output_markdown rendered_html output_subarea ">
<h4 id="nbdev_update_lib" class="doc_header"><code>nbdev_update_lib</code><a href="https://github.com/fastai/nbdev/tree/master/nbdev/sync.py#L121" class="source_link" style="float:right">[source]</a></h4><blockquote><p><code>nbdev_update_lib</code>(<strong><code>fname</code></strong>:"A python filename or glob to convert"=<em><code>None</code></em>, <strong><code>silent</code></strong>:"Don't print results"=<em><code>False</code></em>)</p>
<h4 id="nbdev_update_lib" class="doc_header"><code>nbdev_update_lib</code><a href="https://github.com/fastai/nbdev/tree/master/nbdev/sync.py#L122" class="source_link" style="float:right">[source]</a></h4><blockquote><p><code>nbdev_update_lib</code>(<strong><code>fname</code></strong>:"A python filename or glob to convert"=<em><code>None</code></em>, <strong><code>silent</code></strong>:"Don't print results"=<em><code>False</code></em>)</p>
</blockquote>
<p>Propagates any change in the modules matching <code>fname</code> to the notebooks that created them</p>

Expand Down Expand Up @@ -428,7 +428,7 @@ <h2 id="Diff-&amp;-trust-notebooks">Diff &amp; trust notebooks<a class="anchor-l


<div class="output_markdown rendered_html output_subarea ">
<h4 id="nbdev_diff_nbs" class="doc_header"><code>nbdev_diff_nbs</code><a href="https://github.com/fastai/nbdev/tree/master/nbdev/sync.py#L139" class="source_link" style="float:right">[source]</a></h4><blockquote><p><code>nbdev_diff_nbs</code>()</p>
<h4 id="nbdev_diff_nbs" class="doc_header"><code>nbdev_diff_nbs</code><a href="https://github.com/fastai/nbdev/tree/master/nbdev/sync.py#L140" class="source_link" style="float:right">[source]</a></h4><blockquote><p><code>nbdev_diff_nbs</code>()</p>
</blockquote>
<p>Prints the diff between an export of the library in notebooks and the actual modules</p>

Expand Down Expand Up @@ -484,7 +484,7 @@ <h4 id="nbdev_diff_nbs" class="doc_header"><code>nbdev_diff_nbs</code><a href="h


<div class="output_markdown rendered_html output_subarea ">
<h4 id="nbdev_trust_nbs" class="doc_header"><code>nbdev_trust_nbs</code><a href="https://github.com/fastai/nbdev/tree/master/nbdev/sync.py#L156" class="source_link" style="float:right">[source]</a></h4><blockquote><p><code>nbdev_trust_nbs</code>(<strong><code>fname</code></strong>:"A notebook name or glob to convert"=<em><code>None</code></em>, <strong><code>force_all</code></strong>:"Trust even notebooks that haven't changed"=<em><code>False</code></em>)</p>
<h4 id="nbdev_trust_nbs" class="doc_header"><code>nbdev_trust_nbs</code><a href="https://github.com/fastai/nbdev/tree/master/nbdev/sync.py#L157" class="source_link" style="float:right">[source]</a></h4><blockquote><p><code>nbdev_trust_nbs</code>(<strong><code>fname</code></strong>:"A notebook name or glob to convert"=<em><code>None</code></em>, <strong><code>force_all</code></strong>:"Trust even notebooks that haven't changed"=<em><code>False</code></em>)</p>
</blockquote>
<p>Trust notebooks matching <code>fname</code></p>

Expand Down
2 changes: 1 addition & 1 deletion nbdev/sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ def _script2notebook(fname, dic, silent=False):
def nbdev_update_lib(fname:Param("A python filename or glob to convert", str)=None,
silent:Param("Don't print results", bool_arg)=False):
"Propagates any change in the modules matching `fname` to the notebooks that created them"
if fname.endswith('.ipynb'): raise ValueError("`nbdev_update_lib` operates on .py files. If you wish to convert notebooks instead, see `nbdev_build_lib`.")
if fname and fname.endswith('.ipynb'): raise ValueError("`nbdev_update_lib` operates on .py files. If you wish to convert notebooks instead, see `nbdev_build_lib`.")
if os.environ.get('IN_TEST',0): return
dic = notebook2script(silent=True, to_dict=True)
exported = get_nbdev_module().modules
Expand Down
45 changes: 4 additions & 41 deletions nbs/01_sync.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -403,16 +403,7 @@
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"None\n",
"Converted export.py.\n"
]
}
],
"outputs": [],
"source": [
"#hide\n",
"dic = notebook2script(silent=True, to_dict=True)\n",
Expand All @@ -423,15 +414,7 @@
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"None\n"
]
}
],
"outputs": [],
"source": [
"#hide\n",
"exported = get_nbdev_module().modules\n",
Expand All @@ -451,7 +434,7 @@
"def nbdev_update_lib(fname:Param(\"A python filename or glob to convert\", str)=None,\n",
" silent:Param(\"Don't print results\", bool_arg)=False):\n",
" \"Propagates any change in the modules matching `fname` to the notebooks that created them\"\n",
" if fname.endswith('.ipynb'): raise ValueError(\"`nbdev_update_lib` operates on .py files. If you wish to convert notebooks instead, see `nbdev_build_lib`.\")\n",
" if fname and fname.endswith('.ipynb'): raise ValueError(\"`nbdev_update_lib` operates on .py files. If you wish to convert notebooks instead, see `nbdev_build_lib`.\")\n",
" if os.environ.get('IN_TEST',0): return\n",
" dic = notebook2script(silent=True, to_dict=True)\n",
" exported = get_nbdev_module().modules\n",
Expand Down Expand Up @@ -579,27 +562,7 @@
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"None\n",
"Converted 00_export.ipynb.\n",
"Converted 01_sync.ipynb.\n",
"Converted 02_showdoc.ipynb.\n",
"Converted 03_export2html.ipynb.\n",
"Converted 04_test.ipynb.\n",
"Converted 05_merge.ipynb.\n",
"Converted 06_cli.ipynb.\n",
"Converted 07_clean.ipynb.\n",
"Converted 99_search.ipynb.\n",
"Converted example.ipynb.\n",
"Converted index.ipynb.\n",
"Converted tutorial.ipynb.\n"
]
}
],
"outputs": [],
"source": [
"#hide\n",
"from nbdev.export import *\n",
Expand Down

0 comments on commit b9be3c2

Please sign in to comment.