Skip to content

Commit

Permalink
chore: update pre-commit hooks (#1409)
Browse files Browse the repository at this point in the history
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
pre-commit-ci[bot] authored Apr 1, 2024
1 parent da948f0 commit 3fbf07e
Show file tree
Hide file tree
Showing 100 changed files with 126 additions and 59 deletions.
8 changes: 4 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ repos:
- id: trailing-whitespace

- repo: https://github.com/python-jsonschema/check-jsonschema
rev: 0.27.4
rev: 0.28.1
hooks:
- id: check-github-workflows

Expand Down Expand Up @@ -52,7 +52,7 @@ repos:
- id: rst-inline-touching-normal

- repo: https://github.com/pre-commit/mirrors-mypy
rev: "v1.8.0"
rev: "v1.9.0"
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.2.0
rev: v0.3.5
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.01.24"
rev: "2024.03.10"
hooks:
- id: sp-repo-review
additional_dependencies: ["repo-review[cli]"]
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Nbclassic read only auth example."""

from jupyter_server.auth import Authorizer


Expand Down
1 change: 1 addition & 0 deletions examples/authorization/jupyter_nbclassic_rw_config.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Nbclassic read/write auth example."""

from jupyter_server.auth import Authorizer


Expand Down
1 change: 1 addition & 0 deletions examples/authorization/jupyter_temporary_config.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Nbclassic temporary server auth example."""

from jupyter_server.auth import Authorizer


Expand Down
1 change: 1 addition & 0 deletions examples/identity/system_password/jupyter_server_config.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Jupyter server system password identity provider example."""

import pwd
from getpass import getuser

Expand Down
1 change: 1 addition & 0 deletions examples/simple/conftest.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
"""Pytest configuration."""

pytest_plugins = ["jupyter_server.pytest_plugin"]
1 change: 1 addition & 0 deletions examples/simple/jupyter_server_config.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Configuration file for jupyter-server extensions."""

# ------------------------------------------------------------------------------
# Application(SingletonConfigurable) configuration
# ------------------------------------------------------------------------------
Expand Down
1 change: 1 addition & 0 deletions examples/simple/jupyter_simple_ext11_config.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
"""Jupyter server config."""

c.SimpleApp11.ignore_js = True # type:ignore[name-defined]
1 change: 1 addition & 0 deletions examples/simple/jupyter_simple_ext1_config.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Jupyter server config."""

c.SimpleApp1.configA = "ConfigA from file" # type:ignore[name-defined]
c.SimpleApp1.configB = "ConfigB from file" # type:ignore[name-defined]
c.SimpleApp1.configC = "ConfigC from file" # type:ignore[name-defined]
Expand Down
1 change: 1 addition & 0 deletions examples/simple/jupyter_simple_ext2_config.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
"""Jupyter server config."""

c.SimpleApp2.configD = "ConfigD from file" # type:ignore[name-defined]
1 change: 1 addition & 0 deletions examples/simple/simple_ext1/__main__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Application cli main."""

from .application import main

if __name__ == "__main__":
Expand Down
1 change: 1 addition & 0 deletions examples/simple/simple_ext1/application.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Jupyter server example application."""

import os

from traitlets import Unicode
Expand Down
1 change: 1 addition & 0 deletions examples/simple/simple_ext1/handlers.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Jupyter server example handlers."""

from jupyter_server.auth import authorized
from jupyter_server.base.handlers import JupyterHandler
from jupyter_server.extension.handler import ExtensionHandlerJinjaMixin, ExtensionHandlerMixin
Expand Down
1 change: 1 addition & 0 deletions examples/simple/simple_ext11/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Extension entry point."""

from .application import SimpleApp11


Expand Down
1 change: 1 addition & 0 deletions examples/simple/simple_ext11/__main__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Application cli main."""

from .application import main

if __name__ == "__main__":
Expand Down
1 change: 1 addition & 0 deletions examples/simple/simple_ext11/application.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""A Jupyter Server example application."""

import os

from simple_ext1.application import SimpleApp1 # type:ignore[import-not-found]
Expand Down
1 change: 1 addition & 0 deletions examples/simple/simple_ext2/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""The extension entry point."""

from .application import SimpleApp2


Expand Down
1 change: 1 addition & 0 deletions examples/simple/simple_ext2/__main__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""The application cli main."""

from .application import main

if __name__ == "__main__":
Expand Down
1 change: 1 addition & 0 deletions examples/simple/simple_ext2/application.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""A simple Jupyter Server extension example."""

import os

from traitlets import Unicode
Expand Down
1 change: 1 addition & 0 deletions examples/simple/simple_ext2/handlers.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""API handlers for the Jupyter Server example."""

from jupyter_server.base.handlers import JupyterHandler
from jupyter_server.extension.handler import ExtensionHandlerJinjaMixin, ExtensionHandlerMixin
from jupyter_server.utils import url_escape
Expand Down
1 change: 1 addition & 0 deletions examples/simple/tests/test_handlers.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Tests for the simple handler."""

import pytest


Expand Down
1 change: 1 addition & 0 deletions jupyter_server/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""The Jupyter Server"""

import os
import pathlib

Expand Down
1 change: 1 addition & 0 deletions jupyter_server/_sysinfo.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Utilities for getting information about Jupyter and the system it's running in.
"""

# Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License.
import os
Expand Down
1 change: 1 addition & 0 deletions jupyter_server/_tz.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
Just UTC-awareness right now
"""

# Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License.
from __future__ import annotations
Expand Down
1 change: 1 addition & 0 deletions jupyter_server/_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
store the current version info of the server.
"""

import re
from typing import List

Expand Down
1 change: 1 addition & 0 deletions jupyter_server/auth/__main__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""The cli for auth."""

import argparse
import sys
import warnings
Expand Down
1 change: 1 addition & 0 deletions jupyter_server/auth/authorizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
.. versionadded:: 2.0
"""

# Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License.
from __future__ import annotations
Expand Down
4 changes: 2 additions & 2 deletions jupyter_server/auth/decorator.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"""Decorator for layering authorization into JupyterHandlers.
"""
"""Decorator for layering authorization into JupyterHandlers."""

# Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License.
import asyncio
Expand Down
1 change: 1 addition & 0 deletions jupyter_server/auth/identity.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
.. versionadded:: 2.0
"""

from __future__ import annotations

import binascii
Expand Down
7 changes: 4 additions & 3 deletions jupyter_server/auth/login.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Tornado handlers for logging into the Jupyter Server."""

# Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License.
import os
Expand Down Expand Up @@ -128,9 +129,9 @@ def post(self):
config_dir = self.settings.get("config_dir", "")
config_file = os.path.join(config_dir, "jupyter_server_config.json")
if hasattr(self.identity_provider, "hashed_password"):
self.identity_provider.hashed_password = self.settings[
"password"
] = set_password(new_password, config_file=config_file)
self.identity_provider.hashed_password = self.settings["password"] = (
set_password(new_password, config_file=config_file)
)
self.log.info("Wrote hashed password to %s" % config_file)
else:
self.set_status(401)
Expand Down
4 changes: 2 additions & 2 deletions jupyter_server/auth/logout.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"""Tornado handlers for logging out of the Jupyter Server.
"""
"""Tornado handlers for logging out of the Jupyter Server."""

# Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License.
from ..base.handlers import JupyterHandler
Expand Down
1 change: 1 addition & 0 deletions jupyter_server/auth/security.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Password generation for the Jupyter Server.
"""

import getpass
import hashlib
import json
Expand Down
4 changes: 2 additions & 2 deletions jupyter_server/auth/utils.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"""A module with various utility methods for authorization in Jupyter Server.
"""
"""A module with various utility methods for authorization in Jupyter Server."""

# Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License.
import importlib
Expand Down
1 change: 1 addition & 0 deletions jupyter_server/base/handlers.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Base Tornado handlers for the Jupyter server."""

# Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License.
from __future__ import annotations
Expand Down
1 change: 1 addition & 0 deletions jupyter_server/base/websocket.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Base websocket classes."""

import re
import warnings
from typing import Optional, no_type_check
Expand Down
1 change: 1 addition & 0 deletions jupyter_server/base/zmqhandlers.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""This module is deprecated in Jupyter Server 2.0"""

# Raise a warning that this module is deprecated.
import warnings

Expand Down
1 change: 1 addition & 0 deletions jupyter_server/config_manager.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Manager to read and modify config data in JSON files."""

# Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License.
from __future__ import annotations
Expand Down
1 change: 1 addition & 0 deletions jupyter_server/extension/application.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""An extension application."""

from __future__ import annotations

import logging
Expand Down
1 change: 1 addition & 0 deletions jupyter_server/extension/config.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Extension config."""

from jupyter_server.services.config.manager import ConfigManager

DEFAULT_SECTION_NAME = "jupyter_server_config"
Expand Down
1 change: 1 addition & 0 deletions jupyter_server/extension/handler.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""An extension handler."""

from __future__ import annotations

from logging import Logger
Expand Down
1 change: 1 addition & 0 deletions jupyter_server/extension/manager.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""The extension manager."""

from __future__ import annotations

import importlib
Expand Down
1 change: 1 addition & 0 deletions jupyter_server/extension/serverextension.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Utilities for installing extensions"""

# Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License.
from __future__ import annotations
Expand Down
1 change: 1 addition & 0 deletions jupyter_server/extension/utils.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Extension utilities."""

import importlib
import time
import warnings
Expand Down
1 change: 1 addition & 0 deletions jupyter_server/files/handlers.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Serve files directly from the ContentsManager."""

# Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License.
from __future__ import annotations
Expand Down
5 changes: 2 additions & 3 deletions jupyter_server/gateway/connections.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Gateway connection classes."""

# Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License.
from __future__ import annotations
Expand Down Expand Up @@ -68,9 +69,7 @@ def _connection_done(self, fut):
else:
self.log.warning(
"Websocket connection has been closed via client disconnect or due to error. "
"Kernel with ID '{}' may not be terminated on GatewayClient: {}".format(
self.kernel_id, GatewayClient.instance().url
)
f"Kernel with ID '{self.kernel_id}' may not be terminated on GatewayClient: {GatewayClient.instance().url}"
)

def disconnect(self):
Expand Down
1 change: 1 addition & 0 deletions jupyter_server/gateway/gateway_client.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""A kernel gateway client."""

# Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License.
from __future__ import annotations
Expand Down
9 changes: 4 additions & 5 deletions jupyter_server/gateway/handlers.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Gateway API handlers."""

# Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License.
from __future__ import annotations
Expand Down Expand Up @@ -200,9 +201,7 @@ def _connection_done(self, fut):
else:
self.log.warning(
"Websocket connection has been closed via client disconnect or due to error. "
"Kernel with ID '{}' may not be terminated on GatewayClient: {}".format(
self.kernel_id, GatewayClient.instance().url
)
f"Kernel with ID '{self.kernel_id}' may not be terminated on GatewayClient: {GatewayClient.instance().url}"
)

def _disconnect(self):
Expand Down Expand Up @@ -298,8 +297,8 @@ async def get(self, kernel_name, path, include_body=True):
)
if kernel_spec_res is None:
self.log.warning(
"Kernelspec resource '{}' for '{}' not found. Gateway may not support"
" resource serving.".format(path, kernel_name)
f"Kernelspec resource '{path}' for '{kernel_name}' not found. Gateway may not support"
" resource serving."
)
else:
mimetype = mimetypes.guess_type(path)[0] or "text/plain"
Expand Down
5 changes: 2 additions & 3 deletions jupyter_server/gateway/managers.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Kernel gateway managers."""

# Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License.
from __future__ import annotations
Expand Down Expand Up @@ -671,9 +672,7 @@ def stop(self) -> None:
return
if len(msgs):
self.log.warning(
"Stopping channel '{}' with {} unprocessed non-status messages: {}.".format(
self.channel_name, len(msgs), msgs
)
f"Stopping channel '{self.channel_name}' with {len(msgs)} unprocessed non-status messages: {msgs}."
)

def is_alive(self) -> bool:
Expand Down
4 changes: 2 additions & 2 deletions jupyter_server/i18n/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"""Server functions for loading translations
"""
"""Server functions for loading translations"""

from __future__ import annotations

import errno
Expand Down
Loading

0 comments on commit 3fbf07e

Please sign in to comment.