Skip to content

Commit e5ee26d

Browse files
authored
Merge pull request #165 from jtpio/cleanup-imports
Cleanup unused imports
2 parents 5d3dd27 + 26b838c commit e5ee26d

11 files changed

+32
-60
lines changed

jupyterlab_server/app.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,11 @@
44
# Copyright (c) Jupyter Development Team.
55
# Distributed under the terms of the Modified BSD License.
66

7-
import os, jinja2
8-
from traitlets import Unicode
9-
from jinja2 import Environment, FileSystemLoader
10-
from traitlets import Bool, Unicode, default, observe
117
from jupyter_server.extension.application import ExtensionApp, ExtensionAppJinjaMixin
12-
from traitlets import Unicode, Integer, Dict
8+
from traitlets import Dict, Integer, Unicode, observe
139

1410
from ._version import __version__
15-
from .server import url_path_join as ujoin
16-
from .handlers import add_handlers, LabConfig
11+
from .handlers import LabConfig, add_handlers
1712

1813

1914
class LabServerApp(ExtensionAppJinjaMixin, LabConfig, ExtensionApp):

jupyterlab_server/config.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,18 @@
44
# Copyright (c) Jupyter Development Team.
55
# Distributed under the terms of the Modified BSD License.
66

7+
import json
8+
import os.path as osp
79
from glob import iglob
810
from itertools import chain
9-
import json
1011
from os.path import join as pjoin
11-
import os.path as osp
12-
import os
1312

14-
from jupyter_core.paths import jupyter_path, jupyter_config_dir, SYSTEM_CONFIG_PATH
13+
from jupyter_core.paths import SYSTEM_CONFIG_PATH, jupyter_config_dir, jupyter_path
1514
from jupyter_server.services.config.manager import ConfigManager, recursive_update
1615
from traitlets import Bool, HasTraits, List, Unicode, default
1716

1817
from .server import url_path_join as ujoin
1918

20-
2119
# -----------------------------------------------------------------------------
2220
# Module globals
2321
# -----------------------------------------------------------------------------

jupyterlab_server/handlers.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,10 @@
33

44
# Copyright (c) Jupyter Development Team.
55
# Distributed under the terms of the Modified BSD License.
6-
from glob import glob
7-
import json
86
import os
9-
import os.path as osp
107
from urllib.parse import urlparse
118

12-
from jinja2 import FileSystemLoader, TemplateError
139
from tornado import template, web
14-
from traitlets import Bool, HasTraits, List, Unicode, default
1510

1611
from jupyter_server.extension.handler import ExtensionHandlerMixin, ExtensionHandlerJinjaMixin
1712

jupyterlab_server/listings_handler.py

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,12 @@
33
# Copyright (c) Jupyter Development Team.
44
# Distributed under the terms of the Modified BSD License.
55

6-
import os
7-
import time
86
import json
9-
import re
10-
import tornado
11-
12-
from .server import APIHandler
13-
14-
from traitlets import Instance
15-
167

178
import requests
9+
import tornado
1810

11+
from .server import APIHandler
1912

2013
LISTINGS_URL_SUFFIX='@jupyterlab/extensionmanager-extension/listings.json'
2114

@@ -55,7 +48,7 @@ class ListingsHandler(APIHandler):
5548

