Skip to content

Commit bf8ac0a

Browse files
committed
[ref] Clean up RE_DOT_OR_PERC
1 parent 6be1566 commit bf8ac0a

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

black.py

+8-4
Original file line numberDiff line numberDiff line change
@@ -128,10 +128,14 @@ def re_named_group(name: str, pttrn: str) -> str:
128128
RE_DOT_OR_PERC: Final = re_named_group(
129129
"dot_or_perc",
130130
(
131-
r"\.[A-Za-z0-9_]+"
132-
+ re_balanced_parens("1")
133-
+ "?| ?% ?"
134-
+ re_noncap_group(re_balanced_parens("2") + r"|" + RE_BALANCED_QUOTES)
131+
re_noncap_group(
132+
r"\.[A-Za-z0-9_]+" + re_balanced_parens("1") + "?"
133+
) # a method call
134+
+ "|" # OR
135+
+ re_noncap_group(
136+
r" ?% ?"
137+
+ re_noncap_group(re_balanced_parens("2") + r"|" + RE_BALANCED_QUOTES)
138+
) # an old-style '%' formatting expression
135139
),
136140
)
137141
RE_EOL: Final = r" *(?:#.*)?"

0 commit comments

Comments
 (0)