From 3e8f6aece2f323f00c5801c7564eac94b5205a93 Mon Sep 17 00:00:00 2001 From: Jeremy Howard Date: Tue, 24 Sep 2024 08:50:06 +1000 Subject: [PATCH] fixes #1452 --- nbdev/migrate.py | 2 +- nbdev/processors.py | 2 +- nbdev/quarto.py | 2 +- nbdev/release.py | 2 +- nbs/api/10_processors.ipynb | 2 +- nbs/api/14_quarto.ipynb | 2 +- nbs/api/16_migrate.ipynb | 2 +- nbs/api/18_release.ipynb | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/nbdev/migrate.py b/nbdev/migrate.py index d862aa012..88c18f1ae 100644 --- a/nbdev/migrate.py +++ b/nbdev/migrate.py @@ -112,7 +112,7 @@ def _re_v1(): d += L(get_config().tst_flags).filter() d += [s.replace('_', '-') for s in d] # allow for hyphenated version of old directives _tmp = '|'.join(list(set(d))) - return re.compile(f"^[ \f\v\t]*?(#)\s*({_tmp})(?!\S)", re.MULTILINE) + return re.compile(fr"^[ \f\v\t]*?(#)\s*({_tmp})(?!\S)", re.MULTILINE) def _repl_directives(code_str): def _fmt(x): return f"#| {_subv1(x[2].replace('-', '_').strip())}" diff --git a/nbdev/processors.py b/nbdev/processors.py index 376a8bc8b..fab1cb2f2 100644 --- a/nbdev/processors.py +++ b/nbdev/processors.py @@ -206,7 +206,7 @@ def rm_export(cell): def _is_showdoc(cell): return cell['cell_type'] == 'code' and _re_showdoc.search(cell.source) def _add_directives(cell, d): for k,v in d.items(): - if not re.findall(f'#\| *{k}:', cell.source): cell.source = f'#| {k}: {v}\n' + cell.source + if not re.findall(fr'#\| *{k}:', cell.source): cell.source = f'#| {k}: {v}\n' + cell.source def clean_show_doc(cell): "Remove ShowDoc input cells" diff --git a/nbdev/quarto.py b/nbdev/quarto.py index 88084b16a..ea5a87a08 100644 --- a/nbdev/quarto.py +++ b/nbdev/quarto.py @@ -110,7 +110,7 @@ def nbdev_sidebar( path:str=None, # Path to notebooks printit:bool=False, # Print YAML for debugging force:bool=False, # Create sidebar even if settings.ini custom_sidebar=False - skip_folder_re:str='(?:^[_.]|^www\$)', # Skip folders matching regex + skip_folder_re:str=r'(?:^[_.]|^www\$)', # Skip folders matching regex **kwargs): "Create sidebar.yml" if not force and get_config().custom_sidebar: return diff --git a/nbdev/release.py b/nbdev/release.py index 86bb30ace..8991bdc25 100644 --- a/nbdev/release.py +++ b/nbdev/release.py @@ -288,7 +288,7 @@ def release_conda( if skip_upload: return print(loc) if not upload_user: upload_user = get_config().conda_user if not upload_user: return print("`conda_user` not in settings.ini and no `upload_user` passed. Cannot upload") - if 'anaconda upload' not in res: return print(f"{res}\n\Failed. Check auto-upload not set in .condarc. Try `--do_build False`.") + if 'anaconda upload' not in res: return print(f"{res}\n\nFailed. Check auto-upload not set in .condarc. Try `--do_build False`.") return anaconda_upload(name, loc) # %% ../nbs/api/18_release.ipynb diff --git a/nbs/api/10_processors.ipynb b/nbs/api/10_processors.ipynb index d5790b377..23add0f55 100644 --- a/nbs/api/10_processors.ipynb +++ b/nbs/api/10_processors.ipynb @@ -660,7 +660,7 @@ "def _is_showdoc(cell): return cell['cell_type'] == 'code' and _re_showdoc.search(cell.source)\n", "def _add_directives(cell, d):\n", " for k,v in d.items():\n", - " if not re.findall(f'#\\| *{k}:', cell.source): cell.source = f'#| {k}: {v}\\n' + cell.source\n", + " if not re.findall(fr'#\\| *{k}:', cell.source): cell.source = f'#| {k}: {v}\\n' + cell.source\n", "\n", "def clean_show_doc(cell):\n", " \"Remove ShowDoc input cells\"\n", diff --git a/nbs/api/14_quarto.ipynb b/nbs/api/14_quarto.ipynb index f1cb84211..6d3ffe96b 100644 --- a/nbs/api/14_quarto.ipynb +++ b/nbs/api/14_quarto.ipynb @@ -215,7 +215,7 @@ " path:str=None, # Path to notebooks\n", " printit:bool=False, # Print YAML for debugging\n", " force:bool=False, # Create sidebar even if settings.ini custom_sidebar=False\n", - " skip_folder_re:str='(?:^[_.]|^www\\$)', # Skip folders matching regex\n", + " skip_folder_re:str=r'(?:^[_.]|^www\\$)', # Skip folders matching regex\n", " **kwargs):\n", " \"Create sidebar.yml\"\n", " if not force and get_config().custom_sidebar: return\n", diff --git a/nbs/api/16_migrate.ipynb b/nbs/api/16_migrate.ipynb index f54cb842e..8c318f267 100644 --- a/nbs/api/16_migrate.ipynb +++ b/nbs/api/16_migrate.ipynb @@ -599,7 +599,7 @@ " d += L(get_config().tst_flags).filter()\n", " d += [s.replace('_', '-') for s in d] # allow for hyphenated version of old directives\n", " _tmp = '|'.join(list(set(d)))\n", - " return re.compile(f\"^[ \\f\\v\\t]*?(#)\\s*({_tmp})(?!\\S)\", re.MULTILINE)\n", + " return re.compile(fr\"^[ \\f\\v\\t]*?(#)\\s*({_tmp})(?!\\S)\", re.MULTILINE)\n", "\n", "def _repl_directives(code_str): \n", " def _fmt(x): return f\"#| {_subv1(x[2].replace('-', '_').strip())}\"\n", diff --git a/nbs/api/18_release.ipynb b/nbs/api/18_release.ipynb index f74264dd2..a0e60c968 100644 --- a/nbs/api/18_release.ipynb +++ b/nbs/api/18_release.ipynb @@ -685,7 +685,7 @@ " if skip_upload: return print(loc)\n", " if not upload_user: upload_user = get_config().conda_user\n", " if not upload_user: return print(\"`conda_user` not in settings.ini and no `upload_user` passed. Cannot upload\")\n", - " if 'anaconda upload' not in res: return print(f\"{res}\\n\\Failed. Check auto-upload not set in .condarc. Try `--do_build False`.\")\n", + " if 'anaconda upload' not in res: return print(f\"{res}\\n\\nFailed. Check auto-upload not set in .condarc. Try `--do_build False`.\")\n", " return anaconda_upload(name, loc)" ] },