Skip to content

Commit f733364

Browse files
committed
Speed up _is_eol_token
1 parent c8e36a0 commit f733364

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

pycodestyle.py

+8-1
Original file line numberDiff line numberDiff line change
@@ -1829,7 +1829,14 @@ def update_counts(s, counts):
18291829

18301830

18311831
def _is_eol_token(token):
1832-
return token[0] in NEWLINE or token[4][token[3][1]:].lstrip() == '\\\n'
1832+
if token[0] in NEWLINE:
1833+
return True
1834+
1835+
# Check if the line's penultimate character is a continuation character
1836+
if token[4][-2] != '\\':
1837+
return False
1838+
1839+
return token[4][token[3][1]:].lstrip() == '\\\n'
18331840

18341841

18351842
########################################################################

0 commit comments

Comments
 (0)