Skip to content

Commit

Permalink
Try to fix an AttributeError related to pycodestyle 2.11.0
Browse files Browse the repository at this point in the history
  • Loading branch information
paugier committed Aug 13, 2023
1 parent 5b9110b commit efbe9d4
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions autopep8.py
Original file line number Diff line number Diff line change
Expand Up @@ -757,8 +757,12 @@ def fix_e225(self, result):
return
if not check_syntax(fixed.lstrip()):
return
errors = list(
pycodestyle.missing_whitespace_around_operator(fixed, ts))
try:
_missing_whitespace = pycodestyle.missing_whitespace_around_operator
except AttributeError:
# pycodestyle >= 2.11.0
_missing_whitespace = pycodestyle.missing_whitespace
errors = list(_missing_whitespace(fixed, ts))
for e in reversed(errors):
if error_code != e[1].split()[0]:
continue
Expand Down

0 comments on commit efbe9d4

Please sign in to comment.