Skip to content

Commit

Permalink
Merge pull request #1255 from correctmost/cm/combine-rstrips
Browse files Browse the repository at this point in the history
Combine rstrip calls in trailing_whitespace check
  • Loading branch information
asottile authored Aug 9, 2024
2 parents fc2c2ba + 035b52f commit c8e36a0
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions pycodestyle.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,9 +233,11 @@ def trailing_whitespace(physical_line):
W291: spam(1) \n#
W293: class Foo(object):\n \n bang = 12
"""
physical_line = physical_line.rstrip('\n') # chr(10), newline
physical_line = physical_line.rstrip('\r') # chr(13), carriage return
physical_line = physical_line.rstrip('\x0c') # chr(12), form feed, ^L
# Strip these trailing characters:
# - chr(10), newline
# - chr(13), carriage return
# - chr(12), form feed, ^L
physical_line = physical_line.rstrip('\n\r\x0c')
stripped = physical_line.rstrip(' \t\v')
if physical_line != stripped:
if stripped:
Expand Down

0 comments on commit c8e36a0

Please sign in to comment.