Skip to content

Commit 7c76609

Browse files
committed
Generalize format str mapping key regex
1 parent 74b59d4 commit 7c76609

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

mypy/checkstrformat.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ def check_str_interpolation(self, str: StrExpr, replacements: Node) -> Type:
7070
return self.named_type('builtins.str')
7171

7272
def parse_conversion_specifiers(self, format: str) -> List[ConversionSpecifier]:
73-
key_regex = r'(\(([\w ]*)\))?' # (optional) parenthesised sequence of characters
73+
key_regex = r'(\(([^()]*)\))?' # (optional) parenthesised sequence of characters
7474
flags_regex = r'([#0\-+ ]*)' # (optional) sequence of flags
7575
width_regex = r'(\*|[1-9][0-9]*)?' # (optional) minimum field width (* or numbers)
7676
precision_regex = r'(?:\.(\*|[0-9]+)?)?' # (optional) . followed by * of numbers

0 commit comments

Comments
 (0)