Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: update pre-commit hooks #1449

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ ci:

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
rev: v5.0.0
hooks:
- id: check-case-conflict
- id: check-ast
Expand All @@ -21,12 +21,12 @@ repos:
- id: trailing-whitespace

- repo: https://github.com/python-jsonschema/check-jsonschema
rev: 0.28.6
rev: 0.31.1
hooks:
- id: check-github-workflows

- repo: https://github.com/executablebooks/mdformat
rev: 0.7.17
rev: 0.7.22
hooks:
- id: mdformat
additional_dependencies:
Expand All @@ -39,7 +39,7 @@ repos:
types_or: [yaml, html, json]

- repo: https://github.com/codespell-project/codespell
rev: "v2.3.0"
rev: "v2.4.1"
hooks:
- id: codespell
args: ["-L", "sur,nd"]
Expand All @@ -52,7 +52,7 @@ repos:
- id: rst-inline-touching-normal

- repo: https://github.com/pre-commit/mirrors-mypy
rev: "v1.10.1"
rev: "v1.14.1"
hooks:
- id: mypy
files: jupyter_server
Expand All @@ -61,7 +61,7 @@ repos:
["traitlets>=5.13", "jupyter_core>=5.5", "jupyter_client>=8.5"]

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.5.0
rev: v0.9.4
hooks:
- id: ruff
types_or: [python, jupyter]
Expand All @@ -70,7 +70,7 @@ repos:
types_or: [python, jupyter]

- repo: https://github.com/scientific-python/cookie
rev: "2024.04.23"
rev: "2025.01.22"
hooks:
- id: sp-repo-review
additional_dependencies: ["repo-review[cli]"]
90 changes: 45 additions & 45 deletions CHANGELOG.md

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion jupyter_server/kernelspecs/handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ async def get(self, kernel_name, path, include_body=True):
"""Get a kernelspec resource."""
ksm = self.kernel_spec_manager
if path.lower().endswith(".png"):
self.set_header("Cache-Control", f"max-age={60*60*24*30}")
self.set_header("Cache-Control", f"max-age={60 * 60 * 24 * 30}")
ksm = self.kernel_spec_manager
if hasattr(ksm, "get_kernel_spec_resource"):
# If the kernel spec manager defines a method to get kernelspec resources,
Expand Down
4 changes: 2 additions & 2 deletions jupyter_server/services/contents/filemanager.py
Original file line number Diff line number Diff line change
Expand Up @@ -667,7 +667,7 @@ def _copy_dir(self, from_path, to_path_original, to_name, to_path):
"""
try:
os_from_path = self._get_os_path(from_path.strip("/"))
os_to_path = f'{self._get_os_path(to_path_original.strip("/"))}/{to_name}'
os_to_path = f"{self._get_os_path(to_path_original.strip('/'))}/{to_name}"
shutil.copytree(os_from_path, os_to_path)
model = self.get(to_path, content=False)
except OSError as err:
Expand Down Expand Up @@ -1150,7 +1150,7 @@ async def _copy_dir(
"""
try:
os_from_path = self._get_os_path(from_path.strip("/"))
os_to_path = f'{self._get_os_path(to_path_original.strip("/"))}/{to_name}'
os_to_path = f"{self._get_os_path(to_path_original.strip('/'))}/{to_name}"
shutil.copytree(os_from_path, os_to_path)
model = await self.get(to_path, content=False)
except OSError as err:
Expand Down
3 changes: 1 addition & 2 deletions jupyter_server/traittypes.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,8 +164,7 @@ class or its subclasses. Our implementation is quite different
self.klasses = klasses
else:
raise TraitError(
"The klasses attribute must be a list of class names or classes"
" not: %r" % klasses
"The klasses attribute must be a list of class names or classes not: %r" % klasses
)

if (kw is not None) and not isinstance(kw, dict):
Expand Down
2 changes: 1 addition & 1 deletion tests/services/kernels/test_cull.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ async def test_cull_connected(jp_fetch, jp_ws_fetch):
"parent_header": {},
"metadata": {},
"content": {
"code": f"import time\ntime.sleep({CULL_TIMEOUT-1})",
"code": f"import time\ntime.sleep({CULL_TIMEOUT - 1})",
"silent": False,
"allow_stdin": False,
"stop_on_error": True,
Expand Down
6 changes: 3 additions & 3 deletions tests/test_gateway.py
Original file line number Diff line number Diff line change
Expand Up @@ -753,9 +753,9 @@ async def test_websocket_connection_with_session_id(init_gateway, jp_serverapp,
expected_ws_url = (
f"{mock_gateway_ws_url}/api/kernels/{kernel_id}/channels?session_id={conn.session_id}"
)
assert (
expected_ws_url in caplog.text
), "WebSocket URL does not contain the expected session_id."
assert expected_ws_url in caplog.text, (
"WebSocket URL does not contain the expected session_id."
)

# Processing websocket messages happens in separate coroutines and any
# errors in that process will show up in logs, but not bubble up to the
Expand Down
Loading