Skip to content

Commit

Permalink
Remove pycodestyle plugin's dependency on autopep8 (#813)
Browse files Browse the repository at this point in the history
  • Loading branch information
rharish101 authored May 25, 2020
1 parent 4217971 commit 2dc19c2
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions pyls/plugins/pycodestyle_lint.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
# Copyright 2017 Palantir Technologies, Inc.
import logging
import pycodestyle
from autopep8 import continued_indentation as autopep8_c_i
from pyls import hookimpl, lsp

# Check if autopep8's continued_indentation implementation
# is overriding pycodestyle's and if so, re-register
# the check using pycodestyle's implementation as expected
if autopep8_c_i in pycodestyle._checks['logical_line']:
del pycodestyle._checks['logical_line'][autopep8_c_i]
pycodestyle.register_check(pycodestyle.continued_indentation)
try:
from autopep8 import continued_indentation as autopep8_c_i
except ImportError:
pass
else:
# Check if autopep8's continued_indentation implementation
# is overriding pycodestyle's and if so, re-register
# the check using pycodestyle's implementation as expected
if autopep8_c_i in pycodestyle._checks['logical_line']:
del pycodestyle._checks['logical_line'][autopep8_c_i]
pycodestyle.register_check(pycodestyle.continued_indentation)

log = logging.getLogger(__name__)

Expand Down

0 comments on commit 2dc19c2

Please sign in to comment.