Skip to content

Commit

Permalink
Merge pull request #740 from hhatto/reload
Browse files Browse the repository at this point in the history
force reload pycodestyle module
  • Loading branch information
hhatto committed Mar 17, 2024
2 parents 0fa37c2 + eddf8fa commit 0b4c5f2
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions autopep8.py
Expand Up @@ -69,6 +69,7 @@ class documentation for more information.
import copy
import difflib
import fnmatch
import importlib
import inspect
import io
import itertools
Expand Down Expand Up @@ -221,9 +222,6 @@ def extended_blank_lines(logical_line,
yield (0, 'E301 expected 1 blank line, found 0')


pycodestyle.register_check(extended_blank_lines)


def continued_indentation(logical_line, tokens, indent_level, hang_closing,
indent_char, noqa):
"""Override pycodestyle's function to provide indentation information."""
Expand Down Expand Up @@ -415,7 +413,11 @@ def continued_indentation(logical_line, tokens, indent_level, hang_closing,
yield (pos, 'E125 {}'.format(desired_indent))


# NOTE: need reload with runpy and call twice
# see: https://github.com/hhatto/autopep8/issues/625
importlib.reload(pycodestyle)
del pycodestyle._checks['logical_line'][pycodestyle.continued_indentation]
pycodestyle.register_check(extended_blank_lines)
pycodestyle.register_check(continued_indentation)


Expand Down

0 comments on commit 0b4c5f2

Please sign in to comment.