5649
"""Below fields are class level fields that are accessed and populated
5750
by the initialization and the fetch_listings methods.
58-
Some fields are initialized before the handler creation in the
51+
Some fields are initialized before the handler creation in the
5952
handlers.py#add_handlers method.
6053
Having those fields predefined reduces the guards in the methods using
6154
them.

jupyterlab_server/process_app.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,12 @@
22
"""A lab app that runs a sub process for a demo or a test."""
33
import sys
44

5+
from jupyter_server.extension.application import ExtensionApp, ExtensionAppJinjaMixin
56
from tornado.ioloop import IOLoop
6-
from traitlets import Bool
77

8-
from .server import ServerApp
9-
from .handlers import add_handlers, LabConfig
8+
from .handlers import LabConfig, add_handlers
109
from .process import Process
1110

12-
from traitlets import Unicode
13-
14-
from jupyter_server.extension.application import ExtensionApp, ExtensionAppJinjaMixin
15-
1611

1712
class ProcessApp(ExtensionAppJinjaMixin, LabConfig, ExtensionApp):
1813
"""A jupyterlab app that runs a separate process and exits on completion."""

jupyterlab_server/pytest_plugin.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,14 @@
1-
import pytest, shutil, os
21
import json
2+
import os
33
import os.path as osp
4+
import shutil
45
from os.path import join as pjoin
56

6-
from jupyterlab_server import LabServerApp, LabConfig
7+
import pytest
78

8-
from traitlets import Unicode
9-
10-
from jupyterlab_server.tests.utils import here
9+
from jupyterlab_server import LabServerApp
1110
from jupyterlab_server.app import LabServerApp
1211

13-
1412
pytest_plugins = [
1513
"jupyter_server.pytest_plugin"
1614
]

jupyterlab_server/settings_handler.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,16 @@
44
# Distributed under the terms of the Modified BSD License.
55
import json
66
import os
7-
87
from glob import glob
8+
99
import json5
10-
from jsonschema import ValidationError
1110
from jsonschema import Draft4Validator as Validator
12-
from tornado import web
13-
14-
from jupyter_server.extension.handler import ExtensionHandlerMixin, ExtensionHandlerJinjaMixin
11+
from jsonschema import ValidationError
12+
from jupyter_server.extension.handler import ExtensionHandlerJinjaMixin, ExtensionHandlerMixin
1513
from jupyter_server.services.config.manager import ConfigManager, recursive_update
14+
from tornado import web
1615

17-
from .server import APIHandler, json_errors, tz
18-
16+
from .server import APIHandler, tz
1917

2018
# The JupyterLab settings file extension.
2119
SETTINGS_EXTENSION = '.jupyterlab-settings'

jupyterlab_server/themes_handler.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,14 @@
33
# Copyright (c) Jupyter Development Team.
44
# Distributed under the terms of the Modified BSD License.
55

6-
from glob import glob
7-
from os import path as osp
86
import os
97
import re
8+
from glob import glob
9+
from os import path as osp
1010
from urllib.parse import urlparse
1111

12-
from .server import FileFindHandler, url_path_join as ujoin
12+
from .server import FileFindHandler
13+
from .server import url_path_join as ujoin
1314

1415

1516
class ThemesHandler(FileFindHandler):
@@ -24,7 +25,7 @@ def initialize(self, path, default_filename=None,
2425
for ext_dir in labextensions_path:
2526
theme_pattern = ext_dir + '/**/themes'
2627
ext_paths.extend([path for path in glob(theme_pattern, recursive=True)])
27-
28+
2829
# Add the core theme path last
2930
if not isinstance(path, list):
3031
path = [path]

jupyterlab_server/translation_utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
"""
55

66
import gettext
7-
import json
87
import importlib
8+
import json
99
import os
1010
import subprocess
1111
import sys
@@ -621,7 +621,7 @@ def load(cls, domain: str) -> TranslationBundle:
621621
----------
622622
domain: str
623623
The translations domain. The normalized python package name.
624-
624+
625625
Returns
626626
-------
627627
Translator

jupyterlab_server/translations_handler.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,15 @@
66
"""
77

88
import json
9-
import os
109
import traceback
1110

1211
import tornado
13-
from tornado import gen, web
12+
from tornado import gen
1413

14+
from .server import APIHandler
1515
from .settings_handler import get_settings
1616
from .translation_utils import get_language_pack, get_language_packs, is_valid_locale, translator
1717

18-
from .server import APIHandler, url_path_join
1918

2019
SCHEMA_NAME = '@jupyterlab/translation-extension:plugin'
2120

0 commit comments

Comments
 (0)