Skip to content

Commit

Permalink
Merge pull request #934 from fastai/fix-update
Browse files Browse the repository at this point in the history
Correct cell index in `nbdev_update`
  • Loading branch information
jph00 authored Aug 25, 2022
2 parents 97e06f9 + 2dd98d6 commit 481636b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion nbdev/sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def _update_lib(nbname, nb_locs, lib_name=None):

for name,idx,code in nb_locs:
assert name==nbname
cell = nb.cells[int(idx)-1]
cell = nb.cells[int(idx)]
lines = cell.source.splitlines(True)
directives = ''.join(cell.source.splitlines(True)[:len(cell.directives_)])
cell.source = directives + _to_absolute(code, lib_name)
Expand Down
2 changes: 1 addition & 1 deletion nbs/05_sync.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@
"\n",
" for name,idx,code in nb_locs:\n",
" assert name==nbname\n",
" cell = nb.cells[int(idx)-1]\n",
" cell = nb.cells[int(idx)]\n",
" lines = cell.source.splitlines(True)\n",
" directives = ''.join(cell.source.splitlines(True)[:len(cell.directives_)])\n",
" cell.source = directives + _to_absolute(code, lib_name)\n",
Expand Down

0 comments on commit 481636b

Please sign in to comment.