Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Feb 3, 2025
1 parent 8c9f931 commit 0a48a93
Show file tree
Hide file tree
Showing 6 changed files with 53 additions and 54 deletions.
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

0 comments on commit 0a48a93

Please sign in to comment.