Skip to content

Commit aff43d3

Browse files
Fix some CodeQL notices (#371)
* Fix some CodeQL notices * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent bcbbc35 commit aff43d3

File tree

8 files changed

+15
-36
lines changed

8 files changed

+15
-36
lines changed

jupyterlab_server/config.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,9 @@
1111

1212
from jupyter_core.paths import SYSTEM_CONFIG_PATH, jupyter_config_dir, jupyter_path
1313
from jupyter_server.services.config.manager import ConfigManager, recursive_update
14+
from jupyter_server.utils import url_path_join as ujoin
1415
from traitlets import Bool, HasTraits, List, Unicode, default
1516

16-
from .server import url_path_join as ujoin
17-
1817
# -----------------------------------------------------------------------------
1918
# Module globals
2019
# -----------------------------------------------------------------------------

jupyterlab_server/handlers.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,14 @@
88
from functools import lru_cache
99
from urllib.parse import urlparse
1010

11+
from jupyter_server.base.handlers import FileFindHandler, JupyterHandler
1112
from jupyter_server.extension.handler import ExtensionHandlerJinjaMixin, ExtensionHandlerMixin
13+
from jupyter_server.utils import url_path_join as ujoin
1214
from tornado import template, web
1315

1416
from .config import LabConfig, get_page_config, recursive_update
1517
from .licenses_handler import LicensesHandler, LicensesManager
1618
from .listings_handler import ListingsHandler, fetch_listings
17-
from .server import FileFindHandler, JupyterHandler
18-
from .server import url_path_join as ujoin
1919
from .settings_handler import SettingsHandler
2020
from .themes_handler import ThemesHandler
2121
from .translations_handler import TranslationsHandler

jupyterlab_server/licenses_handler.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@
1111
from concurrent.futures import ThreadPoolExecutor
1212
from pathlib import Path
1313

14+
from jupyter_server.base.handlers import APIHandler
1415
from tornado import gen, web
1516
from traitlets import List, Unicode
1617
from traitlets.config import LoggingConfigurable
1718

1819
from .config import get_federated_extensions
19-
from .server import APIHandler
2020

2121
# this is duplicated in @juptyerlab/builder
2222
DEFAULT_THIRD_PARTY_LICENSE_FILE = "third-party-licenses.json"

jupyterlab_server/listings_handler.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@
77

88
import requests
99
import tornado
10-
11-
from .server import APIHandler
10+
from jupyter_server.base.handlers import APIHandler
1211

1312
LISTINGS_URL_SUFFIX = "@jupyterlab/extensionmanager-extension/listings.json"
1413

jupyterlab_server/server.py

Lines changed: 0 additions & 19 deletions
This file was deleted.

jupyterlab_server/settings_utils.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,11 @@
99
import json5 # type:ignore
1010
from jsonschema import Draft4Validator as Validator
1111
from jsonschema import ValidationError
12+
from jupyter_server import _tz as tz
13+
from jupyter_server.base.handlers import APIHandler
1214
from jupyter_server.services.config.manager import ConfigManager, recursive_update
1315
from tornado import web
1416

15-
from .server import APIHandler, tz
1617
from .translation_utils import DEFAULT_LOCALE, L10N_SCHEMA_NAME, SYS_LOCALE, is_valid_locale
1718

1819
# The JupyterLab settings file extension.

jupyterlab_server/themes_handler.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,10 @@
66
import os
77
import re
88
from glob import glob
9-
from os import path as osp
109
from urllib.parse import urlparse
1110

12-
from .server import FileFindHandler
13-
from .server import url_path_join as ujoin
11+
from jupyter_server.base.handlers import FileFindHandler
12+
from jupyter_server.utils import url_path_join as ujoin
1413

1514

1615
class ThemesHandler(FileFindHandler):
@@ -50,7 +49,7 @@ def get_content(self, abspath, start=None, end=None):
5049
This method should either return a byte string or an iterator
5150
of byte strings.
5251
"""
53-
base, ext = osp.splitext(abspath)
52+
base, ext = os.path.splitext(abspath)
5453
if ext != ".css":
5554
return FileFindHandler.get_content(abspath, start, end)
5655

@@ -59,7 +58,7 @@ def get_content(self, abspath, start=None, end=None):
5958
def get_content_size(self):
6059
"""Retrieve the total size of the resource at the given path."""
6160
assert self.absolute_path is not None # noqa
62-
base, ext = osp.splitext(self.absolute_path)
61+
base, ext = os.path.splitext(self.absolute_path)
6362
if ext != ".css":
6463
return FileFindHandler.get_content_size(self)
6564
else:
@@ -71,7 +70,7 @@ def _get_css(self):
7170
with open(self.absolute_path, "rb") as fid:
7271
data = fid.read().decode("utf-8")
7372

74-
basedir = osp.dirname(self.path).replace(os.sep, "/")
73+
basedir = os.path.dirname(self.path).replace(os.sep, "/")
7574
basepath = ujoin(self.themes_url, basedir)
7675

7776
# Replace local paths with mangled paths.

jupyterlab_server/workspaces_handler.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@
99
import urllib
1010
from pathlib import Path
1111

12+
from jupyter_server import _tz as tz
13+
from jupyter_server.base.handlers import APIHandler
1214
from jupyter_server.extension.handler import ExtensionHandlerJinjaMixin, ExtensionHandlerMixin
15+
from jupyter_server.utils import url_path_join as ujoin
1316
from tornado import web
1417
from traitlets.config import LoggingConfigurable
1518

16-
from .server import APIHandler, tz
17-
from .server import url_path_join as ujoin
18-
1919
# The JupyterLab workspace file extension.
2020
WORKSPACE_EXTENSION = ".jupyterlab-workspace"
2121

0 commit comments

Comments
 (0)