Skip to content

Commit

Permalink
Speed up _is_eol_token
Browse files Browse the repository at this point in the history
  • Loading branch information
correctmost committed Aug 10, 2024
1 parent c8e36a0 commit d3118d4
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion pycodestyle.py
Original file line number Diff line number Diff line change
Expand Up @@ -1829,7 +1829,15 @@ def update_counts(s, counts):


def _is_eol_token(token):
return token[0] in NEWLINE or token[4][token[3][1]:].lstrip() == '\\\n'
if token[0] in NEWLINE:
return True

# Check if the line's penultimate character is a continuation
# character
if token[4][-2] != '\\':
return False

return token[4][token[3][1]:].lstrip() == '\\\n'


########################################################################
Expand Down

0 comments on commit d3118d4

Please sign in to comment.