mirror of
https://github.com/jupyterhub/jupyterhub.git
synced 2025-10-08 10:34:10 +00:00
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
This commit is contained in:
@@ -3,7 +3,6 @@
|
|||||||
|
|
||||||
import sys
|
import sys
|
||||||
import tarfile
|
import tarfile
|
||||||
from tarfile import TarFile
|
|
||||||
|
|
||||||
expected_files = [
|
expected_files = [
|
||||||
"docs/requirements.txt",
|
"docs/requirements.txt",
|
||||||
|
@@ -1,5 +1,4 @@
|
|||||||
import os
|
import os
|
||||||
from os.path import join
|
|
||||||
|
|
||||||
from pytablewriter import RstSimpleTableWriter
|
from pytablewriter import RstSimpleTableWriter
|
||||||
from pytablewriter.style import Style
|
from pytablewriter.style import Style
|
||||||
|
@@ -11,8 +11,6 @@ down_revision = None
|
|||||||
branch_labels = None
|
branch_labels = None
|
||||||
depends_on = None
|
depends_on = None
|
||||||
|
|
||||||
import sqlalchemy as sa
|
|
||||||
from alembic import op
|
|
||||||
|
|
||||||
def upgrade():
|
def upgrade():
|
||||||
pass
|
pass
|
||||||
|
@@ -5,7 +5,6 @@ import json
|
|||||||
import sys
|
import sys
|
||||||
|
|
||||||
from tornado import web
|
from tornado import web
|
||||||
from tornado.ioloop import IOLoop
|
|
||||||
|
|
||||||
from .._version import __version__
|
from .._version import __version__
|
||||||
from ..scopes import needs_scope
|
from ..scopes import needs_scope
|
||||||
|
@@ -776,8 +776,6 @@ def _deprecated_method(old_name, new_name, version):
|
|||||||
return deprecated
|
return deprecated
|
||||||
|
|
||||||
|
|
||||||
import types
|
|
||||||
|
|
||||||
# deprecate white/blacklist method names
|
# deprecate white/blacklist method names
|
||||||
for _old_name, _new_name, _version in [
|
for _old_name, _new_name, _version in [
|
||||||
("check_whitelist", "check_allowed", "1.2"),
|
("check_whitelist", "check_allowed", "1.2"),
|
||||||
|
@@ -13,7 +13,6 @@ from ..scopes import (
|
|||||||
_check_scopes_exist,
|
_check_scopes_exist,
|
||||||
_resolve_requested_scopes,
|
_resolve_requested_scopes,
|
||||||
access_scopes,
|
access_scopes,
|
||||||
expand_scopes,
|
|
||||||
identify_scopes,
|
identify_scopes,
|
||||||
)
|
)
|
||||||
from ..utils import compare_token, hash_token
|
from ..utils import compare_token, hash_token
|
||||||
|
@@ -35,7 +35,6 @@ from sqlalchemy.orm import (
|
|||||||
sessionmaker,
|
sessionmaker,
|
||||||
)
|
)
|
||||||
from sqlalchemy.pool import StaticPool
|
from sqlalchemy.pool import StaticPool
|
||||||
from sqlalchemy.sql.expression import bindparam
|
|
||||||
from sqlalchemy.types import LargeBinary, Text, TypeDecorator
|
from sqlalchemy.types import LargeBinary, Text, TypeDecorator
|
||||||
from tornado.log import app_log
|
from tornado.log import app_log
|
||||||
|
|
||||||
@@ -996,7 +995,6 @@ def check_db_revision(engine):
|
|||||||
).first()[0]
|
).first()[0]
|
||||||
if alembic_revision == head:
|
if alembic_revision == head:
|
||||||
app_log.debug("database schema version found: %s", alembic_revision)
|
app_log.debug("database schema version found: %s", alembic_revision)
|
||||||
pass
|
|
||||||
else:
|
else:
|
||||||
raise DatabaseSchemaMismatch(
|
raise DatabaseSchemaMismatch(
|
||||||
"Found database schema version {found} != {head}. "
|
"Found database schema version {found} != {head}. "
|
||||||
|
@@ -250,14 +250,12 @@ class Proxy(LoggingConfigurable):
|
|||||||
The proxy implementation should also have a way to associate the fact that a
|
The proxy implementation should also have a way to associate the fact that a
|
||||||
route came from JupyterHub.
|
route came from JupyterHub.
|
||||||
"""
|
"""
|
||||||
pass
|
|
||||||
|
|
||||||
async def delete_route(self, routespec):
|
async def delete_route(self, routespec):
|
||||||
"""Delete a route with a given routespec if it exists.
|
"""Delete a route with a given routespec if it exists.
|
||||||
|
|
||||||
**Subclasses must define this method**
|
**Subclasses must define this method**
|
||||||
"""
|
"""
|
||||||
pass
|
|
||||||
|
|
||||||
async def get_all_routes(self):
|
async def get_all_routes(self):
|
||||||
"""Fetch and return all the routes associated by JupyterHub from the
|
"""Fetch and return all the routes associated by JupyterHub from the
|
||||||
@@ -274,7 +272,6 @@ class Proxy(LoggingConfigurable):
|
|||||||
'data': the attached data dict for this route (as specified in add_route)
|
'data': the attached data dict for this route (as specified in add_route)
|
||||||
}
|
}
|
||||||
"""
|
"""
|
||||||
pass
|
|
||||||
|
|
||||||
async def get_route(self, routespec):
|
async def get_route(self, routespec):
|
||||||
"""Return the route info for a given routespec.
|
"""Return the route info for a given routespec.
|
||||||
@@ -683,7 +680,6 @@ class ConfigurableHTTPProxy(Proxy):
|
|||||||
os.remove(self.pid_file)
|
os.remove(self.pid_file)
|
||||||
except FileNotFoundError:
|
except FileNotFoundError:
|
||||||
self.log.debug("PID file %s already removed", self.pid_file)
|
self.log.debug("PID file %s already removed", self.pid_file)
|
||||||
pass
|
|
||||||
|
|
||||||
def _get_ssl_options(self):
|
def _get_ssl_options(self):
|
||||||
"""List of cmd proxy options to use internal SSL"""
|
"""List of cmd proxy options to use internal SSL"""
|
||||||
|
@@ -35,7 +35,6 @@ import string
|
|||||||
import time
|
import time
|
||||||
import uuid
|
import uuid
|
||||||
import warnings
|
import warnings
|
||||||
from functools import partial
|
|
||||||
from http import HTTPStatus
|
from http import HTTPStatus
|
||||||
from unittest import mock
|
from unittest import mock
|
||||||
from urllib.parse import urlencode
|
from urllib.parse import urlencode
|
||||||
|
@@ -14,7 +14,6 @@ import logging
|
|||||||
import os
|
import os
|
||||||
import random
|
import random
|
||||||
import secrets
|
import secrets
|
||||||
import ssl
|
|
||||||
import sys
|
import sys
|
||||||
import warnings
|
import warnings
|
||||||
from datetime import timezone
|
from datetime import timezone
|
||||||
|
@@ -896,7 +896,6 @@ class Spawner(LoggingConfigurable):
|
|||||||
Override in subclasses to restore any extra state that is needed to track
|
Override in subclasses to restore any extra state that is needed to track
|
||||||
the single-user server for that user. Subclasses should call super().
|
the single-user server for that user. Subclasses should call super().
|
||||||
"""
|
"""
|
||||||
pass
|
|
||||||
|
|
||||||
def get_state(self):
|
def get_state(self):
|
||||||
"""Save state of spawner into database.
|
"""Save state of spawner into database.
|
||||||
@@ -1341,7 +1340,6 @@ class Spawner(LoggingConfigurable):
|
|||||||
|
|
||||||
Stopping a server does *not* call this method.
|
Stopping a server does *not* call this method.
|
||||||
"""
|
"""
|
||||||
pass
|
|
||||||
|
|
||||||
def add_poll_callback(self, callback, *args, **kwargs):
|
def add_poll_callback(self, callback, *args, **kwargs):
|
||||||
"""Add a callback to fire when the single-user server stops"""
|
"""Add a callback to fire when the single-user server stops"""
|
||||||
|
@@ -27,7 +27,6 @@ Fixtures to add functionality or spawning behavior
|
|||||||
# Distributed under the terms of the Modified BSD License.
|
# Distributed under the terms of the Modified BSD License.
|
||||||
import asyncio
|
import asyncio
|
||||||
import copy
|
import copy
|
||||||
import inspect
|
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
from functools import partial
|
from functools import partial
|
||||||
@@ -36,7 +35,6 @@ from subprocess import TimeoutExpired
|
|||||||
from unittest import mock
|
from unittest import mock
|
||||||
|
|
||||||
from pytest import fixture, raises
|
from pytest import fixture, raises
|
||||||
from tornado import ioloop
|
|
||||||
from tornado.httpclient import HTTPError
|
from tornado.httpclient import HTTPError
|
||||||
from tornado.platform.asyncio import AsyncIOMainLoop
|
from tornado.platform.asyncio import AsyncIOMainLoop
|
||||||
|
|
||||||
|
@@ -36,7 +36,6 @@ from unittest import mock
|
|||||||
from urllib.parse import urlparse
|
from urllib.parse import urlparse
|
||||||
|
|
||||||
from pamela import PAMError
|
from pamela import PAMError
|
||||||
from tornado.ioloop import IOLoop
|
|
||||||
from traitlets import Bool, Dict, default
|
from traitlets import Bool, Dict, default
|
||||||
|
|
||||||
from .. import metrics, orm, roles
|
from .. import metrics, orm, roles
|
||||||
|
@@ -4,7 +4,6 @@ Run with old versions of jupyterhub to test upgrade/downgrade
|
|||||||
|
|
||||||
used in test_db.py
|
used in test_db.py
|
||||||
"""
|
"""
|
||||||
import os
|
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from functools import partial
|
from functools import partial
|
||||||
|
|
||||||
|
@@ -1,6 +1,5 @@
|
|||||||
import pytest
|
import pytest
|
||||||
from selenium import webdriver
|
from selenium import webdriver
|
||||||
from selenium.webdriver.firefox.options import Options as FirefoxOptions
|
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture()
|
@pytest.fixture()
|
||||||
|
@@ -1,21 +1,14 @@
|
|||||||
import asyncio
|
import asyncio
|
||||||
import time
|
|
||||||
from functools import partial
|
from functools import partial
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
from selenium import webdriver
|
from selenium.common.exceptions import NoSuchElementException
|
||||||
from selenium.common.exceptions import NoSuchElementException, TimeoutException
|
|
||||||
from selenium.webdriver.common.by import By
|
|
||||||
from selenium.webdriver.support import expected_conditions as EC
|
from selenium.webdriver.support import expected_conditions as EC
|
||||||
from selenium.webdriver.support.ui import WebDriverWait
|
from selenium.webdriver.support.ui import WebDriverWait
|
||||||
from tornado.escape import url_escape
|
from tornado.escape import url_escape
|
||||||
from tornado.httputil import url_concat
|
from tornado.httputil import url_concat
|
||||||
|
|
||||||
from jupyterhub.tests.selenium.locators import (
|
from jupyterhub.tests.selenium.locators import LoginPageLocators
|
||||||
HomePageLocators,
|
|
||||||
LoginPageLocators,
|
|
||||||
TokenPageLocators,
|
|
||||||
)
|
|
||||||
from jupyterhub.utils import exponential_backoff
|
from jupyterhub.utils import exponential_backoff
|
||||||
|
|
||||||
from ...utils import url_path_join
|
from ...utils import url_path_join
|
||||||
|
@@ -7,7 +7,6 @@ authentication can expire in a number of ways:
|
|||||||
- doesn't need refresh
|
- doesn't need refresh
|
||||||
- needs refresh and cannot be refreshed without new login
|
- needs refresh and cannot be refreshed without new login
|
||||||
"""
|
"""
|
||||||
from contextlib import contextmanager
|
|
||||||
from unittest import mock
|
from unittest import mock
|
||||||
from urllib.parse import parse_qs, urlparse
|
from urllib.parse import parse_qs, urlparse
|
||||||
|
|
||||||
|
@@ -14,8 +14,6 @@ import jsonschema
|
|||||||
import pytest
|
import pytest
|
||||||
from traitlets.config import Config
|
from traitlets.config import Config
|
||||||
|
|
||||||
from .mocking import MockHub
|
|
||||||
|
|
||||||
# To test new schemas, add them to the `valid_events`
|
# To test new schemas, add them to the `valid_events`
|
||||||
# and `invalid_events` dictionary below.
|
# and `invalid_events` dictionary below.
|
||||||
|
|
||||||
|
@@ -7,7 +7,6 @@ from datetime import datetime, timedelta
|
|||||||
from unittest import mock
|
from unittest import mock
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
from tornado import gen
|
|
||||||
|
|
||||||
from .. import crypto, objects, orm, roles
|
from .. import crypto, objects, orm, roles
|
||||||
from ..emptyclass import EmptyClass
|
from ..emptyclass import EmptyClass
|
||||||
|
@@ -6,8 +6,6 @@ from subprocess import Popen
|
|||||||
|
|
||||||
from async_generator import asynccontextmanager
|
from async_generator import asynccontextmanager
|
||||||
|
|
||||||
from .. import orm
|
|
||||||
from ..roles import roles_to_scopes
|
|
||||||
from ..utils import (
|
from ..utils import (
|
||||||
exponential_backoff,
|
exponential_backoff,
|
||||||
maybe_future,
|
maybe_future,
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
"""Tests for jupyterhub.singleuser"""
|
"""Tests for jupyterhub.singleuser"""
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
from contextlib import contextmanager, nullcontext
|
from contextlib import nullcontext
|
||||||
from subprocess import CalledProcessError, check_output
|
from subprocess import CalledProcessError, check_output
|
||||||
from unittest import mock
|
from unittest import mock
|
||||||
from urllib.parse import urlencode, urlparse
|
from urllib.parse import urlencode, urlparse
|
||||||
|
@@ -527,7 +527,6 @@ def print_stacks(file=sys.stderr):
|
|||||||
"""
|
"""
|
||||||
# local imports because these will not be used often,
|
# local imports because these will not be used often,
|
||||||
# no need to add them to startup
|
# no need to add them to startup
|
||||||
import asyncio
|
|
||||||
import traceback
|
import traceback
|
||||||
|
|
||||||
from .log import coroutine_frames
|
from .log import coroutine_frames
|
||||||
|
Reference in New Issue
Block a user