Skip to content

Commit 92830e4

Browse files
committed
fixes #1579
1 parent 995ecb5 commit 92830e4

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

nbdev/processors.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,9 @@ def begin(self): self.nb.cells.insert(1, mk_cell(self.content, 'markdown'))
4747
_def_types = (ast.FunctionDef,ast.AsyncFunctionDef,ast.ClassDef)
4848
def _def_names(cell, shown):
4949
cellp = cell.parsed_()
50-
return [showdoc_nm(o) for o in concat(cellp)
51-
if isinstance(o,_def_types) and o.name not in shown and (o.name[0]!='_' or o.name[:2]=='__')] if cellp else []
50+
nms = [showdoc_nm(o) for o in concat(cellp)
51+
if isinstance(o,_def_types) and o.name not in shown and (o.name[0]!='_' or o.name[:2]=='__')] if cellp else []
52+
return [n for nm in nms for n in (nm if isinstance(nm, list) else [nm])]
5253

5354
def _get_nm(tree):
5455
i = tree.value.args[0]

nbs/api/10_processors.ipynb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,8 +177,9 @@
177177
"_def_types = (ast.FunctionDef,ast.AsyncFunctionDef,ast.ClassDef)\n",
178178
"def _def_names(cell, shown):\n",
179179
" cellp = cell.parsed_()\n",
180-
" return [showdoc_nm(o) for o in concat(cellp)\n",
181-
" if isinstance(o,_def_types) and o.name not in shown and (o.name[0]!='_' or o.name[:2]=='__')] if cellp else []\n",
180+
" nms = [showdoc_nm(o) for o in concat(cellp)\n",
181+
" if isinstance(o,_def_types) and o.name not in shown and (o.name[0]!='_' or o.name[:2]=='__')] if cellp else []\n",
182+
" return [n for nm in nms for n in (nm if isinstance(nm, list) else [nm])]\n",
182183
"\n",
183184
"def _get_nm(tree):\n",
184185
" i = tree.value.args[0]\n",

0 commit comments

Comments
 (0)