From 358de3765c537740c152b4fcab04af9305eae292 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Fri, 17 Jan 2025 20:13:32 +0000 Subject: [PATCH] [pre-commit.ci] Apply automatic pre-commit fixes --- .../jupyterhub/files/jupyterhub/02-spawner.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/_nebari/stages/kubernetes_services/template/modules/kubernetes/services/jupyterhub/files/jupyterhub/02-spawner.py b/src/_nebari/stages/kubernetes_services/template/modules/kubernetes/services/jupyterhub/files/jupyterhub/02-spawner.py index fbdd34f21..e819dca8e 100644 --- a/src/_nebari/stages/kubernetes_services/template/modules/kubernetes/services/jupyterhub/files/jupyterhub/02-spawner.py +++ b/src/_nebari/stages/kubernetes_services/template/modules/kubernetes/services/jupyterhub/files/jupyterhub/02-spawner.py @@ -10,9 +10,9 @@ from kubespawner import KubeSpawner # noqa: E402 - PAGE_SIZE_LIMIT = 100 + @gen.coroutine def get_username_hook(spawner): auth_state = yield spawner.user.get_auth_state() @@ -26,9 +26,10 @@ def get_username_hook(spawner): def get_conda_store_environments(user_info: dict): + import math + import urllib3 import yarl - import math external_url = z2jh.get_config("custom.conda-store-service-name") token = z2jh.get_config("custom.conda-store-jhub-apps-token") @@ -50,8 +51,10 @@ def get_conda_store_environments(user_info: dict): if total_records > PAGE_SIZE_LIMIT: # Already pulled the first page of results, start looping through # the envs starting on the 2nd page - for page in range(2, math.ceil(total_records/PAGE_SIZE_LIMIT)+1): - url = yarl.URL(f"http://{external_url}/{endpoint}/?size={PAGE_SIZE_LIMIT}&page={page}") + for page in range(2, math.ceil(total_records / PAGE_SIZE_LIMIT) + 1): + url = yarl.URL( + f"http://{external_url}/{endpoint}/?size={PAGE_SIZE_LIMIT}&page={page}" + ) response = http.request( "GET", str(url), headers={"Authorization": f"Bearer {token}"} )