Skip to content

Commit 2e1360a

Browse files
author
K.-Michael Aye
committed
implemented new helper func for targets also in _retr_modc
1 parent 26ab9d4 commit 2e1360a

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

nbdev/maker.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ def _retr_mdoc(cells):
178178
"Search for `_doc_` variable, used to create module docstring"
179179
trees = L(cells).map(NbCell.parsed_).concat()
180180
for o in trees:
181-
if isinstance(o, _assign_types) and getattr(o.targets[0],'id',None)=='_doc_':
181+
if isinstance(o, _assign_types) and getattr(_targets(o)[0],'id',None)=='_doc_':
182182
v = try_attrs(o.value, 'value', 's') # py37 uses `ast.Str.s`
183183
return f'"""{v}"""\n\n'
184184
return ""

nbs/09_API/02_maker.ipynb

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -470,7 +470,7 @@
470470
" \"Search for `_doc_` variable, used to create module docstring\"\n",
471471
" trees = L(cells).map(NbCell.parsed_).concat()\n",
472472
" for o in trees:\n",
473-
" if isinstance(o, _assign_types) and getattr(o.targets[0],'id',None)=='_doc_':\n",
473+
" if isinstance(o, _assign_types) and getattr(_targets(o)[0],'id',None)=='_doc_':\n",
474474
" v = try_attrs(o.value, 'value', 's') # py37 uses `ast.Str.s`\n",
475475
" return f'\"\"\"{v}\"\"\"\\n\\n' \n",
476476
" return \"\""
@@ -798,6 +798,18 @@
798798
"display_name": "Python 3 (ipykernel)",
799799
"language": "python",
800800
"name": "python3"
801+
},
802+
"language_info": {
803+
"codemirror_mode": {
804+
"name": "ipython",
805+
"version": 3
806+
},
807+
"file_extension": ".py",
808+
"mimetype": "text/x-python",
809+
"name": "python",
810+
"nbconvert_exporter": "python",
811+
"pygments_lexer": "ipython3",
812+
"version": "3.10.6"
801813
}
802814
},
803815
"nbformat": 4,

0 commit comments

Comments
 (0)