From 8f588f53f5df570c4b88ebc1e9699b11717dc646 Mon Sep 17 00:00:00 2001 From: Ben Webb Date: Wed, 13 Mar 2024 11:23:15 -0700 Subject: [PATCH] Fix syntax warnings --- notebook/process_notebook.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/notebook/process_notebook.py b/notebook/process_notebook.py index 7d7ad9b..be39d0b 100755 --- a/notebook/process_notebook.py +++ b/notebook/process_notebook.py @@ -66,7 +66,7 @@ class RefLinks(object): """Handle doxygen-style @ref links in markdown""" include_re = re.compile(r'%%include\s+([^\s)]+)') backtick_link = re.compile(r'``([^\s`]+)``') - ref_link = re.compile('@ref\s+([^\s)]+)') + ref_link = re.compile(r'@ref\s+([^\s)]+)') def __init__(self): #: Mapping from identifier to URL @@ -186,9 +186,9 @@ def patch_source(source, rl): yield rl.fix_links(c) -_file_link_re = re.compile('@file\s+([^\s)]+)') +_file_link_re = re.compile(r'@file\s+([^\s)]+)') non_jupyter_constructs = re.compile('#?%%(html|nb|colab)(exclude|only)') -jupyter_anchor_re = re.compile('\s*\{#([^\s}]+)\}') +jupyter_anchor_re = re.compile(r'\s*\{#([^\s}]+)\}') def patch_jupyter(source, rl, toc, is_markdown): if is_markdown: for c in source: @@ -269,7 +269,7 @@ def write(self, cell, fh): def get_cell_subset(cells, excludestr, onlytype): for cell in cells: if not cell['source'] or excludestr not in cell['source'][0]: - m = re.search('%%(\S+)only', cell['source'][0]) + m = re.search(r'%%(\S+)only', cell['source'][0]) if not m or m.group(1) == onlytype: yield cell @@ -392,8 +392,8 @@ def write_header(self, fh): class TableOfContents(object): - anchor_re = re.compile('(#+)\s+(.*?)\s*\{#([^\s}]+)\}') - noanchor_re = re.compile('(#+)\s+(.*?)\s*$') + anchor_re = re.compile(r'(#+)\s+(.*?)\s*\{#([^\s}]+)\}') + noanchor_re = re.compile(r'(#+)\s+(.*?)\s*$') def __init__(self, filenum): self._auto_toc = 0 # autogenerated anchors for titles without them