diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 47b497bac..bbf49d7ab 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -32,7 +32,7 @@ repos: [mdformat-gfm, mdformat-frontmatter, mdformat-footnote] - repo: https://github.com/psf/black - rev: 23.9.1 + rev: 24.2.0 hooks: - id: black diff --git a/enterprise_gateway/__init__.py b/enterprise_gateway/__init__.py index 4a7bf2f32..3853fb09e 100644 --- a/enterprise_gateway/__init__.py +++ b/enterprise_gateway/__init__.py @@ -1,4 +1,5 @@ """Lazy-loading entrypoint for the enterprise gateway package.""" + # Copyright (c) Jupyter Development Team. # Distributed under the terms of the Modified BSD License. from ._version import __version__ # noqa diff --git a/enterprise_gateway/base/handlers.py b/enterprise_gateway/base/handlers.py index 5d8556888..bda75cac0 100644 --- a/enterprise_gateway/base/handlers.py +++ b/enterprise_gateway/base/handlers.py @@ -1,4 +1,5 @@ """Tornado handlers for the base of the API.""" + # Copyright (c) Jupyter Development Team. # Distributed under the terms of the Modified BSD License. diff --git a/enterprise_gateway/client/gateway_client.py b/enterprise_gateway/client/gateway_client.py index 3f8ca000f..b046c7f7b 100644 --- a/enterprise_gateway/client/gateway_client.py +++ b/enterprise_gateway/client/gateway_client.py @@ -1,4 +1,5 @@ """An Enterprise Gateway client.""" + import logging import os import queue diff --git a/enterprise_gateway/mixins.py b/enterprise_gateway/mixins.py index 9d2e4ee17..6152a1b80 100644 --- a/enterprise_gateway/mixins.py +++ b/enterprise_gateway/mixins.py @@ -1,4 +1,5 @@ """Mixins for Tornado handlers.""" + # Copyright (c) Jupyter Development Team. # Distributed under the terms of the Modified BSD License. diff --git a/enterprise_gateway/services/api/handlers.py b/enterprise_gateway/services/api/handlers.py index 995147281..ce069d504 100644 --- a/enterprise_gateway/services/api/handlers.py +++ b/enterprise_gateway/services/api/handlers.py @@ -1,4 +1,5 @@ """Tornado handlers for kernel specs.""" + # Copyright (c) Jupyter Development Team. # Distributed under the terms of the Modified BSD License. diff --git a/enterprise_gateway/services/kernels/handlers.py b/enterprise_gateway/services/kernels/handlers.py index 54c18d6d1..d5d2c5902 100644 --- a/enterprise_gateway/services/kernels/handlers.py +++ b/enterprise_gateway/services/kernels/handlers.py @@ -1,4 +1,5 @@ """Tornado handlers for kernel CRUD and communication.""" + # Copyright (c) Jupyter Development Team. # Distributed under the terms of the Modified BSD License. diff --git a/enterprise_gateway/services/kernels/remotemanager.py b/enterprise_gateway/services/kernels/remotemanager.py index b277b2d21..f906d68fb 100644 --- a/enterprise_gateway/services/kernels/remotemanager.py +++ b/enterprise_gateway/services/kernels/remotemanager.py @@ -1,4 +1,5 @@ """Kernel managers that operate against a remote process.""" + # Copyright (c) Jupyter Development Team. # Distributed under the terms of the Modified BSD License. diff --git a/enterprise_gateway/services/kernelspecs/handlers.py b/enterprise_gateway/services/kernelspecs/handlers.py index 72f234230..725198872 100644 --- a/enterprise_gateway/services/kernelspecs/handlers.py +++ b/enterprise_gateway/services/kernelspecs/handlers.py @@ -1,4 +1,5 @@ """Tornado handlers for kernel specs.""" + # Copyright (c) Jupyter Development Team. # Distributed under the terms of the Modified BSD License. diff --git a/enterprise_gateway/services/kernelspecs/kernelspec_cache.py b/enterprise_gateway/services/kernelspecs/kernelspec_cache.py index 282346215..f387addc2 100644 --- a/enterprise_gateway/services/kernelspecs/kernelspec_cache.py +++ b/enterprise_gateway/services/kernelspecs/kernelspec_cache.py @@ -1,4 +1,5 @@ """Cache handling for kernel specs.""" + # Copyright (c) Jupyter Development Team. # Distributed under the terms of the Modified BSD License. diff --git a/enterprise_gateway/services/processproxies/conductor.py b/enterprise_gateway/services/processproxies/conductor.py index 5a6e2e346..c4d13574b 100644 --- a/enterprise_gateway/services/processproxies/conductor.py +++ b/enterprise_gateway/services/processproxies/conductor.py @@ -1,4 +1,5 @@ """Code related to managing kernels running in Conductor clusters.""" + # Copyright (c) Jupyter Development Team. # Distributed under the terms of the Modified BSD License. diff --git a/enterprise_gateway/services/processproxies/container.py b/enterprise_gateway/services/processproxies/container.py index feee9c639..6378b633f 100644 --- a/enterprise_gateway/services/processproxies/container.py +++ b/enterprise_gateway/services/processproxies/container.py @@ -1,4 +1,5 @@ """Code related to managing kernels running in containers.""" + # Copyright (c) Jupyter Development Team. # Distributed under the terms of the Modified BSD License. diff --git a/enterprise_gateway/services/processproxies/crd.py b/enterprise_gateway/services/processproxies/crd.py index 7e47a5dcd..54f24b5ca 100644 --- a/enterprise_gateway/services/processproxies/crd.py +++ b/enterprise_gateway/services/processproxies/crd.py @@ -1,4 +1,5 @@ """Code related to managing kernels running based on k8s custom resource.""" + # Copyright (c) Jupyter Development Team. # Distributed under the terms of the Modified BSD License. diff --git a/enterprise_gateway/services/processproxies/distributed.py b/enterprise_gateway/services/processproxies/distributed.py index 164934a34..4dfa0ccd7 100644 --- a/enterprise_gateway/services/processproxies/distributed.py +++ b/enterprise_gateway/services/processproxies/distributed.py @@ -1,4 +1,5 @@ """Code used for the generic distribution of kernels across a set of hosts.""" + # Copyright (c) Jupyter Development Team. # Distributed under the terms of the Modified BSD License. diff --git a/enterprise_gateway/services/processproxies/docker_swarm.py b/enterprise_gateway/services/processproxies/docker_swarm.py index f3b05aacc..76d91b54f 100644 --- a/enterprise_gateway/services/processproxies/docker_swarm.py +++ b/enterprise_gateway/services/processproxies/docker_swarm.py @@ -1,4 +1,5 @@ """Code related to managing kernels running in docker-based containers.""" + # Copyright (c) Jupyter Development Team. # Distributed under the terms of the Modified BSD License. diff --git a/enterprise_gateway/services/processproxies/k8s.py b/enterprise_gateway/services/processproxies/k8s.py index 5ca69a9bd..00e6bf170 100644 --- a/enterprise_gateway/services/processproxies/k8s.py +++ b/enterprise_gateway/services/processproxies/k8s.py @@ -1,4 +1,5 @@ """Code related to managing kernels running in Kubernetes clusters.""" + # Copyright (c) Jupyter Development Team. # Distributed under the terms of the Modified BSD License. diff --git a/enterprise_gateway/services/processproxies/processproxy.py b/enterprise_gateway/services/processproxies/processproxy.py index 177c49492..405adfbca 100644 --- a/enterprise_gateway/services/processproxies/processproxy.py +++ b/enterprise_gateway/services/processproxies/processproxy.py @@ -1,4 +1,5 @@ """Kernel managers that operate against a remote process.""" + # Copyright (c) Jupyter Development Team. # Distributed under the terms of the Modified BSD License. from __future__ import annotations @@ -1332,9 +1333,9 @@ def _setup_connection_info(self, connect_info: dict) -> None: f"Host assigned to the kernel is: '{self.assigned_host}' '{self.assigned_ip}'" ) - connect_info[ - "ip" - ] = self.assigned_ip # Set connection to IP address of system where the kernel was launched + connect_info["ip"] = ( + self.assigned_ip + ) # Set connection to IP address of system where the kernel was launched if tunneling_enabled is True: # Capture the current(tunneled) connect_info relative to the IP and ports (including the @@ -1398,9 +1399,7 @@ def _update_connection(self, connect_info: dict) -> None: Note: Do NOT update connect_info with IP and other such artifacts in this method/function. """ # Reset the ports to 0 so load can take place (which resets the members to value from file or json)... - self.kernel_manager.stdin_port = ( - self.kernel_manager.iopub_port - ) = ( + self.kernel_manager.stdin_port = self.kernel_manager.iopub_port = ( self.kernel_manager.shell_port ) = self.kernel_manager.hb_port = self.kernel_manager.control_port = 0 diff --git a/enterprise_gateway/services/processproxies/spark_operator.py b/enterprise_gateway/services/processproxies/spark_operator.py index 132763408..cabf529e9 100644 --- a/enterprise_gateway/services/processproxies/spark_operator.py +++ b/enterprise_gateway/services/processproxies/spark_operator.py @@ -1,4 +1,5 @@ """A spark operator process proxy.""" + # Copyright (c) Jupyter Development Team. # Distributed under the terms of the Modified BSD License. from __future__ import annotations diff --git a/enterprise_gateway/services/processproxies/yarn.py b/enterprise_gateway/services/processproxies/yarn.py index 384e03918..58bef1d3b 100644 --- a/enterprise_gateway/services/processproxies/yarn.py +++ b/enterprise_gateway/services/processproxies/yarn.py @@ -1,4 +1,5 @@ """Code related to managing kernels running in YARN clusters.""" + # Copyright (c) Jupyter Development Team. # Distributed under the terms of the Modified BSD License. diff --git a/enterprise_gateway/services/sessions/kernelsessionmanager.py b/enterprise_gateway/services/sessions/kernelsessionmanager.py index 487b3571c..f4e73ca93 100644 --- a/enterprise_gateway/services/sessions/kernelsessionmanager.py +++ b/enterprise_gateway/services/sessions/kernelsessionmanager.py @@ -1,4 +1,5 @@ """Session manager that keeps all its metadata in memory.""" + # Copyright (c) Jupyter Development Team. # Distributed under the terms of the Modified BSD License. diff --git a/enterprise_gateway/services/sessions/sessionmanager.py b/enterprise_gateway/services/sessions/sessionmanager.py index 4ca5aa0db..4b3da0ed1 100644 --- a/enterprise_gateway/services/sessions/sessionmanager.py +++ b/enterprise_gateway/services/sessions/sessionmanager.py @@ -1,4 +1,5 @@ """Session manager that keeps all its metadata in memory.""" + # Copyright (c) Jupyter Development Team. # Distributed under the terms of the Modified BSD License. diff --git a/enterprise_gateway/tests/test_gatewayapp.py b/enterprise_gateway/tests/test_gatewayapp.py index b4490f318..8e0f59cfa 100644 --- a/enterprise_gateway/tests/test_gatewayapp.py +++ b/enterprise_gateway/tests/test_gatewayapp.py @@ -96,9 +96,9 @@ def test_config_env_vars(self): os.environ["EG_CERTFILE"] = "/test/fake.crt" os.environ["EG_CLIENT_CA"] = "/test/fake_ca.crt" os.environ["EG_SSL_VERSION"] = "3" - os.environ[ - "EG_KERNEL_SESSION_PERSISTENCE" - ] = "True" # availability mode will be defaulted to replication + os.environ["EG_KERNEL_SESSION_PERSISTENCE"] = ( + "True" # availability mode will be defaulted to replication + ) self._assert_envs_to_traitlets("EG_") diff --git a/etc/docker/kernel-image-puller/image_fetcher.py b/etc/docker/kernel-image-puller/image_fetcher.py index d4500b3a1..b18c990a0 100644 --- a/etc/docker/kernel-image-puller/image_fetcher.py +++ b/etc/docker/kernel-image-puller/image_fetcher.py @@ -1,4 +1,5 @@ """image name fetcher abstract class and concrete implementation""" + import abc import importlib import os diff --git a/etc/docker/kernel-image-puller/kernel_image_puller.py b/etc/docker/kernel-image-puller/kernel_image_puller.py index c1196b94d..67286c8ea 100644 --- a/etc/docker/kernel-image-puller/kernel_image_puller.py +++ b/etc/docker/kernel-image-puller/kernel_image_puller.py @@ -1,4 +1,5 @@ """A kernel image puller.""" + import importlib import logging import os diff --git a/etc/kernel-launchers/R/scripts/server_listener.py b/etc/kernel-launchers/R/scripts/server_listener.py index 9fd57987c..2ca755c67 100644 --- a/etc/kernel-launchers/R/scripts/server_listener.py +++ b/etc/kernel-launchers/R/scripts/server_listener.py @@ -1,4 +1,5 @@ """A server listener for R.""" + import base64 import json import logging diff --git a/etc/kernel-launchers/docker/scripts/launch_docker.py b/etc/kernel-launchers/docker/scripts/launch_docker.py index 1b3a8f1dc..3217b99a2 100644 --- a/etc/kernel-launchers/docker/scripts/launch_docker.py +++ b/etc/kernel-launchers/docker/scripts/launch_docker.py @@ -1,4 +1,5 @@ """Launches a containerized kernel.""" + import argparse import os import sys diff --git a/etc/kernel-launchers/python/scripts/launch_ipykernel.py b/etc/kernel-launchers/python/scripts/launch_ipykernel.py index 72f29751b..4ed8b3b1b 100644 --- a/etc/kernel-launchers/python/scripts/launch_ipykernel.py +++ b/etc/kernel-launchers/python/scripts/launch_ipykernel.py @@ -1,4 +1,5 @@ """Launch an ipython kernel.""" + import argparse import base64 import json diff --git a/pyproject.toml b/pyproject.toml index f43d760db..4da7fef04 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -64,7 +64,7 @@ test = [ "websocket-client" ] lint = [ - "black[jupyter]==23.9.1", + "black[jupyter]==24.2.0", "mdformat>0.7", "mdformat-gfm>=0.3.5", "ruff==0.2.2"