From 8ed2bb52f4be53be8779f608ffe4bed008c81265 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 1 Apr 2024 20:21:44 +0000 Subject: [PATCH 1/2] chore: update pre-commit hooks MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/python-jsonschema/check-jsonschema: 0.27.4 → 0.28.1](https://github.com/python-jsonschema/check-jsonschema/compare/0.27.4...0.28.1) - [github.com/pre-commit/mirrors-mypy: v1.8.0 → v1.9.0](https://github.com/pre-commit/mirrors-mypy/compare/v1.8.0...v1.9.0) - [github.com/astral-sh/ruff-pre-commit: v0.2.0 → v0.3.5](https://github.com/astral-sh/ruff-pre-commit/compare/v0.2.0...v0.3.5) - [github.com/scientific-python/cookie: 2024.01.24 → 2024.03.10](https://github.com/scientific-python/cookie/compare/2024.01.24...2024.03.10) --- .pre-commit-config.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 2a9017c5f3..96460982a3 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -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 @@ -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 @@ -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] @@ -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]"] From 4945a3e006c7cfc9ec98422a60dd321ce72eae4e Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 1 Apr 2024 20:22:10 +0000 Subject: [PATCH 2/2] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- .../jupyter_nbclassic_readonly_config.py | 1 + .../authorization/jupyter_nbclassic_rw_config.py | 1 + examples/authorization/jupyter_temporary_config.py | 1 + .../system_password/jupyter_server_config.py | 1 + examples/simple/conftest.py | 1 + examples/simple/jupyter_server_config.py | 1 + examples/simple/jupyter_simple_ext11_config.py | 1 + examples/simple/jupyter_simple_ext1_config.py | 1 + examples/simple/jupyter_simple_ext2_config.py | 1 + examples/simple/simple_ext1/__main__.py | 1 + examples/simple/simple_ext1/application.py | 1 + examples/simple/simple_ext1/handlers.py | 1 + examples/simple/simple_ext11/__init__.py | 1 + examples/simple/simple_ext11/__main__.py | 1 + examples/simple/simple_ext11/application.py | 1 + examples/simple/simple_ext2/__init__.py | 1 + examples/simple/simple_ext2/__main__.py | 1 + examples/simple/simple_ext2/application.py | 1 + examples/simple/simple_ext2/handlers.py | 1 + examples/simple/tests/test_handlers.py | 1 + jupyter_server/__init__.py | 1 + jupyter_server/_sysinfo.py | 1 + jupyter_server/_tz.py | 1 + jupyter_server/_version.py | 1 + jupyter_server/auth/__main__.py | 1 + jupyter_server/auth/authorizer.py | 1 + jupyter_server/auth/decorator.py | 4 ++-- jupyter_server/auth/identity.py | 1 + jupyter_server/auth/login.py | 7 ++++--- jupyter_server/auth/logout.py | 4 ++-- jupyter_server/auth/security.py | 1 + jupyter_server/auth/utils.py | 4 ++-- jupyter_server/base/handlers.py | 1 + jupyter_server/base/websocket.py | 1 + jupyter_server/base/zmqhandlers.py | 1 + jupyter_server/config_manager.py | 1 + jupyter_server/extension/application.py | 1 + jupyter_server/extension/config.py | 1 + jupyter_server/extension/handler.py | 1 + jupyter_server/extension/manager.py | 1 + jupyter_server/extension/serverextension.py | 1 + jupyter_server/extension/utils.py | 1 + jupyter_server/files/handlers.py | 1 + jupyter_server/gateway/connections.py | 5 ++--- jupyter_server/gateway/gateway_client.py | 1 + jupyter_server/gateway/handlers.py | 9 ++++----- jupyter_server/gateway/managers.py | 5 ++--- jupyter_server/i18n/__init__.py | 4 ++-- jupyter_server/kernelspecs/handlers.py | 7 +++---- jupyter_server/log.py | 1 + jupyter_server/nbconvert/handlers.py | 1 + jupyter_server/prometheus/log_functions.py | 1 + jupyter_server/pytest_plugin.py | 1 + jupyter_server/serverapp.py | 13 +++++++------ jupyter_server/services/api/handlers.py | 1 + jupyter_server/services/config/handlers.py | 1 + jupyter_server/services/config/manager.py | 4 ++-- jupyter_server/services/contents/checkpoints.py | 1 + jupyter_server/services/contents/filecheckpoints.py | 1 + jupyter_server/services/contents/filemanager.py | 1 + jupyter_server/services/contents/handlers.py | 1 + jupyter_server/services/contents/manager.py | 1 + jupyter_server/services/events/handlers.py | 1 + jupyter_server/services/kernels/connection/base.py | 1 + .../services/kernels/connection/channels.py | 1 + jupyter_server/services/kernels/handlers.py | 1 + jupyter_server/services/kernels/kernelmanager.py | 1 + jupyter_server/services/kernelspecs/handlers.py | 1 + jupyter_server/services/nbconvert/handlers.py | 1 + jupyter_server/services/security/handlers.py | 1 + jupyter_server/services/sessions/handlers.py | 1 + jupyter_server/services/shutdown.py | 4 ++-- jupyter_server/terminal/__init__.py | 1 + jupyter_server/terminal/api_handlers.py | 1 + jupyter_server/terminal/handlers.py | 1 + jupyter_server/terminal/terminalmanager.py | 1 + jupyter_server/traittypes.py | 1 + jupyter_server/transutils.py | 1 + jupyter_server/utils.py | 1 + jupyter_server/view/handlers.py | 1 + tests/auth/test_authorizer.py | 1 + tests/auth/test_login.py | 1 + tests/base/test_handlers.py | 1 + tests/base/test_websocket.py | 1 + tests/conftest.py | 2 +- tests/extension/mockextensions/__init__.py | 1 + tests/extension/mockextensions/mock1.py | 3 +-- tests/extension/mockextensions/mock2.py | 3 +-- tests/extension/mockextensions/mock3.py | 3 +-- tests/extension/mockextensions/mockext_both.py | 3 +-- .../extension/mockextensions/mockext_deprecated.py | 3 +-- tests/extension/mockextensions/mockext_py.py | 3 +-- tests/extension/mockextensions/mockext_sys.py | 3 +-- tests/extension/mockextensions/mockext_user.py | 3 +-- tests/extension/test_launch.py | 1 + tests/services/contents/test_api.py | 4 ++-- tests/test_gateway.py | 1 + tests/test_serialize.py | 1 + tests/test_view.py | 1 + 99 files changed, 122 insertions(+), 55 deletions(-) diff --git a/examples/authorization/jupyter_nbclassic_readonly_config.py b/examples/authorization/jupyter_nbclassic_readonly_config.py index 18c1b83bfd..95b095fd26 100644 --- a/examples/authorization/jupyter_nbclassic_readonly_config.py +++ b/examples/authorization/jupyter_nbclassic_readonly_config.py @@ -1,4 +1,5 @@ """Nbclassic read only auth example.""" + from jupyter_server.auth import Authorizer diff --git a/examples/authorization/jupyter_nbclassic_rw_config.py b/examples/authorization/jupyter_nbclassic_rw_config.py index 5dce9a8444..751cef64a8 100644 --- a/examples/authorization/jupyter_nbclassic_rw_config.py +++ b/examples/authorization/jupyter_nbclassic_rw_config.py @@ -1,4 +1,5 @@ """Nbclassic read/write auth example.""" + from jupyter_server.auth import Authorizer diff --git a/examples/authorization/jupyter_temporary_config.py b/examples/authorization/jupyter_temporary_config.py index dd93948c4c..9756cafe7d 100644 --- a/examples/authorization/jupyter_temporary_config.py +++ b/examples/authorization/jupyter_temporary_config.py @@ -1,4 +1,5 @@ """Nbclassic temporary server auth example.""" + from jupyter_server.auth import Authorizer diff --git a/examples/identity/system_password/jupyter_server_config.py b/examples/identity/system_password/jupyter_server_config.py index 11364c22e8..51fe76f1ba 100644 --- a/examples/identity/system_password/jupyter_server_config.py +++ b/examples/identity/system_password/jupyter_server_config.py @@ -1,4 +1,5 @@ """Jupyter server system password identity provider example.""" + import pwd from getpass import getuser diff --git a/examples/simple/conftest.py b/examples/simple/conftest.py index df81e57d34..91f7da3340 100644 --- a/examples/simple/conftest.py +++ b/examples/simple/conftest.py @@ -1,2 +1,3 @@ """Pytest configuration.""" + pytest_plugins = ["jupyter_server.pytest_plugin"] diff --git a/examples/simple/jupyter_server_config.py b/examples/simple/jupyter_server_config.py index d850655359..1077c5f4d3 100644 --- a/examples/simple/jupyter_server_config.py +++ b/examples/simple/jupyter_server_config.py @@ -1,4 +1,5 @@ """Configuration file for jupyter-server extensions.""" + # ------------------------------------------------------------------------------ # Application(SingletonConfigurable) configuration # ------------------------------------------------------------------------------ diff --git a/examples/simple/jupyter_simple_ext11_config.py b/examples/simple/jupyter_simple_ext11_config.py index 976e3df66a..d4ee872a6a 100644 --- a/examples/simple/jupyter_simple_ext11_config.py +++ b/examples/simple/jupyter_simple_ext11_config.py @@ -1,2 +1,3 @@ """Jupyter server config.""" + c.SimpleApp11.ignore_js = True # type:ignore[name-defined] diff --git a/examples/simple/jupyter_simple_ext1_config.py b/examples/simple/jupyter_simple_ext1_config.py index 6069883494..605b94e158 100644 --- a/examples/simple/jupyter_simple_ext1_config.py +++ b/examples/simple/jupyter_simple_ext1_config.py @@ -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] diff --git a/examples/simple/jupyter_simple_ext2_config.py b/examples/simple/jupyter_simple_ext2_config.py index 7b61087e1d..81c8aed5b9 100644 --- a/examples/simple/jupyter_simple_ext2_config.py +++ b/examples/simple/jupyter_simple_ext2_config.py @@ -1,2 +1,3 @@ """Jupyter server config.""" + c.SimpleApp2.configD = "ConfigD from file" # type:ignore[name-defined] diff --git a/examples/simple/simple_ext1/__main__.py b/examples/simple/simple_ext1/__main__.py index 90b15cbc92..0203d1896a 100644 --- a/examples/simple/simple_ext1/__main__.py +++ b/examples/simple/simple_ext1/__main__.py @@ -1,4 +1,5 @@ """Application cli main.""" + from .application import main if __name__ == "__main__": diff --git a/examples/simple/simple_ext1/application.py b/examples/simple/simple_ext1/application.py index b77e57e4a8..f62a7952a2 100644 --- a/examples/simple/simple_ext1/application.py +++ b/examples/simple/simple_ext1/application.py @@ -1,4 +1,5 @@ """Jupyter server example application.""" + import os from traitlets import Unicode diff --git a/examples/simple/simple_ext1/handlers.py b/examples/simple/simple_ext1/handlers.py index 9d25057bc3..72f54a8bfd 100644 --- a/examples/simple/simple_ext1/handlers.py +++ b/examples/simple/simple_ext1/handlers.py @@ -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 diff --git a/examples/simple/simple_ext11/__init__.py b/examples/simple/simple_ext11/__init__.py index d7c3e4341b..66194e3e10 100644 --- a/examples/simple/simple_ext11/__init__.py +++ b/examples/simple/simple_ext11/__init__.py @@ -1,4 +1,5 @@ """Extension entry point.""" + from .application import SimpleApp11 diff --git a/examples/simple/simple_ext11/__main__.py b/examples/simple/simple_ext11/__main__.py index 90b15cbc92..0203d1896a 100644 --- a/examples/simple/simple_ext11/__main__.py +++ b/examples/simple/simple_ext11/__main__.py @@ -1,4 +1,5 @@ """Application cli main.""" + from .application import main if __name__ == "__main__": diff --git a/examples/simple/simple_ext11/application.py b/examples/simple/simple_ext11/application.py index 398716f213..5710534f51 100644 --- a/examples/simple/simple_ext11/application.py +++ b/examples/simple/simple_ext11/application.py @@ -1,4 +1,5 @@ """A Jupyter Server example application.""" + import os from simple_ext1.application import SimpleApp1 # type:ignore[import-not-found] diff --git a/examples/simple/simple_ext2/__init__.py b/examples/simple/simple_ext2/__init__.py index 3059dbda49..cf7dfabb3c 100644 --- a/examples/simple/simple_ext2/__init__.py +++ b/examples/simple/simple_ext2/__init__.py @@ -1,4 +1,5 @@ """The extension entry point.""" + from .application import SimpleApp2 diff --git a/examples/simple/simple_ext2/__main__.py b/examples/simple/simple_ext2/__main__.py index 465db9c1c2..df0df26c1e 100644 --- a/examples/simple/simple_ext2/__main__.py +++ b/examples/simple/simple_ext2/__main__.py @@ -1,4 +1,5 @@ """The application cli main.""" + from .application import main if __name__ == "__main__": diff --git a/examples/simple/simple_ext2/application.py b/examples/simple/simple_ext2/application.py index b9da358131..d608e0c9a4 100644 --- a/examples/simple/simple_ext2/application.py +++ b/examples/simple/simple_ext2/application.py @@ -1,4 +1,5 @@ """A simple Jupyter Server extension example.""" + import os from traitlets import Unicode diff --git a/examples/simple/simple_ext2/handlers.py b/examples/simple/simple_ext2/handlers.py index 4f52e6f061..d5954f2192 100644 --- a/examples/simple/simple_ext2/handlers.py +++ b/examples/simple/simple_ext2/handlers.py @@ -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 diff --git a/examples/simple/tests/test_handlers.py b/examples/simple/tests/test_handlers.py index 59b9d045ae..360789ed9a 100644 --- a/examples/simple/tests/test_handlers.py +++ b/examples/simple/tests/test_handlers.py @@ -1,4 +1,5 @@ """Tests for the simple handler.""" + import pytest diff --git a/jupyter_server/__init__.py b/jupyter_server/__init__.py index 3d85bbd2c8..9b4cf72ea8 100644 --- a/jupyter_server/__init__.py +++ b/jupyter_server/__init__.py @@ -1,4 +1,5 @@ """The Jupyter Server""" + import os import pathlib diff --git a/jupyter_server/_sysinfo.py b/jupyter_server/_sysinfo.py index f167c4e92a..df3ff598fa 100644 --- a/jupyter_server/_sysinfo.py +++ b/jupyter_server/_sysinfo.py @@ -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 diff --git a/jupyter_server/_tz.py b/jupyter_server/_tz.py index a7a495de85..e1356b4aaf 100644 --- a/jupyter_server/_tz.py +++ b/jupyter_server/_tz.py @@ -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 diff --git a/jupyter_server/_version.py b/jupyter_server/_version.py index 4f9de98b77..b66385e96a 100644 --- a/jupyter_server/_version.py +++ b/jupyter_server/_version.py @@ -2,6 +2,7 @@ store the current version info of the server. """ + import re from typing import List diff --git a/jupyter_server/auth/__main__.py b/jupyter_server/auth/__main__.py index d1573f11a1..5e194547c9 100644 --- a/jupyter_server/auth/__main__.py +++ b/jupyter_server/auth/__main__.py @@ -1,4 +1,5 @@ """The cli for auth.""" + import argparse import sys import warnings diff --git a/jupyter_server/auth/authorizer.py b/jupyter_server/auth/authorizer.py index aaeb3a6eea..0e309a8bf6 100644 --- a/jupyter_server/auth/authorizer.py +++ b/jupyter_server/auth/authorizer.py @@ -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 diff --git a/jupyter_server/auth/decorator.py b/jupyter_server/auth/decorator.py index 46090b2555..4128c39086 100644 --- a/jupyter_server/auth/decorator.py +++ b/jupyter_server/auth/decorator.py @@ -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 diff --git a/jupyter_server/auth/identity.py b/jupyter_server/auth/identity.py index adeb567b5b..fd2b3db85d 100644 --- a/jupyter_server/auth/identity.py +++ b/jupyter_server/auth/identity.py @@ -5,6 +5,7 @@ .. versionadded:: 2.0 """ + from __future__ import annotations import binascii diff --git a/jupyter_server/auth/login.py b/jupyter_server/auth/login.py index 0628681224..4512127534 100644 --- a/jupyter_server/auth/login.py +++ b/jupyter_server/auth/login.py @@ -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 @@ -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) diff --git a/jupyter_server/auth/logout.py b/jupyter_server/auth/logout.py index 584404cf4c..7c13c7cd36 100644 --- a/jupyter_server/auth/logout.py +++ b/jupyter_server/auth/logout.py @@ -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 diff --git a/jupyter_server/auth/security.py b/jupyter_server/auth/security.py index ede64db522..599084b8cd 100644 --- a/jupyter_server/auth/security.py +++ b/jupyter_server/auth/security.py @@ -1,6 +1,7 @@ """ Password generation for the Jupyter Server. """ + import getpass import hashlib import json diff --git a/jupyter_server/auth/utils.py b/jupyter_server/auth/utils.py index b0f790be1f..7429f84f14 100644 --- a/jupyter_server/auth/utils.py +++ b/jupyter_server/auth/utils.py @@ -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 diff --git a/jupyter_server/base/handlers.py b/jupyter_server/base/handlers.py index b6f0c90232..5e45c54c15 100644 --- a/jupyter_server/base/handlers.py +++ b/jupyter_server/base/handlers.py @@ -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 diff --git a/jupyter_server/base/websocket.py b/jupyter_server/base/websocket.py index 8780d7afc4..ded74ed7a0 100644 --- a/jupyter_server/base/websocket.py +++ b/jupyter_server/base/websocket.py @@ -1,4 +1,5 @@ """Base websocket classes.""" + import re import warnings from typing import Optional, no_type_check diff --git a/jupyter_server/base/zmqhandlers.py b/jupyter_server/base/zmqhandlers.py index 4490380a34..07de3d9782 100644 --- a/jupyter_server/base/zmqhandlers.py +++ b/jupyter_server/base/zmqhandlers.py @@ -1,4 +1,5 @@ """This module is deprecated in Jupyter Server 2.0""" + # Raise a warning that this module is deprecated. import warnings diff --git a/jupyter_server/config_manager.py b/jupyter_server/config_manager.py index cf9d02afed..b91b8ca759 100644 --- a/jupyter_server/config_manager.py +++ b/jupyter_server/config_manager.py @@ -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 diff --git a/jupyter_server/extension/application.py b/jupyter_server/extension/application.py index b676086747..32ac94cfcb 100644 --- a/jupyter_server/extension/application.py +++ b/jupyter_server/extension/application.py @@ -1,4 +1,5 @@ """An extension application.""" + from __future__ import annotations import logging diff --git a/jupyter_server/extension/config.py b/jupyter_server/extension/config.py index 47b4f6cce1..e9bb4a7c78 100644 --- a/jupyter_server/extension/config.py +++ b/jupyter_server/extension/config.py @@ -1,4 +1,5 @@ """Extension config.""" + from jupyter_server.services.config.manager import ConfigManager DEFAULT_SECTION_NAME = "jupyter_server_config" diff --git a/jupyter_server/extension/handler.py b/jupyter_server/extension/handler.py index 55f5aff2c3..31377cc367 100644 --- a/jupyter_server/extension/handler.py +++ b/jupyter_server/extension/handler.py @@ -1,4 +1,5 @@ """An extension handler.""" + from __future__ import annotations from logging import Logger diff --git a/jupyter_server/extension/manager.py b/jupyter_server/extension/manager.py index 3509e2e9f6..b8c52ca9e5 100644 --- a/jupyter_server/extension/manager.py +++ b/jupyter_server/extension/manager.py @@ -1,4 +1,5 @@ """The extension manager.""" + from __future__ import annotations import importlib diff --git a/jupyter_server/extension/serverextension.py b/jupyter_server/extension/serverextension.py index 19f3a30709..b4c9dacbc2 100644 --- a/jupyter_server/extension/serverextension.py +++ b/jupyter_server/extension/serverextension.py @@ -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 diff --git a/jupyter_server/extension/utils.py b/jupyter_server/extension/utils.py index efb63848ae..f250191b25 100644 --- a/jupyter_server/extension/utils.py +++ b/jupyter_server/extension/utils.py @@ -1,4 +1,5 @@ """Extension utilities.""" + import importlib import time import warnings diff --git a/jupyter_server/files/handlers.py b/jupyter_server/files/handlers.py index 043c581034..2c1dc5adf6 100644 --- a/jupyter_server/files/handlers.py +++ b/jupyter_server/files/handlers.py @@ -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 diff --git a/jupyter_server/gateway/connections.py b/jupyter_server/gateway/connections.py index ab794bf7c7..cca621e370 100644 --- a/jupyter_server/gateway/connections.py +++ b/jupyter_server/gateway/connections.py @@ -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 @@ -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): diff --git a/jupyter_server/gateway/gateway_client.py b/jupyter_server/gateway/gateway_client.py index a1ca0057fe..34c9ee6476 100644 --- a/jupyter_server/gateway/gateway_client.py +++ b/jupyter_server/gateway/gateway_client.py @@ -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 diff --git a/jupyter_server/gateway/handlers.py b/jupyter_server/gateway/handlers.py index dcde4cd5ca..36fed02391 100644 --- a/jupyter_server/gateway/handlers.py +++ b/jupyter_server/gateway/handlers.py @@ -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 @@ -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): @@ -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" diff --git a/jupyter_server/gateway/managers.py b/jupyter_server/gateway/managers.py index cd0b27b50d..6b53486317 100644 --- a/jupyter_server/gateway/managers.py +++ b/jupyter_server/gateway/managers.py @@ -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 @@ -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: diff --git a/jupyter_server/i18n/__init__.py b/jupyter_server/i18n/__init__.py index 896f41c57c..5f41dbc410 100644 --- a/jupyter_server/i18n/__init__.py +++ b/jupyter_server/i18n/__init__.py @@ -1,5 +1,5 @@ -"""Server functions for loading translations -""" +"""Server functions for loading translations""" + from __future__ import annotations import errno diff --git a/jupyter_server/kernelspecs/handlers.py b/jupyter_server/kernelspecs/handlers.py index c7cb141459..c1d50660d2 100644 --- a/jupyter_server/kernelspecs/handlers.py +++ b/jupyter_server/kernelspecs/handlers.py @@ -1,4 +1,5 @@ """Kernelspecs API Handlers.""" + import mimetypes from jupyter_core.utils import ensure_async @@ -44,10 +45,8 @@ async def get(self, kernel_name, path, include_body=True): return None else: self.log.warning( - "Kernelspec resource '{}' for '{}' not found. Kernel spec manager may" - " not support resource serving. Falling back to reading from disk".format( - path, kernel_name - ) + f"Kernelspec resource '{path}' for '{kernel_name}' not found. Kernel spec manager may" + " not support resource serving. Falling back to reading from disk" ) try: kspec = await ensure_async(ksm.get_kernel_spec(kernel_name)) diff --git a/jupyter_server/log.py b/jupyter_server/log.py index 705eaaf44c..aed024bb32 100644 --- a/jupyter_server/log.py +++ b/jupyter_server/log.py @@ -1,4 +1,5 @@ """Log utilities.""" + # ----------------------------------------------------------------------------- # Copyright (c) Jupyter Development Team # diff --git a/jupyter_server/nbconvert/handlers.py b/jupyter_server/nbconvert/handlers.py index b7a39d0c8b..6982b9526b 100644 --- a/jupyter_server/nbconvert/handlers.py +++ b/jupyter_server/nbconvert/handlers.py @@ -1,4 +1,5 @@ """Tornado handlers for nbconvert.""" + # Copyright (c) Jupyter Development Team. # Distributed under the terms of the Modified BSD License. import io diff --git a/jupyter_server/prometheus/log_functions.py b/jupyter_server/prometheus/log_functions.py index ac4bd620c1..39bb60ea59 100644 --- a/jupyter_server/prometheus/log_functions.py +++ b/jupyter_server/prometheus/log_functions.py @@ -1,4 +1,5 @@ """Log functions for prometheus""" + from .metrics import HTTP_REQUEST_DURATION_SECONDS # type:ignore[unused-ignore] diff --git a/jupyter_server/pytest_plugin.py b/jupyter_server/pytest_plugin.py index f77448f866..c1a9c37fb5 100644 --- a/jupyter_server/pytest_plugin.py +++ b/jupyter_server/pytest_plugin.py @@ -1,4 +1,5 @@ """Pytest Fixtures exported by Jupyter Server.""" + # Copyright (c) Jupyter Development Team. # Distributed under the terms of the Modified BSD License. import json diff --git a/jupyter_server/serverapp.py b/jupyter_server/serverapp.py index 5fd00226c5..9091272a8d 100644 --- a/jupyter_server/serverapp.py +++ b/jupyter_server/serverapp.py @@ -1,4 +1,5 @@ """A tornado based Jupyter server.""" + # Copyright (c) Jupyter Development Team. # Distributed under the terms of the Modified BSD License. from __future__ import annotations @@ -2188,9 +2189,9 @@ def init_webapp(self) -> None: # deprecate accessing these directly, in favor of identity_provider? self.tornado_settings["cookie_options"] = self.identity_provider.cookie_options - self.tornado_settings[ - "get_secure_cookie_kwargs" - ] = self.identity_provider.get_secure_cookie_kwargs + self.tornado_settings["get_secure_cookie_kwargs"] = ( + self.identity_provider.get_secure_cookie_kwargs + ) self.tornado_settings["token"] = self.identity_provider.token if self.static_immutable_cache: @@ -3037,9 +3038,9 @@ def start_app(self) -> None: "", ( "UNIX sockets are not browser-connectable, but you can tunnel to " - "the instance via e.g.`ssh -L 8888:{} -N user@this_host` and then " - "open e.g. {} in a browser." - ).format(self.sock, self.connection_url), + f"the instance via e.g.`ssh -L 8888:{self.sock} -N user@this_host` and then " + f"open e.g. {self.connection_url} in a browser." + ), ] ) ) diff --git a/jupyter_server/services/api/handlers.py b/jupyter_server/services/api/handlers.py index 625d9ca372..22904fdb07 100644 --- a/jupyter_server/services/api/handlers.py +++ b/jupyter_server/services/api/handlers.py @@ -1,4 +1,5 @@ """Tornado handlers for api specifications.""" + # Copyright (c) Jupyter Development Team. # Distributed under the terms of the Modified BSD License. import json diff --git a/jupyter_server/services/config/handlers.py b/jupyter_server/services/config/handlers.py index 743c98ef0b..05621e5506 100644 --- a/jupyter_server/services/config/handlers.py +++ b/jupyter_server/services/config/handlers.py @@ -1,4 +1,5 @@ """Tornado handlers for frontend config storage.""" + # Copyright (c) Jupyter Development Team. # Distributed under the terms of the Modified BSD License. import json diff --git a/jupyter_server/services/config/manager.py b/jupyter_server/services/config/manager.py index 720c8e7bd7..d4e207e247 100644 --- a/jupyter_server/services/config/manager.py +++ b/jupyter_server/services/config/manager.py @@ -1,5 +1,5 @@ -"""Manager to read and modify frontend config data in JSON files. -""" +"""Manager to read and modify frontend config data in JSON files.""" + # Copyright (c) Jupyter Development Team. # Distributed under the terms of the Modified BSD License. import os.path diff --git a/jupyter_server/services/contents/checkpoints.py b/jupyter_server/services/contents/checkpoints.py index e251f7b232..9f69958f4b 100644 --- a/jupyter_server/services/contents/checkpoints.py +++ b/jupyter_server/services/contents/checkpoints.py @@ -1,6 +1,7 @@ """ Classes for managing Checkpoints. """ + # Copyright (c) Jupyter Development Team. # Distributed under the terms of the Modified BSD License. from tornado.web import HTTPError diff --git a/jupyter_server/services/contents/filecheckpoints.py b/jupyter_server/services/contents/filecheckpoints.py index 522b3bbd01..7af1235066 100644 --- a/jupyter_server/services/contents/filecheckpoints.py +++ b/jupyter_server/services/contents/filecheckpoints.py @@ -1,6 +1,7 @@ """ File-based Checkpoints implementations. """ + import os import shutil diff --git a/jupyter_server/services/contents/filemanager.py b/jupyter_server/services/contents/filemanager.py index 09cbeec13a..312c1a736d 100644 --- a/jupyter_server/services/contents/filemanager.py +++ b/jupyter_server/services/contents/filemanager.py @@ -1,4 +1,5 @@ """A contents manager that uses the local file system for storage.""" + # Copyright (c) Jupyter Development Team. # Distributed under the terms of the Modified BSD License. from __future__ import annotations diff --git a/jupyter_server/services/contents/handlers.py b/jupyter_server/services/contents/handlers.py index 8044310f60..ad25a2d3f7 100644 --- a/jupyter_server/services/contents/handlers.py +++ b/jupyter_server/services/contents/handlers.py @@ -2,6 +2,7 @@ Preliminary documentation at https://github.com/ipython/ipython/wiki/IPEP-27%3A-Contents-Service """ + # Copyright (c) Jupyter Development Team. # Distributed under the terms of the Modified BSD License. import json diff --git a/jupyter_server/services/contents/manager.py b/jupyter_server/services/contents/manager.py index b12a2055ec..71e998992a 100644 --- a/jupyter_server/services/contents/manager.py +++ b/jupyter_server/services/contents/manager.py @@ -1,4 +1,5 @@ """A base class for contents managers.""" + # Copyright (c) Jupyter Development Team. # Distributed under the terms of the Modified BSD License. from __future__ import annotations diff --git a/jupyter_server/services/events/handlers.py b/jupyter_server/services/events/handlers.py index ce580048f2..3a625f366e 100644 --- a/jupyter_server/services/events/handlers.py +++ b/jupyter_server/services/events/handlers.py @@ -2,6 +2,7 @@ .. versionadded:: 2.0 """ + from __future__ import annotations import json diff --git a/jupyter_server/services/kernels/connection/base.py b/jupyter_server/services/kernels/connection/base.py index 1f6b2fdcf4..78ba100047 100644 --- a/jupyter_server/services/kernels/connection/base.py +++ b/jupyter_server/services/kernels/connection/base.py @@ -1,4 +1,5 @@ """Kernel connection helpers.""" + import json import struct from typing import Any, List diff --git a/jupyter_server/services/kernels/connection/channels.py b/jupyter_server/services/kernels/connection/channels.py index 05b9f6954e..743ea93a73 100644 --- a/jupyter_server/services/kernels/connection/channels.py +++ b/jupyter_server/services/kernels/connection/channels.py @@ -1,4 +1,5 @@ """An implementation of a kernel connection.""" + from __future__ import annotations import asyncio diff --git a/jupyter_server/services/kernels/handlers.py b/jupyter_server/services/kernels/handlers.py index 217f0c9cc2..9d2e8618d9 100644 --- a/jupyter_server/services/kernels/handlers.py +++ b/jupyter_server/services/kernels/handlers.py @@ -2,6 +2,7 @@ Preliminary documentation at https://github.com/ipython/ipython/wiki/IPEP-16%3A-Notebook-multi-directory-dashboard-and-URL-mapping#kernels-api """ + # Copyright (c) Jupyter Development Team. # Distributed under the terms of the Modified BSD License. import json diff --git a/jupyter_server/services/kernels/kernelmanager.py b/jupyter_server/services/kernels/kernelmanager.py index 451a279a4e..c32df105f6 100644 --- a/jupyter_server/services/kernels/kernelmanager.py +++ b/jupyter_server/services/kernels/kernelmanager.py @@ -3,6 +3,7 @@ - raises HTTPErrors - creates REST API models """ + # Copyright (c) Jupyter Development Team. # Distributed under the terms of the Modified BSD License. from __future__ import annotations diff --git a/jupyter_server/services/kernelspecs/handlers.py b/jupyter_server/services/kernelspecs/handlers.py index 049b58fa83..15a7ac4b1a 100644 --- a/jupyter_server/services/kernelspecs/handlers.py +++ b/jupyter_server/services/kernelspecs/handlers.py @@ -2,6 +2,7 @@ Preliminary documentation at https://github.com/ipython/ipython/wiki/IPEP-25%3A-Registry-of-installed-kernels#rest-api """ + # Copyright (c) Jupyter Development Team. # Distributed under the terms of the Modified BSD License. from __future__ import annotations diff --git a/jupyter_server/services/nbconvert/handlers.py b/jupyter_server/services/nbconvert/handlers.py index bc0d38b9f9..cb4fe1b2ed 100644 --- a/jupyter_server/services/nbconvert/handlers.py +++ b/jupyter_server/services/nbconvert/handlers.py @@ -1,4 +1,5 @@ """API Handlers for nbconvert.""" + import asyncio import json diff --git a/jupyter_server/services/security/handlers.py b/jupyter_server/services/security/handlers.py index 2e248c3e70..329f8b77ea 100644 --- a/jupyter_server/services/security/handlers.py +++ b/jupyter_server/services/security/handlers.py @@ -1,4 +1,5 @@ """Tornado handlers for security logging.""" + # Copyright (c) Jupyter Development Team. # Distributed under the terms of the Modified BSD License. from tornado import web diff --git a/jupyter_server/services/sessions/handlers.py b/jupyter_server/services/sessions/handlers.py index 73e3deb420..3e013c0335 100644 --- a/jupyter_server/services/sessions/handlers.py +++ b/jupyter_server/services/sessions/handlers.py @@ -2,6 +2,7 @@ Preliminary documentation at https://github.com/ipython/ipython/wiki/IPEP-16%3A-Notebook-multi-directory-dashboard-and-URL-mapping#sessions-api """ + # Copyright (c) Jupyter Development Team. # Distributed under the terms of the Modified BSD License. import asyncio diff --git a/jupyter_server/services/shutdown.py b/jupyter_server/services/shutdown.py index a8c6787f0e..24486a8432 100644 --- a/jupyter_server/services/shutdown.py +++ b/jupyter_server/services/shutdown.py @@ -1,5 +1,5 @@ -"""HTTP handler to shut down the Jupyter server. -""" +"""HTTP handler to shut down the Jupyter server.""" + from tornado import ioloop, web from jupyter_server.auth.decorator import authorized diff --git a/jupyter_server/terminal/__init__.py b/jupyter_server/terminal/__init__.py index 0dd1533c6a..7acec8ae59 100644 --- a/jupyter_server/terminal/__init__.py +++ b/jupyter_server/terminal/__init__.py @@ -1,4 +1,5 @@ """Terminals support.""" + import warnings # Shims diff --git a/jupyter_server/terminal/api_handlers.py b/jupyter_server/terminal/api_handlers.py index c20f2d8be3..894f98b011 100644 --- a/jupyter_server/terminal/api_handlers.py +++ b/jupyter_server/terminal/api_handlers.py @@ -1,4 +1,5 @@ """Terminal API handlers.""" + from jupyter_server_terminals.api_handlers import ( TerminalAPIHandler, TerminalHandler, diff --git a/jupyter_server/terminal/handlers.py b/jupyter_server/terminal/handlers.py index f3da8aa91c..79cb5fa1e1 100644 --- a/jupyter_server/terminal/handlers.py +++ b/jupyter_server/terminal/handlers.py @@ -1,4 +1,5 @@ """Tornado handlers for the terminal emulator.""" + # Copyright (c) Jupyter Development Team. # Distributed under the terms of the Modified BSD License. from jupyter_server_terminals.handlers import TermSocket diff --git a/jupyter_server/terminal/terminalmanager.py b/jupyter_server/terminal/terminalmanager.py index 6f9ada1b71..a1d7f0e6d0 100644 --- a/jupyter_server/terminal/terminalmanager.py +++ b/jupyter_server/terminal/terminalmanager.py @@ -2,6 +2,7 @@ - raises HTTPErrors - creates REST API models """ + # Copyright (c) Jupyter Development Team. # Distributed under the terms of the Modified BSD License. from jupyter_server_terminals.terminalmanager import TerminalManager diff --git a/jupyter_server/traittypes.py b/jupyter_server/traittypes.py index f17f3a0a24..c1537d353f 100644 --- a/jupyter_server/traittypes.py +++ b/jupyter_server/traittypes.py @@ -1,4 +1,5 @@ """Custom trait types.""" + import inspect from ast import literal_eval diff --git a/jupyter_server/transutils.py b/jupyter_server/transutils.py index f63e1e1d80..c86b213432 100644 --- a/jupyter_server/transutils.py +++ b/jupyter_server/transutils.py @@ -1,4 +1,5 @@ """Translation related utilities. When imported, injects _ to builtins""" + # Copyright (c) Jupyter Development Team. # Distributed under the terms of the Modified BSD License. import gettext diff --git a/jupyter_server/utils.py b/jupyter_server/utils.py index 8ef0e21a7f..e9225b746d 100644 --- a/jupyter_server/utils.py +++ b/jupyter_server/utils.py @@ -1,4 +1,5 @@ """Notebook related utilities""" + # Copyright (c) Jupyter Development Team. # Distributed under the terms of the Modified BSD License. from __future__ import annotations diff --git a/jupyter_server/view/handlers.py b/jupyter_server/view/handlers.py index 428e576264..05e3dc3db2 100644 --- a/jupyter_server/view/handlers.py +++ b/jupyter_server/view/handlers.py @@ -1,4 +1,5 @@ """Tornado handlers for viewing HTML files.""" + # Copyright (c) Jupyter Development Team. # Distributed under the terms of the Modified BSD License. from jupyter_core.utils import ensure_async diff --git a/tests/auth/test_authorizer.py b/tests/auth/test_authorizer.py index a02237aaa0..cc7af95bba 100644 --- a/tests/auth/test_authorizer.py +++ b/tests/auth/test_authorizer.py @@ -1,4 +1,5 @@ """Tests for authorization""" + import asyncio import json import os diff --git a/tests/auth/test_login.py b/tests/auth/test_login.py index 7aad3129ca..b8fb58953e 100644 --- a/tests/auth/test_login.py +++ b/tests/auth/test_login.py @@ -1,4 +1,5 @@ """Tests for login redirects""" + import json from functools import partial from urllib.parse import urlencode diff --git a/tests/base/test_handlers.py b/tests/base/test_handlers.py index c2960c1775..6d8dce90da 100644 --- a/tests/base/test_handlers.py +++ b/tests/base/test_handlers.py @@ -1,4 +1,5 @@ """Test Base Handlers""" + import os import warnings from unittest.mock import MagicMock, patch diff --git a/tests/base/test_websocket.py b/tests/base/test_websocket.py index 17ee009227..6165458d0c 100644 --- a/tests/base/test_websocket.py +++ b/tests/base/test_websocket.py @@ -1,4 +1,5 @@ """Test Base Websocket classes""" + import logging import time from unittest.mock import MagicMock, patch diff --git a/tests/conftest.py b/tests/conftest.py index 0f162f0f8c..33e7cce169 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -134,7 +134,7 @@ def contents(contents_dir): paths["textfiles"].append(txtname.relative_to(contents_dir)) # Create a random blob - blob = name.encode("utf-8") + b"\xFF" + blob = name.encode("utf-8") + b"\xff" blobname = p.joinpath(f"{name}.blob") blobname.write_bytes(blob) paths["blobs"].append(blobname.relative_to(contents_dir)) diff --git a/tests/extension/mockextensions/__init__.py b/tests/extension/mockextensions/__init__.py index 0858256984..a25d9fc670 100644 --- a/tests/extension/mockextensions/__init__.py +++ b/tests/extension/mockextensions/__init__.py @@ -1,6 +1,7 @@ """A mock extension module with a list of extensions to load in various tests. """ + from .app import MockExtensionApp diff --git a/tests/extension/mockextensions/mock1.py b/tests/extension/mockextensions/mock1.py index 92e7637d63..6113ab2fc5 100644 --- a/tests/extension/mockextensions/mock1.py +++ b/tests/extension/mockextensions/mock1.py @@ -1,5 +1,4 @@ -"""A mock extension named `mock1` for testing purposes. -""" +"""A mock extension named `mock1` for testing purposes.""" # by the test functions. diff --git a/tests/extension/mockextensions/mock2.py b/tests/extension/mockextensions/mock2.py index 9f3b7449f4..5e4893f508 100644 --- a/tests/extension/mockextensions/mock2.py +++ b/tests/extension/mockextensions/mock2.py @@ -1,5 +1,4 @@ -"""A mock extension named `mock2` for testing purposes. -""" +"""A mock extension named `mock2` for testing purposes.""" # by the test functions. diff --git a/tests/extension/mockextensions/mock3.py b/tests/extension/mockextensions/mock3.py index cdbffefdfa..37f14edbf3 100644 --- a/tests/extension/mockextensions/mock3.py +++ b/tests/extension/mockextensions/mock3.py @@ -1,5 +1,4 @@ -"""A mock extension named `mock3` for testing purposes. -""" +"""A mock extension named `mock3` for testing purposes.""" def _load_jupyter_server_extension(serverapp): diff --git a/tests/extension/mockextensions/mockext_both.py b/tests/extension/mockextensions/mockext_both.py index 5e24c7c6ff..3ac2ea8f57 100644 --- a/tests/extension/mockextensions/mockext_both.py +++ b/tests/extension/mockextensions/mockext_both.py @@ -1,5 +1,4 @@ -"""A mock extension named `mockext_both` for testing purposes. -""" +"""A mock extension named `mockext_both` for testing purposes.""" # Function that makes these extensions discoverable # by the test functions. diff --git a/tests/extension/mockextensions/mockext_deprecated.py b/tests/extension/mockextensions/mockext_deprecated.py index 527ac3a8bb..36faaa922f 100644 --- a/tests/extension/mockextensions/mockext_deprecated.py +++ b/tests/extension/mockextensions/mockext_deprecated.py @@ -1,5 +1,4 @@ -"""A mock extension named `mockext_py` for testing purposes. -""" +"""A mock extension named `mockext_py` for testing purposes.""" # Function that makes these extensions discoverable # by the test functions. diff --git a/tests/extension/mockextensions/mockext_py.py b/tests/extension/mockextensions/mockext_py.py index f5b467b1fa..a94977043d 100644 --- a/tests/extension/mockextensions/mockext_py.py +++ b/tests/extension/mockextensions/mockext_py.py @@ -1,5 +1,4 @@ -"""A mock extension named `mockext_py` for testing purposes. -""" +"""A mock extension named `mockext_py` for testing purposes.""" # Function that makes these extensions discoverable # by the test functions. diff --git a/tests/extension/mockextensions/mockext_sys.py b/tests/extension/mockextensions/mockext_sys.py index dfaf4e3546..a0a2e9d3f0 100644 --- a/tests/extension/mockextensions/mockext_sys.py +++ b/tests/extension/mockextensions/mockext_sys.py @@ -1,5 +1,4 @@ -"""A mock extension named `mockext_py` for testing purposes. -""" +"""A mock extension named `mockext_py` for testing purposes.""" # Function that makes these extensions discoverable # by the test functions. diff --git a/tests/extension/mockextensions/mockext_user.py b/tests/extension/mockextensions/mockext_user.py index d925ad29b3..a4b72826db 100644 --- a/tests/extension/mockextensions/mockext_user.py +++ b/tests/extension/mockextensions/mockext_user.py @@ -1,5 +1,4 @@ -"""A mock extension named `mockext_user` for testing purposes. -""" +"""A mock extension named `mockext_user` for testing purposes.""" # Function that makes these extensions discoverable # by the test functions. diff --git a/tests/extension/test_launch.py b/tests/extension/test_launch.py index de94607187..696f326f2a 100644 --- a/tests/extension/test_launch.py +++ b/tests/extension/test_launch.py @@ -1,6 +1,7 @@ """Test launching Jupyter Server Applications through as ExtensionApp launch_instance. """ + import os import subprocess import sys diff --git a/tests/services/contents/test_api.py b/tests/services/contents/test_api.py index b74ee8f62a..c5a973eeb5 100644 --- a/tests/services/contents/test_api.py +++ b/tests/services/contents/test_api.py @@ -270,7 +270,7 @@ async def test_get_binary_file_contents(jp_fetch, contents, path, name): assert model["format"] == "base64" assert model["type"] == "file" data_out = decodebytes(model["content"].encode("ascii")) - data_in = name.encode("utf-8") + b"\xFF" + data_in = name.encode("utf-8") + b"\xff" assert data_in == data_out with pytest.raises(tornado.httpclient.HTTPClientError) as e: @@ -478,7 +478,7 @@ async def test_upload_txt_hidden(jp_fetch, contents, contents_dir): async def test_upload_b64(jp_fetch, contents, contents_dir, _check_created): - body = b"\xFFblob" + body = b"\xffblob" b64body = encodebytes(body).decode("ascii") model = { "content": b64body, diff --git a/tests/test_gateway.py b/tests/test_gateway.py index 51d63b6db0..4ebff51729 100644 --- a/tests/test_gateway.py +++ b/tests/test_gateway.py @@ -1,4 +1,5 @@ """Test GatewayClient""" + import asyncio import json import logging diff --git a/tests/test_serialize.py b/tests/test_serialize.py index 28be8e03b0..99f0c9d7a7 100644 --- a/tests/test_serialize.py +++ b/tests/test_serialize.py @@ -1,4 +1,5 @@ """Test serialize/deserialize messages with buffers""" + import os from jupyter_client.session import Session diff --git a/tests/test_view.py b/tests/test_view.py index d822addb11..21c5eb796e 100644 --- a/tests/test_view.py +++ b/tests/test_view.py @@ -1,4 +1,5 @@ """test view handler""" + from html.parser import HTMLParser import pytest