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

force reload pycodestyle module #740

Merged
merged 1 commit into from Mar 17, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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