Skip to content

Commit d45492b

Browse files
committed
fix isort usage, run linters
1 parent 41db5d7 commit d45492b

File tree

10 files changed

+26
-20
lines changed

10 files changed

+26
-20
lines changed

docs/Configuring.ipynb

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -175,17 +175,18 @@
175175
]
176176
},
177177
{
178+
"cell_type": "markdown",
179+
"metadata": {},
178180
"source": [
179181
"#### virtual_documents_dir\n",
180182
"\n",
181183
"> default: os.getenv(\"JP_LSP_VIRTUAL_DIR\", \".virtual_documents\")\n",
182184
"\n",
183185
"Path to virtual documents relative to the content manager root directory.\n",
184186
"\n",
185-
"Its default value can be set with `JP_LSP_VIRTUAL_DIR` environment variable and fallback to `.virtual_documents`."
186-
],
187-
"cell_type": "markdown",
188-
"metadata": {}
187+
"Its default value can be set with `JP_LSP_VIRTUAL_DIR` environment variable and\n",
188+
"fallback to `.virtual_documents`."
189+
]
189190
},
190191
{
191192
"cell_type": "markdown",
@@ -224,4 +225,4 @@
224225
},
225226
"nbformat": 4,
226227
"nbformat_minor": 4
227-
}
228+
}

py_src/jupyter_lsp/manager.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,11 @@
66

77
import entrypoints
88
from notebook.transutils import _
9-
from traitlets import Bool, Dict as Dict_, Instance, List as List_, Unicode, default
9+
from traitlets import Bool
10+
from traitlets import Dict as Dict_
11+
from traitlets import Instance
12+
from traitlets import List as List_
13+
from traitlets import Unicode, default
1014

1115
from .constants import (
1216
EP_LISTENER_ALL_V1,

py_src/jupyter_lsp/non_blocking.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99

1010
if os.name == "nt": # pragma: no cover
1111
import msvcrt
12-
from ctypes import windll, byref, wintypes, WinError, POINTER
13-
from ctypes.wintypes import HANDLE, DWORD, BOOL
12+
from ctypes import POINTER, WinError, byref, windll, wintypes
13+
from ctypes.wintypes import BOOL, DWORD, HANDLE
1414
else: # pragma: no cover
1515
import fcntl
1616

py_src/jupyter_lsp/types.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@
2020
)
2121

2222
from notebook.transutils import _
23-
from traitlets import Instance, List as List_, Unicode, default
23+
from traitlets import Instance
24+
from traitlets import List as List_
25+
from traitlets import Unicode, default
2426
from traitlets.config import LoggingConfigurable
2527

2628
LanguageServerSpec = Dict[Text, Any]

requirements/docs.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,12 @@ dependencies:
99
- pandas
1010
- pip
1111
- pytest
12+
- pytest-check-links
1213
- python-graphviz
1314
- recommonmark
1415
- sphinx
1516
- sphinx_rtd_theme
1617
- sphinx-autobuild
1718
- sphinx-autodoc-typehints
1819
- sphinx-copybutton
19-
- pip:
20-
- pytest-check-links
21-
- sphinx-markdown-tables
20+
- sphinx-markdown-tables

scripts/bump_versions.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
from pathlib import Path
88
from typing import List
99

10-
from integrity import CHANGELOG, PIPE_FILE as PIPELINE
10+
from integrity import CHANGELOG
11+
from integrity import PIPE_FILE as PIPELINE
1112

1213
ROOT = Path.cwd()
1314

scripts/integrity.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,8 @@
2727
if True:
2828
# a workaround for isort 4.0 limitations
2929
# see https://github.com/timothycrosley/isort/issues/468
30-
from versions import ( # noqa
31-
REQUIRED_JUPYTERLAB as LAB_SPEC,
32-
JUPYTER_LSP_VERSION as PY_VERSION,
33-
)
30+
from versions import JUPYTER_LSP_VERSION as PY_VERSION
31+
from versions import REQUIRED_JUPYTERLAB as LAB_SPEC # noqa
3432

3533
REQS = ROOT / "requirements"
3634
BINDER = ROOT / "binder"

scripts/lint.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ def lint():
5252
map(
5353
call,
5454
[
55-
["isort", "-rc", *ALL_PY],
55+
["isort", *ALL_PY],
5656
["black", *ALL_PY],
5757
["flake8", *ALL_PY],
5858
# ["pylint", *ALL_PY],

scripts/nblint.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55

66
import black
77
import isort
8-
from isort.api import sort_code_string
98
import nbformat
109

1110
OK = 0
@@ -22,6 +21,7 @@
2221

2322
ISORT_CONFIG = isort.settings.Config(settings_path=ROOT / "setup.cfg")
2423

24+
2525
def blacken(source):
2626
return black.format_str(source, mode=black.FileMode(line_length=88))
2727

@@ -63,7 +63,7 @@ def nblint():
6363
changes += 1
6464
if source.startswith("%"):
6565
continue
66-
new = isort.sort_code_string(source, config=ISORT_CONFIG)
66+
new = isort.api.sort_code_string(source, config=ISORT_CONFIG)
6767
new = blacken(new).rstrip()
6868
if new != source:
6969
cell["source"] = new.splitlines(True)

setup.cfg

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ addopts =
7171
[isort]
7272
profile = black
7373
multi_line_output = 3
74+
known_first_party = jupyter_lsp
7475

7576
[pycodestyle]
7677
ignore = E203,W503,C0330

0 commit comments

Comments
 (0)