Skip to content

Commit b7afedf

Browse files
committed
Fix issues with formatters like black when line length is configured to be less then the replacement python code used to substitute ipython magics.
Changes to be committed: modified: nbqa/handle_magics.py
1 parent 342a542 commit b7afedf

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

nbqa/handle_magics.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ class MagicHandler(ABC):
7474
# we would run in to formatting issues like single quotes formatted
7575
# to double quotes or vice versa. `{token}` is used as hexadecimal number.
7676
_MAGIC_TEMPLATE: str = "type({token}) # {magic:10.10} {token}"
77-
_MAGIC_REGEX_TEMPLATE: str = r"type\({token}\).*{token}"
77+
_MAGIC_REGEX_TEMPLATE: str = r"type\s*\(\s*{token}\s*\).*{token}"
7878

7979
def replace_magic(self, ipython_magic: str) -> MagicSubstitution:
8080
"""

0 commit comments

Comments
 (0)