Skip to content

Commit

Permalink
Merge pull request #704 from hhatto/paugier-fix-pycodestyle-missing_w…
Browse files Browse the repository at this point in the history
…hitespace

Paugier fix pycodestyle missing whitespace
  • Loading branch information
hhatto authored Aug 26, 2023
2 parents c3fdfe4 + f0138a0 commit fbedc22
Showing 1 changed file with 8 additions and 11 deletions.
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

0 comments on commit fbedc22

Please sign in to comment.