8000 Do not depend on pycodestyle (#335) · python-lsp/python-lsp-server@f83f6b5 · GitHub
[go: up one dir, main page]

Skip to content

Commit f83f6b5

Browse files
authored
Do not depend on pycodestyle (#335)
1 parent 0ddfa44 commit f83f6b5

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

pyls/config/config.py

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,6 @@
55
import pluggy
66

77
from pyls import _utils, hookspecs, uris, PYLS
8-
from .flake8_conf import Flake8Config
9-
from .pycodestyle_conf import PyCodeStyleConfig
10-
118

129
log = logging.getLogger(__name__)
1310

@@ -25,10 +22,17 @@ def __init__(self, root_uri, init_opts):
2522
self._settings = {}
2623
self._plugin_settings = {}
2724

28-
self._config_sources = {
29-
'flake8': Flake8Config(self._root_path),
30-
'pycodestyle': PyCodeStyleConfig(self._root_path)
31-
}
25+
self._config_sources = {}
26+
try:
27+
from .flake8_conf import Flake8Config
28+
self._config_sources['flake8'] = Flake8Config(self._root_path)
29+
except ImportError:
30+
pass
31+
try:
32+
from .pycodestyle_conf import PyCodeStyleConfig
33+
self._config_sources['pycodestyle'] = PyCodeStyleConfig(self._root_path)
34+
except ImportError:
35+
pass
3236

3337
self._pm = pluggy.PluginManager(PYLS)
3438
self._pm.trace.root.setwriter(log.debug)

0 commit comments

Comments
 (0)
0