Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Try to fix an AttributeError related to pycodestyle 2.11.0 #699

Merged
merged 2 commits into from
Aug 26, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 8 additions & 10 deletions autopep8.py
Original file line number Diff line number Diff line change
Expand Up @@ -758,16 +758,14 @@ def fix_e225(self, result):
return
if not check_syntax(fixed.lstrip()):
return
if (
parse_version(pycodestyle.__version__) >=
parse_version("2.11.0")
):
operator_whitespace = pycodestyle.missing_whitespace
else:
operator_whitespace = \
pycodestyle.missing_whitespace_around_operator
errors = list(
operator_whitespace(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
Loading