From 01be5c209db692f83b804791bf7887a935800bd9 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 5 Feb 2024 20:27:54 +0000 Subject: [PATCH] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- kubespawner/__init__.py | 1 + kubespawner/clients.py | 1 + kubespawner/objects.py | 9 ++++++--- kubespawner/spawner.py | 1 + kubespawner/utils.py | 1 + tests/conftest.py | 1 + tests/jupyterhub_config.py | 1 + tests/test_objects.py | 1 + 8 files changed, 13 insertions(+), 3 deletions(-) diff --git a/kubespawner/__init__.py b/kubespawner/__init__.py index ec65df34..89b7541d 100644 --- a/kubespawner/__init__.py +++ b/kubespawner/__init__.py @@ -7,6 +7,7 @@ in your `jupyterhub_config.py` file. """ + # We export KubeSpawner specifically here. This simplifies import for users. # Users can simply import kubespawner.KubeSpawner in their applications # instead of the more verbose import kubespawner.spawner.KubeSpawner. diff --git a/kubespawner/clients.py b/kubespawner/clients.py index b3078e43..0dd865e8 100644 --- a/kubespawner/clients.py +++ b/kubespawner/clients.py @@ -5,6 +5,7 @@ The instances of these REST API clients are also patched to avoid the creation of unused threads. """ + import asyncio from concurrent.futures import ThreadPoolExecutor from functools import lru_cache diff --git a/kubespawner/objects.py b/kubespawner/objects.py index 2153a46e..f644811f 100644 --- a/kubespawner/objects.py +++ b/kubespawner/objects.py @@ -1,6 +1,7 @@ """ Helper methods for generating k8s API objects. """ + import base64 import ipaddress import json @@ -353,9 +354,11 @@ def make_pod( # be a list, but it is allowed to have "a-string" elements or {"name": # "a-string"} elements. pod.spec.image_pull_secrets = [ - V1LocalObjectReference(name=secret_ref) - if type(secret_ref) == str - else get_k8s_model(V1LocalObjectReference, secret_ref) + ( + V1LocalObjectReference(name=secret_ref) + if type(secret_ref) == str + else get_k8s_model(V1LocalObjectReference, secret_ref) + ) for secret_ref in image_pull_secrets ] diff --git a/kubespawner/spawner.py b/kubespawner/spawner.py index 45437815..eafda735 100644 --- a/kubespawner/spawner.py +++ b/kubespawner/spawner.py @@ -4,6 +4,7 @@ This module exports `KubeSpawner` class, which is the actual spawner implementation that should be used by JupyterHub. """ + import asyncio import copy import ipaddress diff --git a/kubespawner/utils.py b/kubespawner/utils.py index 1d38147b..ca063fac 100644 --- a/kubespawner/utils.py +++ b/kubespawner/utils.py @@ -1,6 +1,7 @@ """ Misc. general utility functions, not tied to KubeSpawner directly """ + import copy import hashlib diff --git a/tests/conftest.py b/tests/conftest.py index 62eaee71..8d929fae 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -1,4 +1,5 @@ """pytest fixtures for kubespawner""" + import asyncio import base64 import inspect diff --git a/tests/jupyterhub_config.py b/tests/jupyterhub_config.py index 849d6603..71bd06fd 100644 --- a/tests/jupyterhub_config.py +++ b/tests/jupyterhub_config.py @@ -1,4 +1,5 @@ """Minimal jupyterhub config for hub pod""" + import json import os import socket diff --git a/tests/test_objects.py b/tests/test_objects.py index c734c051..90aba79c 100644 --- a/tests/test_objects.py +++ b/tests/test_objects.py @@ -1,6 +1,7 @@ """ Test functions used to create k8s objects """ + import pytest from kubernetes_asyncio.client import ApiClient