mirror of
https://github.com/jupyterhub/jupyterhub.git
synced 2025-10-07 18:14: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:
@@ -13,6 +13,7 @@ The files are:
|
|||||||
This file is JupyterHub's REST API schema. Both a version and the RBAC
|
This file is JupyterHub's REST API schema. Both a version and the RBAC
|
||||||
scopes descriptions are updated in it.
|
scopes descriptions are updated in it.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import os
|
import os
|
||||||
from collections import defaultdict
|
from collections import defaultdict
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
@@ -2,6 +2,7 @@
|
|||||||
Example for a Spawner.pre_spawn_hook
|
Example for a Spawner.pre_spawn_hook
|
||||||
create a directory for the user before the spawner starts
|
create a directory for the user before the spawner starts
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# pylint: disable=import-error
|
# pylint: disable=import-error
|
||||||
import os
|
import os
|
||||||
import shutil
|
import shutil
|
||||||
|
@@ -3,6 +3,7 @@
|
|||||||
Implements OAuth handshake manually
|
Implements OAuth handshake manually
|
||||||
so all URLs and requests necessary for OAuth with JupyterHub should be in one place
|
so all URLs and requests necessary for OAuth with JupyterHub should be in one place
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
from urllib.parse import urlencode, urlparse
|
from urllib.parse import urlencode, urlparse
|
||||||
|
@@ -4,6 +4,7 @@ This example service serves `/services/whoami-oauth/`,
|
|||||||
authenticated with the Hub,
|
authenticated with the Hub,
|
||||||
showing the user their own info.
|
showing the user their own info.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
from urllib.parse import urlparse
|
from urllib.parse import urlparse
|
||||||
|
@@ -4,6 +4,7 @@ This serves `/services/whoami-api/`, authenticated with the Hub, showing the use
|
|||||||
|
|
||||||
HubAuthenticated only supports token-based access.
|
HubAuthenticated only supports token-based access.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
from urllib.parse import urlparse
|
from urllib.parse import urlparse
|
||||||
|
@@ -1,6 +1,7 @@
|
|||||||
"""
|
"""
|
||||||
Example JupyterHub config allowing users to specify environment variables and notebook-server args
|
Example JupyterHub config allowing users to specify environment variables and notebook-server args
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import shlex
|
import shlex
|
||||||
|
|
||||||
from jupyterhub.spawner import LocalProcessSpawner
|
from jupyterhub.spawner import LocalProcessSpawner
|
||||||
|
@@ -3,6 +3,7 @@
|
|||||||
Note: a memoized function should always return an _immutable_
|
Note: a memoized function should always return an _immutable_
|
||||||
result to avoid later modifications polluting cached results.
|
result to avoid later modifications polluting cached results.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from collections import OrderedDict
|
from collections import OrderedDict
|
||||||
from functools import wraps
|
from functools import wraps
|
||||||
|
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
"""JupyterHub version info"""
|
"""JupyterHub version info"""
|
||||||
|
|
||||||
# Copyright (c) Jupyter Development Team.
|
# Copyright (c) Jupyter Development Team.
|
||||||
# Distributed under the terms of the Modified BSD License.
|
# Distributed under the terms of the Modified BSD License.
|
||||||
# version_info updated by running `tbump`
|
# version_info updated by running `tbump`
|
||||||
|
@@ -5,6 +5,7 @@ Revises: 833da8570507
|
|||||||
Create Date: 2021-09-15 14:04:09.067024
|
Create Date: 2021-09-15 14:04:09.067024
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# revision identifiers, used by Alembic.
|
# revision identifiers, used by Alembic.
|
||||||
revision = '0eee8c825d24'
|
revision = '0eee8c825d24'
|
||||||
down_revision = '651f5419b74d'
|
down_revision = '651f5419b74d'
|
||||||
|
@@ -5,6 +5,7 @@ Revises:
|
|||||||
Create Date: 2016-04-11 16:05:34.873288
|
Create Date: 2016-04-11 16:05:34.873288
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# revision identifiers, used by Alembic.
|
# revision identifiers, used by Alembic.
|
||||||
revision = '19c0846f6344'
|
revision = '19c0846f6344'
|
||||||
down_revision = None
|
down_revision = None
|
||||||
|
@@ -5,6 +5,7 @@ Revises: 3ec6993fe20c
|
|||||||
Create Date: 2017-12-07 14:43:51.500740
|
Create Date: 2017-12-07 14:43:51.500740
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# revision identifiers, used by Alembic.
|
# revision identifiers, used by Alembic.
|
||||||
revision = '1cebaf56856c'
|
revision = '1cebaf56856c'
|
||||||
down_revision = '3ec6993fe20c'
|
down_revision = '3ec6993fe20c'
|
||||||
|
@@ -12,6 +12,7 @@ Revises: af4cbdb2d13c
|
|||||||
Create Date: 2017-07-28 16:44:40.413648
|
Create Date: 2017-07-28 16:44:40.413648
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# revision identifiers, used by Alembic.
|
# revision identifiers, used by Alembic.
|
||||||
revision = '3ec6993fe20c'
|
revision = '3ec6993fe20c'
|
||||||
down_revision = 'af4cbdb2d13c'
|
down_revision = 'af4cbdb2d13c'
|
||||||
|
@@ -5,6 +5,7 @@ Revises: 896818069c98
|
|||||||
Create Date: 2019-02-28 14:14:27.423927
|
Create Date: 2019-02-28 14:14:27.423927
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# revision identifiers, used by Alembic.
|
# revision identifiers, used by Alembic.
|
||||||
revision = '4dc2d5a8c53c'
|
revision = '4dc2d5a8c53c'
|
||||||
down_revision = '896818069c98'
|
down_revision = '896818069c98'
|
||||||
|
@@ -5,6 +5,7 @@ Revises: 1cebaf56856c
|
|||||||
Create Date: 2017-12-19 15:21:09.300513
|
Create Date: 2017-12-19 15:21:09.300513
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# revision identifiers, used by Alembic.
|
# revision identifiers, used by Alembic.
|
||||||
revision = '56cc5a70207e'
|
revision = '56cc5a70207e'
|
||||||
down_revision = '1cebaf56856c'
|
down_revision = '1cebaf56856c'
|
||||||
|
@@ -5,6 +5,7 @@ Revises: 833da8570507
|
|||||||
Create Date: 2022-02-28 12:42:55.149046
|
Create Date: 2022-02-28 12:42:55.149046
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# revision identifiers, used by Alembic.
|
# revision identifiers, used by Alembic.
|
||||||
revision = '651f5419b74d'
|
revision = '651f5419b74d'
|
||||||
down_revision = '833da8570507'
|
down_revision = '833da8570507'
|
||||||
|
@@ -6,6 +6,7 @@ Revises: 4dc2d5a8c53c
|
|||||||
Create Date: 2021-02-17 15:03:04.360368
|
Create Date: 2021-02-17 15:03:04.360368
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# revision identifiers, used by Alembic.
|
# revision identifiers, used by Alembic.
|
||||||
revision = '833da8570507'
|
revision = '833da8570507'
|
||||||
down_revision = '4dc2d5a8c53c'
|
down_revision = '4dc2d5a8c53c'
|
||||||
|
@@ -5,6 +5,7 @@ Revises: d68c98b66cd4
|
|||||||
Create Date: 2018-05-07 11:35:58.050542
|
Create Date: 2018-05-07 11:35:58.050542
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# revision identifiers, used by Alembic.
|
# revision identifiers, used by Alembic.
|
||||||
revision = '896818069c98'
|
revision = '896818069c98'
|
||||||
down_revision = 'd68c98b66cd4'
|
down_revision = 'd68c98b66cd4'
|
||||||
|
@@ -5,6 +5,7 @@ Revises: 56cc5a70207e
|
|||||||
Create Date: 2018-03-21 14:27:17.466841
|
Create Date: 2018-03-21 14:27:17.466841
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# revision identifiers, used by Alembic.
|
# revision identifiers, used by Alembic.
|
||||||
revision = '99a28a4418e1'
|
revision = '99a28a4418e1'
|
||||||
down_revision = '56cc5a70207e'
|
down_revision = '56cc5a70207e'
|
||||||
|
@@ -5,6 +5,7 @@ Revises: eeb276e51423
|
|||||||
Create Date: 2016-07-28 16:16:38.245348
|
Create Date: 2016-07-28 16:16:38.245348
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# revision identifiers, used by Alembic.
|
# revision identifiers, used by Alembic.
|
||||||
revision = 'af4cbdb2d13c'
|
revision = 'af4cbdb2d13c'
|
||||||
down_revision = 'eeb276e51423'
|
down_revision = 'eeb276e51423'
|
||||||
|
@@ -5,6 +5,7 @@ Revises: 99a28a4418e1
|
|||||||
Create Date: 2018-04-13 10:50:17.968636
|
Create Date: 2018-04-13 10:50:17.968636
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# revision identifiers, used by Alembic.
|
# revision identifiers, used by Alembic.
|
||||||
revision = 'd68c98b66cd4'
|
revision = 'd68c98b66cd4'
|
||||||
down_revision = '99a28a4418e1'
|
down_revision = '99a28a4418e1'
|
||||||
|
@@ -6,6 +6,7 @@ Revision ID: eeb276e51423
|
|||||||
Revises: 19c0846f6344
|
Revises: 19c0846f6344
|
||||||
Create Date: 2016-04-11 16:06:49.239831
|
Create Date: 2016-04-11 16:06:49.239831
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# revision identifiers, used by Alembic.
|
# revision identifiers, used by Alembic.
|
||||||
revision = 'eeb276e51423'
|
revision = 'eeb276e51423'
|
||||||
down_revision = '19c0846f6344'
|
down_revision = '19c0846f6344'
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
"""Authorization handlers"""
|
"""Authorization handlers"""
|
||||||
|
|
||||||
# Copyright (c) Jupyter Development Team.
|
# Copyright (c) Jupyter Development Team.
|
||||||
# Distributed under the terms of the Modified BSD License.
|
# Distributed under the terms of the Modified BSD License.
|
||||||
import json
|
import json
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
"""Base API handlers"""
|
"""Base API handlers"""
|
||||||
|
|
||||||
# Copyright (c) Jupyter Development Team.
|
# Copyright (c) Jupyter Development Team.
|
||||||
# Distributed under the terms of the Modified BSD License.
|
# Distributed under the terms of the Modified BSD License.
|
||||||
import json
|
import json
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
"""Group handlers"""
|
"""Group handlers"""
|
||||||
|
|
||||||
# Copyright (c) Jupyter Development Team.
|
# Copyright (c) Jupyter Development Team.
|
||||||
# Distributed under the terms of the Modified BSD License.
|
# Distributed under the terms of the Modified BSD License.
|
||||||
import json
|
import json
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
"""API handlers for administering the Hub itself"""
|
"""API handlers for administering the Hub itself"""
|
||||||
|
|
||||||
# Copyright (c) Jupyter Development Team.
|
# Copyright (c) Jupyter Development Team.
|
||||||
# Distributed under the terms of the Modified BSD License.
|
# Distributed under the terms of the Modified BSD License.
|
||||||
import json
|
import json
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
"""Proxy handlers"""
|
"""Proxy handlers"""
|
||||||
|
|
||||||
# Copyright (c) Jupyter Development Team.
|
# Copyright (c) Jupyter Development Team.
|
||||||
# Distributed under the terms of the Modified BSD License.
|
# Distributed under the terms of the Modified BSD License.
|
||||||
import json
|
import json
|
||||||
|
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
Currently GET-only, no actions can be taken to modify services.
|
Currently GET-only, no actions can be taken to modify services.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# Copyright (c) Jupyter Development Team.
|
# Copyright (c) Jupyter Development Team.
|
||||||
# Distributed under the terms of the Modified BSD License.
|
# Distributed under the terms of the Modified BSD License.
|
||||||
import json
|
import json
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
"""User handlers"""
|
"""User handlers"""
|
||||||
|
|
||||||
# Copyright (c) Jupyter Development Team.
|
# Copyright (c) Jupyter Development Team.
|
||||||
# Distributed under the terms of the Modified BSD License.
|
# Distributed under the terms of the Modified BSD License.
|
||||||
import asyncio
|
import asyncio
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
"""Base Authenticator class and the default PAM Authenticator"""
|
"""Base Authenticator class and the default PAM Authenticator"""
|
||||||
|
|
||||||
# Copyright (c) IPython Development Team.
|
# Copyright (c) IPython Development Team.
|
||||||
# Distributed under the terms of the Modified BSD License.
|
# Distributed under the terms of the Modified BSD License.
|
||||||
import inspect
|
import inspect
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
"""Database utilities for JupyterHub"""
|
"""Database utilities for JupyterHub"""
|
||||||
|
|
||||||
# Copyright (c) Jupyter Development Team.
|
# Copyright (c) Jupyter Development Team.
|
||||||
# Distributed under the terms of the Modified BSD License.
|
# Distributed under the terms of the Modified BSD License.
|
||||||
# Based on pgcontents.utils.migrate, used under the Apache license.
|
# Based on pgcontents.utils.migrate, used under the Apache license.
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
"""HTTP Handlers for the hub server"""
|
"""HTTP Handlers for the hub server"""
|
||||||
|
|
||||||
# Copyright (c) Jupyter Development Team.
|
# Copyright (c) Jupyter Development Team.
|
||||||
# Distributed under the terms of the Modified BSD License.
|
# Distributed under the terms of the Modified BSD License.
|
||||||
import asyncio
|
import asyncio
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
"""HTTP Handlers for the hub server"""
|
"""HTTP Handlers for the hub server"""
|
||||||
|
|
||||||
# Copyright (c) Jupyter Development Team.
|
# Copyright (c) Jupyter Development Team.
|
||||||
# Distributed under the terms of the Modified BSD License.
|
# Distributed under the terms of the Modified BSD License.
|
||||||
import asyncio
|
import asyncio
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
"""Handlers for serving prometheus metrics"""
|
"""Handlers for serving prometheus metrics"""
|
||||||
|
|
||||||
from prometheus_client import CONTENT_TYPE_LATEST, REGISTRY, generate_latest
|
from prometheus_client import CONTENT_TYPE_LATEST, REGISTRY, generate_latest
|
||||||
|
|
||||||
from ..utils import metrics_authentication
|
from ..utils import metrics_authentication
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
"""Basic html-rendering handlers."""
|
"""Basic html-rendering handlers."""
|
||||||
|
|
||||||
# Copyright (c) Jupyter Development Team.
|
# Copyright (c) Jupyter Development Team.
|
||||||
# Distributed under the terms of the Modified BSD License.
|
# Distributed under the terms of the Modified BSD License.
|
||||||
import asyncio
|
import asyncio
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
"""logging utilities"""
|
"""logging utilities"""
|
||||||
|
|
||||||
# Copyright (c) Jupyter Development Team.
|
# Copyright (c) Jupyter Development Team.
|
||||||
# Distributed under the terms of the Modified BSD License.
|
# Distributed under the terms of the Modified BSD License.
|
||||||
import json
|
import json
|
||||||
|
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
implements https://oauthlib.readthedocs.io/en/latest/oauth2/server.html
|
implements https://oauthlib.readthedocs.io/en/latest/oauth2/server.html
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from oauthlib import uri_validate
|
from oauthlib import uri_validate
|
||||||
from oauthlib.oauth2 import RequestValidator, WebApplicationServer
|
from oauthlib.oauth2 import RequestValidator, WebApplicationServer
|
||||||
from oauthlib.oauth2.rfc6749.grant_types import authorization_code, base
|
from oauthlib.oauth2.rfc6749.grant_types import authorization_code, base
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
"""Some general objects for use in JupyterHub"""
|
"""Some general objects for use in JupyterHub"""
|
||||||
|
|
||||||
# Copyright (c) Jupyter Development Team.
|
# Copyright (c) Jupyter Development Team.
|
||||||
# Distributed under the terms of the Modified BSD License.
|
# Distributed under the terms of the Modified BSD License.
|
||||||
import socket
|
import socket
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
"""sqlalchemy ORM tools for the state of the constellation of processes"""
|
"""sqlalchemy ORM tools for the state of the constellation of processes"""
|
||||||
|
|
||||||
# Copyright (c) Jupyter Development Team.
|
# Copyright (c) Jupyter Development Team.
|
||||||
# Distributed under the terms of the Modified BSD License.
|
# Distributed under the terms of the Modified BSD License.
|
||||||
import enum
|
import enum
|
||||||
|
@@ -14,6 +14,7 @@ Route Specification:
|
|||||||
'host.tld/path/' for host-based routing or '/path/' for default routing.
|
'host.tld/path/' for host-based routing or '/path/' for default routing.
|
||||||
- Route paths should be normalized to always start and end with '/'
|
- Route paths should be normalized to always start and end with '/'
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# Copyright (c) Jupyter Development Team.
|
# Copyright (c) Jupyter Development Team.
|
||||||
# Distributed under the terms of the Modified BSD License.
|
# Distributed under the terms of the Modified BSD License.
|
||||||
import asyncio
|
import asyncio
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
"""Roles utils"""
|
"""Roles utils"""
|
||||||
|
|
||||||
# Copyright (c) Jupyter Development Team.
|
# Copyright (c) Jupyter Development Team.
|
||||||
# Distributed under the terms of the Modified BSD License.
|
# Distributed under the terms of the Modified BSD License.
|
||||||
import re
|
import re
|
||||||
|
@@ -14,6 +14,7 @@ intersection : set of expanded scopes as intersection of 2 expanded scope sets
|
|||||||
identify scopes: set of expanded scopes needed for identify (whoami) endpoints
|
identify scopes: set of expanded scopes needed for identify (whoami) endpoints
|
||||||
reduced scopes: expanded scopes that have been reduced
|
reduced scopes: expanded scopes that have been reduced
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import functools
|
import functools
|
||||||
import inspect
|
import inspect
|
||||||
import re
|
import re
|
||||||
|
@@ -23,6 +23,7 @@ If you are using OAuth, you will also need to register an oauth callback handler
|
|||||||
A tornado implementation is provided in :class:`HubOAuthCallbackHandler`.
|
A tornado implementation is provided in :class:`HubOAuthCallbackHandler`.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import asyncio
|
import asyncio
|
||||||
import hashlib
|
import hashlib
|
||||||
import json
|
import json
|
||||||
|
@@ -38,6 +38,7 @@ A hub-managed service with no URL::
|
|||||||
}
|
}
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import asyncio
|
import asyncio
|
||||||
import copy
|
import copy
|
||||||
import os
|
import os
|
||||||
|
@@ -12,6 +12,7 @@ Application subclass can be controlled with environment variables:
|
|||||||
- JUPYTERHUB_SINGLEUSER_EXTENSION=1 to opt-in to the extension (requires Jupyter Server 2)
|
- JUPYTERHUB_SINGLEUSER_EXTENSION=1 to opt-in to the extension (requires Jupyter Server 2)
|
||||||
- JUPYTERHUB_SINGLEUSER_APP=notebook (or jupyter-server) to opt-in
|
- JUPYTERHUB_SINGLEUSER_APP=notebook (or jupyter-server) to opt-in
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
|
||||||
from .mixins import HubAuthenticatedHandler, make_singleuser_app
|
from .mixins import HubAuthenticatedHandler, make_singleuser_app
|
||||||
|
@@ -8,6 +8,7 @@
|
|||||||
Default app changed to launch `jupyter labhub`.
|
Default app changed to launch `jupyter labhub`.
|
||||||
Use JUPYTERHUB_SINGLEUSER_APP='notebook' for the legacy 'classic' notebook server (requires notebook<7).
|
Use JUPYTERHUB_SINGLEUSER_APP='notebook' for the legacy 'classic' notebook server (requires notebook<7).
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
|
||||||
from traitlets import import_item
|
from traitlets import import_item
|
||||||
|
@@ -613,9 +613,9 @@ class JupyterHubSingleUser(ExtensionApp):
|
|||||||
jinja_template_vars['logo_url'] = self.hub_auth.hub_host + url_path_join(
|
jinja_template_vars['logo_url'] = self.hub_auth.hub_host + url_path_join(
|
||||||
self.hub_auth.hub_prefix, 'logo'
|
self.hub_auth.hub_prefix, 'logo'
|
||||||
)
|
)
|
||||||
jinja_template_vars[
|
jinja_template_vars['hub_control_panel_url'] = (
|
||||||
'hub_control_panel_url'
|
self.hub_auth.hub_host + url_path_join(self.hub_auth.hub_prefix, 'home')
|
||||||
] = self.hub_auth.hub_host + url_path_join(self.hub_auth.hub_prefix, 'home')
|
)
|
||||||
|
|
||||||
_activity_task = None
|
_activity_task = None
|
||||||
|
|
||||||
@@ -628,9 +628,9 @@ class JupyterHubSingleUser(ExtensionApp):
|
|||||||
|
|
||||||
super().initialize()
|
super().initialize()
|
||||||
app = self.serverapp
|
app = self.serverapp
|
||||||
app.web_app.settings[
|
app.web_app.settings["page_config_hook"] = (
|
||||||
"page_config_hook"
|
app.identity_provider.page_config_hook
|
||||||
] = app.identity_provider.page_config_hook
|
)
|
||||||
# if the user has configured a log function in the tornado settings, do not override it
|
# if the user has configured a log function in the tornado settings, do not override it
|
||||||
if not 'log_function' in app.config.ServerApp.get('tornado_settings', {}):
|
if not 'log_function' in app.config.ServerApp.get('tornado_settings', {}):
|
||||||
app.web_app.settings["log_function"] = log_request
|
app.web_app.settings["log_function"] = log_request
|
||||||
|
@@ -734,9 +734,9 @@ class SingleUserNotebookAppMixin(Configurable):
|
|||||||
)
|
)
|
||||||
self.jinja_template_vars['hub_host'] = self.hub_host
|
self.jinja_template_vars['hub_host'] = self.hub_host
|
||||||
self.jinja_template_vars['hub_prefix'] = self.hub_prefix
|
self.jinja_template_vars['hub_prefix'] = self.hub_prefix
|
||||||
self.jinja_template_vars[
|
self.jinja_template_vars['hub_control_panel_url'] = (
|
||||||
'hub_control_panel_url'
|
self.hub_host + url_path_join(self.hub_prefix, 'home')
|
||||||
] = self.hub_host + url_path_join(self.hub_prefix, 'home')
|
)
|
||||||
|
|
||||||
settings = self.web_app.settings
|
settings = self.web_app.settings
|
||||||
# patch classic notebook jinja env
|
# patch classic notebook jinja env
|
||||||
|
@@ -1,6 +1,7 @@
|
|||||||
"""
|
"""
|
||||||
Contains base Spawner class & default implementation
|
Contains base Spawner class & default implementation
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# Copyright (c) Jupyter Development Team.
|
# Copyright (c) Jupyter Development Team.
|
||||||
# Distributed under the terms of the Modified BSD License.
|
# Distributed under the terms of the Modified BSD License.
|
||||||
import ast
|
import ast
|
||||||
|
@@ -878,9 +878,11 @@ async def test_oauth_page(
|
|||||||
user_scopes or ['(no_scope)'], user.name
|
user_scopes or ['(no_scope)'], user.name
|
||||||
)
|
)
|
||||||
desc_list_expected = [
|
desc_list_expected = [
|
||||||
|
(
|
||||||
f"{sd['description']} Applies to {sd['filter']}."
|
f"{sd['description']} Applies to {sd['filter']}."
|
||||||
if sd.get('filter')
|
if sd.get('filter')
|
||||||
else sd['description']
|
else sd['description']
|
||||||
|
)
|
||||||
for sd in scope_descriptions
|
for sd in scope_descriptions
|
||||||
]
|
]
|
||||||
assert sorted(desc_list_form) == sorted(desc_list_expected)
|
assert sorted(desc_list_form) == sorted(desc_list_expected)
|
||||||
|
@@ -23,6 +23,7 @@ Fixtures to add functionality or spawning behavior
|
|||||||
- `slow_bad_spawn`
|
- `slow_bad_spawn`
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# Copyright (c) Jupyter Development Team.
|
# Copyright (c) Jupyter Development Team.
|
||||||
# Distributed under the terms of the Modified BSD License.
|
# Distributed under the terms of the Modified BSD License.
|
||||||
import asyncio
|
import asyncio
|
||||||
|
@@ -26,6 +26,7 @@ Other components
|
|||||||
- public_url
|
- public_url
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import asyncio
|
import asyncio
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
"""Example JupyterServer app subclass"""
|
"""Example JupyterServer app subclass"""
|
||||||
|
|
||||||
from jupyter_server.base.handlers import JupyterHandler
|
from jupyter_server.base.handlers import JupyterHandler
|
||||||
from jupyter_server.serverapp import ServerApp
|
from jupyter_server.serverapp import ServerApp
|
||||||
from tornado import web
|
from tornado import web
|
||||||
|
@@ -12,6 +12,7 @@ Handlers and their purpose include:
|
|||||||
- WhoAmIHandler: returns name of user making a request (deprecated cookie login)
|
- WhoAmIHandler: returns name of user making a request (deprecated cookie login)
|
||||||
- OWhoAmIHandler: returns name of user making a request (OAuth login)
|
- OWhoAmIHandler: returns name of user making a request (OAuth login)
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
import pprint
|
import pprint
|
||||||
|
@@ -11,6 +11,7 @@ Handlers and their purpose include:
|
|||||||
- ArgsHandler: allowing retrieval of `sys.argv`.
|
- ArgsHandler: allowing retrieval of `sys.argv`.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
@@ -4,6 +4,7 @@ Run with old versions of jupyterhub to test upgrade/downgrade
|
|||||||
|
|
||||||
used in test_db.py
|
used in test_db.py
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from functools import partial
|
from functools import partial
|
||||||
|
|
||||||
import jupyterhub
|
import jupyterhub
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
"""Tests for the REST API."""
|
"""Tests for the REST API."""
|
||||||
|
|
||||||
import asyncio
|
import asyncio
|
||||||
import json
|
import json
|
||||||
import re
|
import re
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
"""Test the JupyterHub entry point"""
|
"""Test the JupyterHub entry point"""
|
||||||
|
|
||||||
import asyncio
|
import asyncio
|
||||||
import binascii
|
import binascii
|
||||||
import json
|
import json
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
"""Tests for PAM authentication"""
|
"""Tests for PAM authentication"""
|
||||||
|
|
||||||
# Copyright (c) Jupyter Development Team.
|
# Copyright (c) Jupyter Development Team.
|
||||||
# Distributed under the terms of the Modified BSD License.
|
# Distributed under the terms of the Modified BSD License.
|
||||||
import logging
|
import logging
|
||||||
|
@@ -7,6 +7,7 @@ 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 unittest import mock
|
from unittest import mock
|
||||||
from urllib.parse import parse_qs, urlparse
|
from urllib.parse import parse_qs, urlparse
|
||||||
|
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
"""Tests for dummy authentication"""
|
"""Tests for dummy authentication"""
|
||||||
|
|
||||||
# Copyright (c) Jupyter Development Team.
|
# Copyright (c) Jupyter Development Team.
|
||||||
# Distributed under the terms of the Modified BSD License.
|
# Distributed under the terms of the Modified BSD License.
|
||||||
from jupyterhub.auth import DummyAuthenticator
|
from jupyterhub.auth import DummyAuthenticator
|
||||||
|
@@ -5,6 +5,7 @@ To test a new schema or event, simply add it to the
|
|||||||
|
|
||||||
You *shouldn't* need to write new tests.
|
You *shouldn't* need to write new tests.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import io
|
import io
|
||||||
import json
|
import json
|
||||||
import logging
|
import logging
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
"""Tests for jupyterhub internal_ssl connections"""
|
"""Tests for jupyterhub internal_ssl connections"""
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
import time
|
import time
|
||||||
from unittest import mock
|
from unittest import mock
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
"""Tests for named servers"""
|
"""Tests for named servers"""
|
||||||
|
|
||||||
import asyncio
|
import asyncio
|
||||||
import json
|
import json
|
||||||
import time
|
import time
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
"""Tests for basic object-wrappers"""
|
"""Tests for basic object-wrappers"""
|
||||||
|
|
||||||
import socket
|
import socket
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
"""Tests for the ORM bits"""
|
"""Tests for the ORM bits"""
|
||||||
|
|
||||||
# Copyright (c) Jupyter Development Team.
|
# Copyright (c) Jupyter Development Team.
|
||||||
# Distributed under the terms of the Modified BSD License.
|
# Distributed under the terms of the Modified BSD License.
|
||||||
import os
|
import os
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
"""Tests for HTML pages"""
|
"""Tests for HTML pages"""
|
||||||
|
|
||||||
import asyncio
|
import asyncio
|
||||||
import sys
|
import sys
|
||||||
from unittest import mock
|
from unittest import mock
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
"""Test a proxy being started before the Hub"""
|
"""Test a proxy being started before the Hub"""
|
||||||
|
|
||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
from contextlib import contextmanager
|
from contextlib import contextmanager
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
"""Test roles"""
|
"""Test roles"""
|
||||||
|
|
||||||
# Copyright (c) Jupyter Development Team.
|
# Copyright (c) Jupyter Development Team.
|
||||||
# Distributed under the terms of the Modified BSD License.
|
# Distributed under the terms of the Modified BSD License.
|
||||||
import json
|
import json
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
"""Test scopes for API handlers"""
|
"""Test scopes for API handlers"""
|
||||||
|
|
||||||
from operator import itemgetter
|
from operator import itemgetter
|
||||||
from unittest import mock
|
from unittest import mock
|
||||||
|
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
"""Tests for services"""
|
"""Tests for services"""
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
from binascii import hexlify
|
from binascii import hexlify
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
"""Tests for service authentication"""
|
"""Tests for service authentication"""
|
||||||
|
|
||||||
import copy
|
import copy
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
"""Tests for jupyterhub.singleuser"""
|
"""Tests for jupyterhub.singleuser"""
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
from contextlib import nullcontext
|
from contextlib import nullcontext
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
"""Tests for process spawning"""
|
"""Tests for process spawning"""
|
||||||
|
|
||||||
# Copyright (c) Jupyter Development Team.
|
# Copyright (c) Jupyter Development Team.
|
||||||
# Distributed under the terms of the Modified BSD License.
|
# Distributed under the terms of the Modified BSD License.
|
||||||
import asyncio
|
import asyncio
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
"""Tests for utilities"""
|
"""Tests for utilities"""
|
||||||
|
|
||||||
import asyncio
|
import asyncio
|
||||||
import time
|
import time
|
||||||
from concurrent.futures import ThreadPoolExecutor
|
from concurrent.futures import ThreadPoolExecutor
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
"""Test version checking"""
|
"""Test version checking"""
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
@@ -1,6 +1,7 @@
|
|||||||
"""
|
"""
|
||||||
Traitlets that are used in JupyterHub
|
Traitlets that are used in JupyterHub
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# Copyright (c) Jupyter Development Team.
|
# Copyright (c) Jupyter Development Team.
|
||||||
# Distributed under the terms of the Modified BSD License.
|
# Distributed under the terms of the Modified BSD License.
|
||||||
import sys
|
import sys
|
||||||
|
@@ -795,9 +795,9 @@ class User:
|
|||||||
await spawner.run_auth_state_hook(auth_state)
|
await spawner.run_auth_state_hook(auth_state)
|
||||||
|
|
||||||
# update spawner start time, and activity for both spawner and user
|
# update spawner start time, and activity for both spawner and user
|
||||||
self.last_activity = (
|
self.last_activity = spawner.orm_spawner.started = (
|
||||||
spawner.orm_spawner.started
|
spawner.orm_spawner.last_activity
|
||||||
) = spawner.orm_spawner.last_activity = utcnow(with_tz=False)
|
) = utcnow(with_tz=False)
|
||||||
db.commit()
|
db.commit()
|
||||||
# wait for spawner.start to return
|
# wait for spawner.start to return
|
||||||
# run optional preparation work to bootstrap the notebook
|
# run optional preparation work to bootstrap the notebook
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
"""Miscellaneous utilities"""
|
"""Miscellaneous utilities"""
|
||||||
|
|
||||||
# Copyright (c) Jupyter Development Team.
|
# Copyright (c) Jupyter Development Team.
|
||||||
# Distributed under the terms of the Modified BSD License.
|
# Distributed under the terms of the Modified BSD License.
|
||||||
import asyncio
|
import asyncio
|
||||||
|
Reference in New Issue
Block a user