Skip to content

Commit

Permalink
Merge pull request #1222 from PyCQA/asottile-patch-1
Browse files Browse the repository at this point in the history
improve backtracking of COMPARE_TYPE_REGEX
  • Loading branch information
asottile committed Dec 27, 2023
2 parents 13a238b + 9dc066b commit 0dde8ea
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pycodestyle.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,8 @@
COMPARE_NEGATIVE_REGEX = re.compile(r'\b(?<!is\s)(not)\s+[^][)(}{ ]+\s+'
r'(in|is)\s')
COMPARE_TYPE_REGEX = re.compile(
r'[=!]=\s+type(?:\s*\(\s*([^)]*[^ )])\s*\))'
r'|\btype(?:\s*\(\s*([^)]*[^ )])\s*\))\s+[=!]='
r'[=!]=\s+type(?:\s*\(\s*([^)]*[^\s)])\s*\))'
r'|\btype(?:\s*\(\s*([^)]*[^\s)])\s*\))\s+[=!]='
)
KEYWORD_REGEX = re.compile(r'(\s*)\b(?:%s)\b(\s*)' % r'|'.join(KEYWORDS))
OPERATOR_REGEX = re.compile(r'(?:[^,\s])(\s*)(?:[-+*/|!<=>%&^]+|:=)(\s*)')
Expand Down

0 comments on commit 0dde8ea

Please sign in to comment.