Skip to content

Commit

Permalink
Revised regexp.
Browse files Browse the repository at this point in the history
  • Loading branch information
emeryberger committed Oct 30, 2024
1 parent d45f495 commit 7576fc9
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion scalene/scalene_analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ def strip_magic_line(source: str) -> str:
# The above line will fail if not running in a notebook,
# in which case we return the original source unchanged.
# Regular expression to match and replace magic commands with comments
source = re.sub(r'(^\s*)%{1,2}', r'\1#', source, flags=re.MULTILINE)
source = re.sub(r'(^\s*)%{1,2}(\w+)', r'\1# \2', source, flags=re.MULTILINE)
finally:
return source

0 comments on commit 7576fc9

Please sign in to comment.