From cb536107b173a924b13670b0a3b02f49be46b770 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:26:28 +0000 Subject: [PATCH 1/2] [pre-commit.ci] pre-commit autoupdate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/psf/black: 23.12.1 → 24.1.1](https://github.com/psf/black/compare/23.12.1...24.1.1) - [github.com/PyCQA/flake8: 6.1.0 → 7.0.0](https://github.com/PyCQA/flake8/compare/6.1.0...7.0.0) --- .pre-commit-config.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 88432c8c6..3081fa76a 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -19,7 +19,7 @@ repos: # Autoformat: Python code - repo: https://github.com/psf/black - rev: 23.12.1 + rev: 24.1.1 hooks: - id: black # args are not passed, but see the config in pyproject.toml @@ -71,7 +71,7 @@ repos: # Lint: Python code - repo: https://github.com/PyCQA/flake8 - rev: "6.1.0" + rev: "7.0.0" hooks: - id: flake8 From 693ba3043fe7a7a4119f7d7062be09b16637e796 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:26:41 +0000 Subject: [PATCH 2/2] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- binderhub/app.py | 7 ++++--- binderhub/binderspawner_mixin.py | 1 + binderhub/builder.py | 16 ++++++++++------ binderhub/events.py | 1 + binderhub/launcher.py | 1 + binderhub/main.py | 1 + binderhub/registry.py | 1 + binderhub/repoproviders.py | 1 + binderhub/tests/test_quota.py | 1 + binderhub/tests/test_registry.py | 1 + binderhub/tests/utils.py | 1 + binderhub/utils.py | 1 + helm-chart/binderhub/values.yaml | 1 + .../local-binder-local-hub/binderhub_config.py | 1 + .../local-binder-local-hub/jupyterhub_config.py | 1 + 15 files changed, 27 insertions(+), 9 deletions(-) diff --git a/binderhub/app.py b/binderhub/app.py index db552790e..4c9e8f4c2 100644 --- a/binderhub/app.py +++ b/binderhub/app.py @@ -1,6 +1,7 @@ """ The binderhub application """ + import asyncio import ipaddress import json @@ -865,9 +866,9 @@ def initialize(self, *args, **kwargs): kubernetes.config.load_incluster_config() except kubernetes.config.ConfigException: kubernetes.config.load_kube_config() - self.tornado_settings[ - "kubernetes_client" - ] = self.kube_client = kubernetes.client.CoreV1Api() + self.tornado_settings["kubernetes_client"] = self.kube_client = ( + kubernetes.client.CoreV1Api() + ) # times 2 for log + build threads self.build_pool = ThreadPoolExecutor(self.concurrent_build_limit * 2) diff --git a/binderhub/binderspawner_mixin.py b/binderhub/binderspawner_mixin.py index aaa4761f8..b0af376d4 100644 --- a/binderhub/binderspawner_mixin.py +++ b/binderhub/binderspawner_mixin.py @@ -15,6 +15,7 @@ - Override the Z2JH hub with a custom image built in this repository - Duplicate the code here and in binderhub/binderspawner_mixin.py """ + from tornado import web from traitlets import Bool, Unicode from traitlets.config import Configurable diff --git a/binderhub/builder.py b/binderhub/builder.py index 8d57d7775..ca1deafbe 100644 --- a/binderhub/builder.py +++ b/binderhub/builder.py @@ -459,9 +459,11 @@ async def get(self, provider_prefix, _unescaped_spec): "ref": ref, "status": "success", "build_token": self._have_build_token, - "origin": self.settings["normalized_origin"] - if self.settings["normalized_origin"] - else self.request.host, + "origin": ( + self.settings["normalized_origin"] + if self.settings["normalized_origin"] + else self.request.host + ), }, ) return @@ -606,9 +608,11 @@ def _check_result(future): "ref": ref, "status": "success", "build_token": self._have_build_token, - "origin": self.settings["normalized_origin"] - if self.settings["normalized_origin"] - else self.request.host, + "origin": ( + self.settings["normalized_origin"] + if self.settings["normalized_origin"] + else self.request.host + ), }, ) diff --git a/binderhub/events.py b/binderhub/events.py index d09e29f59..a2a071140 100644 --- a/binderhub/events.py +++ b/binderhub/events.py @@ -1,6 +1,7 @@ """ Emit structured, discrete events when various actions happen. """ + import json import logging from datetime import datetime diff --git a/binderhub/launcher.py b/binderhub/launcher.py index 385ab6ab5..3de134f91 100644 --- a/binderhub/launcher.py +++ b/binderhub/launcher.py @@ -1,6 +1,7 @@ """ Launch an image with a temporary user via JupyterHub """ + import asyncio import base64 import json diff --git a/binderhub/main.py b/binderhub/main.py index 6d302972e..2a2027598 100644 --- a/binderhub/main.py +++ b/binderhub/main.py @@ -1,6 +1,7 @@ """ Main handler classes for requests """ + import time import urllib.parse diff --git a/binderhub/registry.py b/binderhub/registry.py index 0a369334a..45a6a83bf 100644 --- a/binderhub/registry.py +++ b/binderhub/registry.py @@ -1,6 +1,7 @@ """ Interaction with the Docker Registry """ + import base64 import json import os diff --git a/binderhub/repoproviders.py b/binderhub/repoproviders.py index 38fb05de1..be9dd75f4 100644 --- a/binderhub/repoproviders.py +++ b/binderhub/repoproviders.py @@ -7,6 +7,7 @@ .. note:: When adding a new repo provider, add it to the allowed values for repo providers in event-schemas/launch.json. """ + import asyncio import json import os diff --git a/binderhub/tests/test_quota.py b/binderhub/tests/test_quota.py index 58e5ae7c5..51c63cd14 100644 --- a/binderhub/tests/test_quota.py +++ b/binderhub/tests/test_quota.py @@ -1,4 +1,5 @@ """Test launch quotas""" + import concurrent.futures import json from unittest import mock diff --git a/binderhub/tests/test_registry.py b/binderhub/tests/test_registry.py index 1ad1485c6..774fa08c1 100644 --- a/binderhub/tests/test_registry.py +++ b/binderhub/tests/test_registry.py @@ -1,4 +1,5 @@ """Tests for the registry""" + import base64 import json import os diff --git a/binderhub/tests/utils.py b/binderhub/tests/utils.py index b065a8cb2..707827ac0 100644 --- a/binderhub/tests/utils.py +++ b/binderhub/tests/utils.py @@ -1,4 +1,5 @@ """Testing utilities""" + import asyncio import io from concurrent.futures import ThreadPoolExecutor diff --git a/binderhub/utils.py b/binderhub/utils.py index 4896ed9db..400aaa956 100644 --- a/binderhub/utils.py +++ b/binderhub/utils.py @@ -1,4 +1,5 @@ """Miscellaneous utilities""" + import ipaddress import time from collections import OrderedDict diff --git a/helm-chart/binderhub/values.yaml b/helm-chart/binderhub/values.yaml index 5f9193682..ca7bbaa41 100644 --- a/helm-chart/binderhub/values.yaml +++ b/helm-chart/binderhub/values.yaml @@ -102,6 +102,7 @@ jupyterhub: - Override the Z2JH hub with a custom image built in this repository - Duplicate the code here and in binderhub/binderspawner_mixin.py """ + from tornado import web from traitlets import Bool, Unicode from traitlets.config import Configurable diff --git a/testing/local-binder-local-hub/binderhub_config.py b/testing/local-binder-local-hub/binderhub_config.py index 2eae2c466..a2fe71bae 100644 --- a/testing/local-binder-local-hub/binderhub_config.py +++ b/testing/local-binder-local-hub/binderhub_config.py @@ -8,6 +8,7 @@ environment variable JUPYTERHUB_EXTERNAL_URL Host IP is needed in a few places """ + import os import socket diff --git a/testing/local-binder-local-hub/jupyterhub_config.py b/testing/local-binder-local-hub/jupyterhub_config.py index 1518c57fd..695b0cb40 100644 --- a/testing/local-binder-local-hub/jupyterhub_config.py +++ b/testing/local-binder-local-hub/jupyterhub_config.py @@ -4,6 +4,7 @@ Run `jupyterhub --config=binderhub_config.py` terminal Host IP is needed in a few places """ + import os import socket