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

Paugier fix pycodestyle missing whitespace #704

Merged
merged 3 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
19 changes: 8 additions & 11 deletions autopep8.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ class documentation for more information.
import warnings
import ast
from configparser import ConfigParser as SafeConfigParser, Error
from packaging.version import parse as parse_version

import pycodestyle
from pycodestyle import STARTSWITH_INDENT_STATEMENT_REGEX
Expand Down Expand Up @@ -758,16 +757,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