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