Skip to content

Commit 3fbf07e

Browse files
chore: update pre-commit hooks (#1409)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent da948f0 commit 3fbf07e

File tree

100 files changed

+126
-59
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

100 files changed

+126
-59
lines changed

.pre-commit-config.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ repos:
2121
- id: trailing-whitespace
2222

2323
- repo: https://github.com/python-jsonschema/check-jsonschema
24-
rev: 0.27.4
24+
rev: 0.28.1
2525
hooks:
2626
- id: check-github-workflows
2727

@@ -52,7 +52,7 @@ repos:
5252
- id: rst-inline-touching-normal
5353

5454
- repo: https://github.com/pre-commit/mirrors-mypy
55-
rev: "v1.8.0"
55+
rev: "v1.9.0"
5656
hooks:
5757
- id: mypy
5858
files: jupyter_server
@@ -61,7 +61,7 @@ repos:
6161
["traitlets>=5.13", "jupyter_core>=5.5", "jupyter_client>=8.5"]
6262

6363
- repo: https://github.com/astral-sh/ruff-pre-commit
64-
rev: v0.2.0
64+
rev: v0.3.5
6565
hooks:
6666
- id: ruff
6767
types_or: [python, jupyter]
@@ -70,7 +70,7 @@ repos:
7070
types_or: [python, jupyter]
7171

7272
- repo: https://github.com/scientific-python/cookie
73-
rev: "2024.01.24"
73+
rev: "2024.03.10"
7474
hooks:
7575
- id: sp-repo-review
7676
additional_dependencies: ["repo-review[cli]"]

examples/authorization/jupyter_nbclassic_readonly_config.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Nbclassic read only auth example."""
2+
23
from jupyter_server.auth import Authorizer
34

45

examples/authorization/jupyter_nbclassic_rw_config.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Nbclassic read/write auth example."""
2+
23
from jupyter_server.auth import Authorizer
34

45

examples/authorization/jupyter_temporary_config.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Nbclassic temporary server auth example."""
2+
23
from jupyter_server.auth import Authorizer
34

45

examples/identity/system_password/jupyter_server_config.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Jupyter server system password identity provider example."""
2+
23
import pwd
34
from getpass import getuser
45

examples/simple/conftest.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
"""Pytest configuration."""
2+
23
pytest_plugins = ["jupyter_server.pytest_plugin"]

examples/simple/jupyter_server_config.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Configuration file for jupyter-server extensions."""
2+
23
# ------------------------------------------------------------------------------
34
# Application(SingletonConfigurable) configuration
45
# ------------------------------------------------------------------------------
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
"""Jupyter server config."""
2+
23
c.SimpleApp11.ignore_js = True # type:ignore[name-defined]

examples/simple/jupyter_simple_ext1_config.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Jupyter server config."""
2+
23
c.SimpleApp1.configA = "ConfigA from file" # type:ignore[name-defined]
34
c.SimpleApp1.configB = "ConfigB from file" # type:ignore[name-defined]
45
c.SimpleApp1.configC = "ConfigC from file" # type:ignore[name-defined]
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
"""Jupyter server config."""
2+
23
c.SimpleApp2.configD = "ConfigD from file" # type:ignore[name-defined]

examples/simple/simple_ext1/__main__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Application cli main."""
2+
23
from .application import main
34

45
if __name__ == "__main__":

examples/simple/simple_ext1/application.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Jupyter server example application."""
2+
23
import os
34

45
from traitlets import Unicode

examples/simple/simple_ext1/handlers.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Jupyter server example handlers."""
2+
23
from jupyter_server.auth import authorized
34
from jupyter_server.base.handlers import JupyterHandler
45
from jupyter_server.extension.handler import ExtensionHandlerJinjaMixin, ExtensionHandlerMixin

examples/simple/simple_ext11/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Extension entry point."""
2+
23
from .application import SimpleApp11
34

45

examples/simple/simple_ext11/__main__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Application cli main."""
2+
23
from .application import main
34

45
if __name__ == "__main__":

examples/simple/simple_ext11/application.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""A Jupyter Server example application."""
2+
23
import os
34

45
from simple_ext1.application import SimpleApp1 # type:ignore[import-not-found]

examples/simple/simple_ext2/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""The extension entry point."""
2+
23
from .application import SimpleApp2
34

45

examples/simple/simple_ext2/__main__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""The application cli main."""
2+
23
from .application import main
34

45
if __name__ == "__main__":

examples/simple/simple_ext2/application.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""A simple Jupyter Server extension example."""
2+
23
import os
34

45
from traitlets import Unicode

examples/simple/simple_ext2/handlers.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""API handlers for the Jupyter Server example."""
2+
23
from jupyter_server.base.handlers import JupyterHandler
34
from jupyter_server.extension.handler import ExtensionHandlerJinjaMixin, ExtensionHandlerMixin
45
from jupyter_server.utils import url_escape

examples/simple/tests/test_handlers.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Tests for the simple handler."""
2+
23
import pytest
34

45

jupyter_server/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""The Jupyter Server"""
2+
23
import os
34
import pathlib
45

jupyter_server/_sysinfo.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
"""
22
Utilities for getting information about Jupyter and the system it's running in.
33
"""
4+
45
# Copyright (c) Jupyter Development Team.
56
# Distributed under the terms of the Modified BSD License.
67
import os

jupyter_server/_tz.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
44
Just UTC-awareness right now
55
"""
6+
67
# Copyright (c) Jupyter Development Team.
78
# Distributed under the terms of the Modified BSD License.
89
from __future__ import annotations

jupyter_server/_version.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
store the current version info of the server.
33
44
"""
5+
56
import re
67
from typing import List
78

jupyter_server/auth/__main__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""The cli for auth."""
2+
23
import argparse
34
import sys
45
import warnings

jupyter_server/auth/authorizer.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
66
.. versionadded:: 2.0
77
"""
8+
89
# Copyright (c) Jupyter Development Team.
910
# Distributed under the terms of the Modified BSD License.
1011
from __future__ import annotations

jupyter_server/auth/decorator.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
"""Decorator for layering authorization into JupyterHandlers.
2-
"""
1+
"""Decorator for layering authorization into JupyterHandlers."""
2+
33
# Copyright (c) Jupyter Development Team.
44
# Distributed under the terms of the Modified BSD License.
55
import asyncio

jupyter_server/auth/identity.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
66
.. versionadded:: 2.0
77
"""
8+
89
from __future__ import annotations
910

1011
import binascii

jupyter_server/auth/login.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Tornado handlers for logging into the Jupyter Server."""
2+
23
# Copyright (c) Jupyter Development Team.
34
# Distributed under the terms of the Modified BSD License.
45
import os
@@ -128,9 +129,9 @@ def post(self):
128129
config_dir = self.settings.get("config_dir", "")
129130
config_file = os.path.join(config_dir, "jupyter_server_config.json")
130131
if hasattr(self.identity_provider, "hashed_password"):
131-
self.identity_provider.hashed_password = self.settings[
132-
"password"
133-
] = set_password(new_password, config_file=config_file)
132+
self.identity_provider.hashed_password = self.settings["password"] = (
133+
set_password(new_password, config_file=config_file)
134+
)
134135
self.log.info("Wrote hashed password to %s" % config_file)
135136
else:
136137
self.set_status(401)

jupyter_server/auth/logout.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
"""Tornado handlers for logging out of the Jupyter Server.
2-
"""
1+
"""Tornado handlers for logging out of the Jupyter Server."""
2+
33
# Copyright (c) Jupyter Development Team.
44
# Distributed under the terms of the Modified BSD License.
55
from ..base.handlers import JupyterHandler

jupyter_server/auth/security.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
"""
22
Password generation for the Jupyter Server.
33
"""
4+
45
import getpass
56
import hashlib
67
import json

jupyter_server/auth/utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
"""A module with various utility methods for authorization in Jupyter Server.
2-
"""
1+
"""A module with various utility methods for authorization in Jupyter Server."""
2+
33
# Copyright (c) Jupyter Development Team.
44
# Distributed under the terms of the Modified BSD License.
55
import importlib

jupyter_server/base/handlers.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Base Tornado handlers for the Jupyter server."""
2+
23
# Copyright (c) Jupyter Development Team.
34
# Distributed under the terms of the Modified BSD License.
45
from __future__ import annotations

jupyter_server/base/websocket.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Base websocket classes."""
2+
23
import re
34
import warnings
45
from typing import Optional, no_type_check

jupyter_server/base/zmqhandlers.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""This module is deprecated in Jupyter Server 2.0"""
2+
23
# Raise a warning that this module is deprecated.
34
import warnings
45

jupyter_server/config_manager.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Manager to read and modify config data in JSON files."""
2+
23
# Copyright (c) Jupyter Development Team.
34
# Distributed under the terms of the Modified BSD License.
45
from __future__ import annotations

jupyter_server/extension/application.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""An extension application."""
2+
23
from __future__ import annotations
34

45
import logging

jupyter_server/extension/config.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Extension config."""
2+
23
from jupyter_server.services.config.manager import ConfigManager
34

45
DEFAULT_SECTION_NAME = "jupyter_server_config"

jupyter_server/extension/handler.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""An extension handler."""
2+
23
from __future__ import annotations
34

45
from logging import Logger

jupyter_server/extension/manager.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""The extension manager."""
2+
23
from __future__ import annotations
34

45
import importlib

jupyter_server/extension/serverextension.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Utilities for installing extensions"""
2+
23
# Copyright (c) Jupyter Development Team.
34
# Distributed under the terms of the Modified BSD License.
45
from __future__ import annotations

jupyter_server/extension/utils.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Extension utilities."""
2+
23
import importlib
34
import time
45
import warnings

jupyter_server/files/handlers.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Serve files directly from the ContentsManager."""
2+
23
# Copyright (c) Jupyter Development Team.
34
# Distributed under the terms of the Modified BSD License.
45
from __future__ import annotations

jupyter_server/gateway/connections.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Gateway connection classes."""
2+
23
# Copyright (c) Jupyter Development Team.
34
# Distributed under the terms of the Modified BSD License.
45
from __future__ import annotations
@@ -68,9 +69,7 @@ def _connection_done(self, fut):
6869
else:
6970
self.log.warning(
7071
"Websocket connection has been closed via client disconnect or due to error. "
71-
"Kernel with ID '{}' may not be terminated on GatewayClient: {}".format(
72-
self.kernel_id, GatewayClient.instance().url
73-
)
72+
f"Kernel with ID '{self.kernel_id}' may not be terminated on GatewayClient: {GatewayClient.instance().url}"
7473
)
7574

7675
def disconnect(self):

jupyter_server/gateway/gateway_client.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""A kernel gateway client."""
2+
23
# Copyright (c) Jupyter Development Team.
34
# Distributed under the terms of the Modified BSD License.
45
from __future__ import annotations

jupyter_server/gateway/handlers.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Gateway API handlers."""
2+
23
# Copyright (c) Jupyter Development Team.
34
# Distributed under the terms of the Modified BSD License.
45
from __future__ import annotations
@@ -200,9 +201,7 @@ def _connection_done(self, fut):
200201
else:
201202
self.log.warning(
202203
"Websocket connection has been closed via client disconnect or due to error. "
203-
"Kernel with ID '{}' may not be terminated on GatewayClient: {}".format(
204-
self.kernel_id, GatewayClient.instance().url
205-
)
204+
f"Kernel with ID '{self.kernel_id}' may not be terminated on GatewayClient: {GatewayClient.instance().url}"
206205
)
207206

208207
def _disconnect(self):
@@ -298,8 +297,8 @@ async def get(self, kernel_name, path, include_body=True):
298297
)
299298
if kernel_spec_res is None:
300299
self.log.warning(
301-
"Kernelspec resource '{}' for '{}' not found. Gateway may not support"
302-
" resource serving.".format(path, kernel_name)
300+
f"Kernelspec resource '{path}' for '{kernel_name}' not found. Gateway may not support"
301+
" resource serving."
303302
)
304303
else:
305304
mimetype = mimetypes.guess_type(path)[0] or "text/plain"

jupyter_server/gateway/managers.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Kernel gateway managers."""
2+
23
# Copyright (c) Jupyter Development Team.
34
# Distributed under the terms of the Modified BSD License.
45
from __future__ import annotations
@@ -671,9 +672,7 @@ def stop(self) -> None:
671672
return
672673
if len(msgs):
673674
self.log.warning(
674-
"Stopping channel '{}' with {} unprocessed non-status messages: {}.".format(
675-
self.channel_name, len(msgs), msgs
676-
)
675+
f"Stopping channel '{self.channel_name}' with {len(msgs)} unprocessed non-status messages: {msgs}."
677676
)
678677

679678
def is_alive(self) -> bool:

jupyter_server/i18n/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
"""Server functions for loading translations
2-
"""
1+
"""Server functions for loading translations"""
2+
33
from __future__ import annotations
44

55
import errno

0 commit comments

Comments
 (0)