Skip to content

Commit bcbbc35

Browse files
[pre-commit.ci] pre-commit autoupdate (#370)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Steven Silvester <[email protected]>
1 parent fb77c74 commit bcbbc35

11 files changed

+23
-23
lines changed

.pre-commit-config.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ repos:
1919
- id: trailing-whitespace
2020

2121
- repo: https://github.com/python-jsonschema/check-jsonschema
22-
rev: 0.19.2
22+
rev: 0.21.0
2323
hooks:
2424
- id: check-github-workflows
2525

@@ -31,12 +31,12 @@ repos:
3131
[mdformat-gfm, mdformat-frontmatter, mdformat-footnote]
3232

3333
- repo: https://github.com/psf/black
34-
rev: 22.12.0
34+
rev: 23.1.0
3535
hooks:
3636
- id: black
3737

3838
- repo: https://github.com/charliermarsh/ruff-pre-commit
39-
rev: v0.0.236
39+
rev: v0.0.242
4040
hooks:
4141
- id: ruff
4242
args: ["--fix"]

jupyterlab_server/config.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ def get_static_page_config(app_settings_dir=None, logger=None, level="all"):
7979
return cm.get("page_config")
8080

8181

82-
def get_page_config(labextensions_path, app_settings_dir=None, logger=None):
82+
def get_page_config(labextensions_path, app_settings_dir=None, logger=None): # noqa
8383
"""Get the page config for the application handler"""
8484
# Build up the full page config
8585
page_config: dict = {}
@@ -113,7 +113,7 @@ def get_page_config(labextensions_path, app_settings_dir=None, logger=None):
113113
# Ensure there is a disabled key
114114
page_config.setdefault(disabled_key, {})
115115

116-
for (_, ext_data) in federated_exts.items():
116+
for _, ext_data in federated_exts.items():
117117
if "_build" not in ext_data["jupyterlab"]:
118118
logger.warning("%s is not a valid extension" % ext_data["name"])
119119
continue
@@ -143,7 +143,7 @@ def get_page_config(labextensions_path, app_settings_dir=None, logger=None):
143143
with open(package_data_file, encoding="utf-8") as fid:
144144
app_data = json.load(fid)
145145
all_ext_data = app_data["jupyterlab"].get("extensionMetadata", {})
146-
for (ext, ext_data) in all_ext_data.items():
146+
for ext, ext_data in all_ext_data.items():
147147
if ext in disabled_by_extensions_all:
148148
continue
149149
if ext_data.get(disabled_key):
@@ -164,8 +164,7 @@ def get_page_config(labextensions_path, app_settings_dir=None, logger=None):
164164
page_config[disabled_key] = rollup_disabled
165165

166166
# Convert dictionaries to lists to give to the front end
167-
for (key, value) in page_config.items():
168-
167+
for key, value in page_config.items():
169168
if isinstance(value, dict):
170169
page_config[key] = [subkey for subkey in value if value[subkey]]
171170

jupyterlab_server/handlers.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ def get_page_config(self):
9999
.as_posix()
100100
)
101101
except Exception:
102-
pass # we do not require the preferred_dir trait to be present
102+
pass # noqa # we do not require the preferred_dir trait to be present
103103
# JupyterLab relies on an unset/default path being "/"
104104
page_config["preferredPath"] = preferred_path or "/"
105105

@@ -175,7 +175,7 @@ def get_page_config(self):
175175
return page_config
176176

177177

178-
def add_handlers(handlers, extension_app):
178+
def add_handlers(handlers, extension_app): # noqa
179179
"""Add the appropriate handlers to the web app."""
180180
# Normalize directories.
181181
for name in LabConfig.class_trait_names():
@@ -246,7 +246,6 @@ def add_handlers(handlers, extension_app):
246246

247247
# Handle saved workspaces.
248248
if extension_app.workspaces_dir:
249-
250249
workspaces_config = {"manager": WorkspacesManager(extension_app.workspaces_dir)}
251250

