Skip to content

Commit

Permalink
fix incorrect E702 fixes with --select=E702 option
Browse files Browse the repository at this point in the history
  • Loading branch information
hhatto committed Apr 11, 2020
1 parent ddc1fc4 commit d8902ee
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion autopep8.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ class documentation for more information.
from ConfigParser import Error

import pycodestyle
from pycodestyle import STARTSWITH_INDENT_STATEMENT_REGEX


try:
Expand Down Expand Up @@ -1028,7 +1029,14 @@ def fix_e702(self, result, logical):
# https://docs.python.org/reference/compound_stmts.html
for line in logical_lines:
if (result['id'] == 'E702' and ':' in line
and STARTSWITH_DEF_REGEX.match(line)):
and STARTSWITH_INDENT_STATEMENT_REGEX.match(line)):
if self.options.verbose:
print(
'---> avoid fixing {error} with '
'other compound statements'.format(error=result['id'],
ine=result['line']),
file=sys.stderr
)
return []

line_index = result['line'] - 1
Expand Down

0 comments on commit d8902ee

Please sign in to comment.