Skip to content

Commit

Permalink
FIx issue mwouts#938
Browse files Browse the repository at this point in the history
  • Loading branch information
Skylion007 committed Mar 30, 2022
1 parent adff5a2 commit f579bac
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion jupytext/magics.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def get_comment(ext):
_MAGIC_FORCE_ESC_RE["csharp"] = re.compile(r"^(// |//)*#![a-zA-Z](.*)//\s*noescape")

# Commands starting with a question or exclamation mark have to be escaped
_PYTHON_HELP_OR_BASH_CMD = re.compile(r"^\s*(# |#)*\s*(\?|!)\s*[A-Za-z\.\~\$\\\/]")
_PYTHON_HELP_OR_BASH_CMD = re.compile(r"^\s*(# |#)*\s*(\?|!)\s*[A-Za-z\.\~\$\\\/\{\}]")

# A bash command not followed by an equal sign or a parenthesis is a magic command
_PYTHON_MAGIC_CMD = re.compile(
Expand Down
1 change: 1 addition & 0 deletions tests/test_escape_magics.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,7 @@ def test_force_comment_using_contents_manager(tmpdir):
"cat ",
"cat hello.txt",
"cat --option=value hello.txt",
"!{x}",
],
)
def test_comment_bash_commands_in_python(magic_cmd):
Expand Down

0 comments on commit f579bac

Please sign in to comment.