252251
# Handle requests for the list of workspaces. Make slash optional.

jupyterlab_server/process.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ def terminate(self):
119119
try:
120120
proc.wait(timeout=2.0)
121121
except subprocess.TimeoutExpired:
122-
if os.name == "nt":
122+
if os.name == "nt": # noqa
123123
sig = signal.SIGBREAK # type:ignore
124124
else:
125125
sig = signal.SIGKILL

jupyterlab_server/server.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# Distributed under the terms of the Modified BSD License.
33

44
"""Server api."""
5-
from jupyter_server import _tz as tz # noqa
5+
from jupyter_server import _tz as tz
66
from jupyter_server.base.handlers import (
77
APIHandler,
88
FileFindHandler,
@@ -15,5 +15,5 @@
1515
RED_DISABLED,
1616
RED_X,
1717
)
18-
from jupyter_server.serverapp import ServerApp, aliases, flags # noqa
19-
from jupyter_server.utils import url_escape, url_path_join # noqa
18+
from jupyter_server.serverapp import ServerApp, aliases, flags
19+
from jupyter_server.utils import url_escape, url_path_join

jupyterlab_server/test_utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ def maybe_patch_ioloop():
188188
set_event_loop_policy(WindowsSelectorEventLoopPolicy())
189189

190190

191-
def expected_http_error(error, expected_code, expected_message=None):
191+
def expected_http_error(error, expected_code, expected_message=None): # noqa
192192
"""Check that the error matches the expected output error."""
193193
e = error.value
194194
if isinstance(e, tornado.web.HTTPError):

jupyterlab_server/translation_utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ def is_valid_locale(locale_: str) -> bool:
159159
valid = True
160160
except (babel.core.UnknownLocaleError, ValueError):
161161
# Expected error if the locale is unknown
162-
pass
162+
pass # noqa
163163

164164
return valid
165165

@@ -411,7 +411,7 @@ def update_locale(self, locale_: str) -> None:
411411
localedir = os.path.join(os.path.dirname(mod.__file__), LOCALE_DIR)
412412
except Exception:
413413
# no-op
414-
pass
414+
pass # noqa
415415

416416
self._translator = gettext.translation(
417417
self._domain, localedir=localedir, languages=(self._locale,), fallback=True

pyproject.toml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,10 +115,10 @@ test = "mypy --install-types --non-interactive {args:jupyterlab_server tests}"
115115

116116
[tool.hatch.envs.lint]
117117
dependencies = [
118-
"black[jupyter]==22.12.0",
118+
"black[jupyter]==23.1.0",
119119
"mdformat>0.7",
120120
"mdformat-gfm>=0.3.5",
121-
"ruff==0.0.236"
121+
"ruff==0.0.242"
122122
]
123123
detatched = true
124124
[tool.hatch.envs.lint.scripts]
@@ -233,6 +233,10 @@ ignore = [
233233
"E501",
234234
# SIM105 Use `contextlib.suppress(...)`
235235
"SIM105",
236+
# PLR0912 Too many branches
237+
"PLR0912",
238+
# PLR0913 Too many arguments to function call
239+
"PLR0913",
236240
]
237241

238242
[tool.ruff.per-file-ignores]

tests/test_licenses_api.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,4 +192,4 @@ def a_licenses_manager():
192192
def test_labextension_bundle(a_fake_labextension, a_licenses_manager):
193193
ext_path, ext_name = a_fake_labextension
194194
bundle = a_licenses_manager.license_bundle(ext_path, ext_name)
195-
assert bundle["packages"][0]["name"] == dict(FULL_ENTRY)["name"] # noqa
195+
assert bundle["packages"][0]["name"] == dict(FULL_ENTRY)["name"]

tests/test_translation_api.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ def teardown_module(module):
4848

4949
@pytest.fixture(autouse=True)
5050
def before_after_test(schemas_dir, user_settings_dir, labserverapp):
51-
5251
# Code that will run before any test.
5352

5453
# Copy the schema files.

0 commit comments

Comments
 (0)