Skip to content

Commit 1391e01

Browse files
committed
test gh actions breakage
1 parent 2681755 commit 1391e01

File tree

2 files changed

+20
-5
lines changed

2 files changed

+20
-5
lines changed

nbdev/maker.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,8 +177,9 @@ def _import2relative(cells, lib_name=None):
177177
def _retr_mdoc(cells):
178178
"Search for `_doc_` variable, used to create module docstring"
179179
trees = L(cells).map(NbCell.parsed_).concat()
180-
res = [nested_attr(o, 'value.value') for o in trees
181-
if isinstance(o, _assign_types) and getattr(o.targets[0],'id',None)=='_doc_']
180+
r1 = [o for o in trees if isinstance(o, _assign_types)]
181+
res = [nested_attr(o, 'value.value') for o in r1 if getattr(o.targets[0],'id',None)=='_doc_']
182+
raise Exception(([getattr(o.targets[0],'id',None) for o in r1], trees, r1, res))
182183
return f'"""{res[0]}"""\n\n' if res else ""
183184

184185
# %% ../nbs/09_API/02_maker.ipynb 33

nbs/09_API/02_maker.ipynb

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -469,16 +469,30 @@
469469
"def _retr_mdoc(cells):\n",
470470
" \"Search for `_doc_` variable, used to create module docstring\"\n",
471471
" trees = L(cells).map(NbCell.parsed_).concat()\n",
472-
" res = [nested_attr(o, 'value.value') for o in trees\n",
473-
" if isinstance(o, _assign_types) and getattr(o.targets[0],'id',None)=='_doc_']\n",
472+
" r1 = [o for o in trees if isinstance(o, _assign_types)]\n",
473+
" res = [nested_attr(o, 'value.value') for o in r1 if getattr(o.targets[0],'id',None)=='_doc_']\n",
474+
" raise Exception(([getattr(o.targets[0],'id',None) for o in r1], trees, r1, res))\n",
474475
" return f'\"\"\"{res[0]}\"\"\"\\n\\n' if res else \"\""
475476
]
476477
},
477478
{
478479
"cell_type": "code",
479480
"execution_count": null,
480481
"metadata": {},
481-
"outputs": [],
482+
"outputs": [
483+
{
484+
"ename": "Exception",
485+
"evalue": "(['a', '_doc_'], [<ast.Assign object at 0x11e5fda60>, <ast.Assign object at 0x1037c4220>], [<ast.Assign object at 0x11e5fda60>, <ast.Assign object at 0x1037c4220>], ['hi'])",
486+
"output_type": "error",
487+
"traceback": [
488+
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
489+
"\u001b[0;31mException\u001b[0m Traceback (most recent call last)",
490+
"Input \u001b[0;32mIn [33]\u001b[0m, in \u001b[0;36m<cell line: 3>\u001b[0;34m()\u001b[0m\n\u001b[1;32m 1\u001b[0m \u001b[38;5;66;03m#|hide\u001b[39;00m\n\u001b[1;32m 2\u001b[0m c \u001b[38;5;241m=\u001b[39m make_code_cells(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124ma = \u001b[39m\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mb\u001b[39m\u001b[38;5;124m'\u001b[39m\u001b[38;5;130;01m\\n\u001b[39;00m\u001b[38;5;124m_doc_ = \u001b[39m\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mhi\u001b[39m\u001b[38;5;124m'\u001b[39m\u001b[38;5;124m\"\u001b[39m)\n\u001b[0;32m----> 3\u001b[0m test_eq(\u001b[43m_retr_mdoc\u001b[49m\u001b[43m(\u001b[49m\u001b[43mc\u001b[49m\u001b[43m)\u001b[49m, \u001b[38;5;124m'\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mhi\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;130;01m\\n\u001b[39;00m\u001b[38;5;130;01m\\n\u001b[39;00m\u001b[38;5;124m'\u001b[39m)\n",
491+
"Input \u001b[0;32mIn [32]\u001b[0m, in \u001b[0;36m_retr_mdoc\u001b[0;34m(cells)\u001b[0m\n\u001b[1;32m 5\u001b[0m r1 \u001b[38;5;241m=\u001b[39m [o \u001b[38;5;28;01mfor\u001b[39;00m o \u001b[38;5;129;01min\u001b[39;00m trees \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28misinstance\u001b[39m(o, _assign_types)]\n\u001b[1;32m 6\u001b[0m res \u001b[38;5;241m=\u001b[39m [nested_attr(o, \u001b[38;5;124m'\u001b[39m\u001b[38;5;124mvalue.value\u001b[39m\u001b[38;5;124m'\u001b[39m) \u001b[38;5;28;01mfor\u001b[39;00m o \u001b[38;5;129;01min\u001b[39;00m r1 \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28mgetattr\u001b[39m(o\u001b[38;5;241m.\u001b[39mtargets[\u001b[38;5;241m0\u001b[39m],\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mid\u001b[39m\u001b[38;5;124m'\u001b[39m,\u001b[38;5;28;01mNone\u001b[39;00m)\u001b[38;5;241m==\u001b[39m\u001b[38;5;124m'\u001b[39m\u001b[38;5;124m_doc_\u001b[39m\u001b[38;5;124m'\u001b[39m]\n\u001b[0;32m----> 7\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m \u001b[38;5;167;01mException\u001b[39;00m(([\u001b[38;5;28mgetattr\u001b[39m(o\u001b[38;5;241m.\u001b[39mtargets[\u001b[38;5;241m0\u001b[39m],\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mid\u001b[39m\u001b[38;5;124m'\u001b[39m,\u001b[38;5;28;01mNone\u001b[39;00m) \u001b[38;5;28;01mfor\u001b[39;00m o \u001b[38;5;129;01min\u001b[39;00m r1], trees, r1, res))\n\u001b[1;32m 8\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;124mf\u001b[39m\u001b[38;5;124m'\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;132;01m{\u001b[39;00mres[\u001b[38;5;241m0\u001b[39m]\u001b[38;5;132;01m}\u001b[39;00m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;130;01m\\n\u001b[39;00m\u001b[38;5;130;01m\\n\u001b[39;00m\u001b[38;5;124m'\u001b[39m \u001b[38;5;28;01mif\u001b[39;00m res \u001b[38;5;28;01melse\u001b[39;00m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124m\"\u001b[39m\n",
492+
"\u001b[0;31mException\u001b[0m: (['a', '_doc_'], [<ast.Assign object at 0x11e5fda60>, <ast.Assign object at 0x1037c4220>], [<ast.Assign object at 0x11e5fda60>, <ast.Assign object at 0x1037c4220>], ['hi'])"
493+
]
494+
}
495+
],
482496
"source": [
483497
"#|hide\n",
484498
"c = make_code_cells(\"a = 'b'\\n_doc_ = 'hi'\")\n",

0 commit comments

Comments
 (0)