Skip to content

Commit d768248

Browse files
committed
Revert "add flag for preserving magics"
This reverts commit b725c01.
1 parent b725c01 commit d768248

File tree

4 files changed

+12
-7
lines changed

4 files changed

+12
-7
lines changed

nbdev/config.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@ def _apply_defaults(
6363
clear_all:bool_arg=False, # Remove all cell metadata and cell outputs?
6464
cell_number:bool_arg=True, # Add cell number to the exported file
6565
put_version_in_init:bool_arg=True, # Add the version to the main __init__.py in nbdev_export
66-
keep_magics:bool = False, # Keep magic commands in rendered documentation (useful for AImagic notebooks)
6766
):
6867
"Apply default settings where missing in `cfg`."
6968
if getattr(cfg,'repo',None) is None:

nbdev/processors.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -183,8 +183,7 @@ def ai_magics(cell):
183183

184184
def clean_magics(cell):
185185
"A preprocessor to remove cell magic commands"
186-
if cell.cell_type == 'code' and not get_config().get('keep_magics', False):
187-
cell.source = _magics_pattern.sub('', cell.source).strip()
186+
if cell.cell_type == 'code': cell.source = _magics_pattern.sub('', cell.source).strip()
188187

189188
# %% ../nbs/api/10_processors.ipynb
190189
_re_hdr_dash = re.compile(r'^#+\s+.*\s+-\s*$', re.MULTILINE)

nbs/api/01_config.ipynb

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,6 @@
153153
" clear_all:bool_arg=False, # Remove all cell metadata and cell outputs?\n",
154154
" cell_number:bool_arg=True, # Add cell number to the exported file\n",
155155
" put_version_in_init:bool_arg=True, # Add the version to the main __init__.py in nbdev_export\n",
156-
" keep_magics:bool = False, # Keep magic commands in rendered documentation (useful for AImagic notebooks)\n",
157156
"):\n",
158157
" \"Apply default settings where missing in `cfg`.\"\n",
159158
" if getattr(cfg,'repo',None) is None:\n",
@@ -196,7 +195,16 @@
196195
"cell_type": "code",
197196
"execution_count": null,
198197
"metadata": {},
199-
"outputs": [],
198+
"outputs": [
199+
{
200+
"name": "stderr",
201+
"output_type": "stream",
202+
"text": [
203+
"/home/dienhoa/miniconda3/envs/se/lib/python3.9/site-packages/ghapi/core.py:102: UserWarning: Neither GITHUB_TOKEN nor GITHUB_JWT_TOKEN found: running as unauthenticated\n",
204+
" else: warn('Neither GITHUB_TOKEN nor GITHUB_JWT_TOKEN found: running as unauthenticated')\n"
205+
]
206+
}
207+
],
200208
"source": [
201209
"#|hide\n",
202210
"if os.getenv('GITHUB_ACTIONS') != 'true': # GITHUB_TOKEN in actions has limited scope.\n",

nbs/api/10_processors.ipynb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -578,8 +578,7 @@
578578
"\n",
579579
"def clean_magics(cell):\n",
580580
" \"A preprocessor to remove cell magic commands\"\n",
581-
" if cell.cell_type == 'code' and not get_config().get('keep_magics', False):\n",
582-
" cell.source = _magics_pattern.sub('', cell.source).strip()"
581+
" if cell.cell_type == 'code': cell.source = _magics_pattern.sub('', cell.source).strip()"
583582
]
584583
},
585584
{

0 commit comments

Comments
 (0)