mirror of
https://github.com/jupyterhub/jupyterhub.git
synced 2025-10-08 02:24:08 +00:00
remove unused imports
This commit is contained in:
@@ -1,7 +1,6 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
#
|
#
|
||||||
import os
|
import os
|
||||||
import shlex
|
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
# Set paths
|
# Set paths
|
||||||
|
@@ -5,13 +5,11 @@ so all URLs and requests necessary for OAuth with JupyterHub should be in one pl
|
|||||||
"""
|
"""
|
||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
import sys
|
|
||||||
from urllib.parse import urlencode
|
from urllib.parse import urlencode
|
||||||
from urllib.parse import urlparse
|
from urllib.parse import urlparse
|
||||||
|
|
||||||
from tornado import log
|
from tornado import log
|
||||||
from tornado import web
|
from tornado import web
|
||||||
from tornado.auth import OAuth2Mixin
|
|
||||||
from tornado.httpclient import AsyncHTTPClient
|
from tornado.httpclient import AsyncHTTPClient
|
||||||
from tornado.httpclient import HTTPRequest
|
from tornado.httpclient import HTTPRequest
|
||||||
from tornado.httputil import url_concat
|
from tornado.httputil import url_concat
|
||||||
|
@@ -4,7 +4,6 @@ import json
|
|||||||
import os
|
import os
|
||||||
|
|
||||||
from tornado import escape
|
from tornado import escape
|
||||||
from tornado import gen
|
|
||||||
from tornado import ioloop
|
from tornado import ioloop
|
||||||
from tornado import web
|
from tornado import web
|
||||||
|
|
||||||
|
@@ -1,6 +1,3 @@
|
|||||||
import os
|
|
||||||
import sys
|
|
||||||
|
|
||||||
c.JupyterHub.services = [
|
c.JupyterHub.services = [
|
||||||
{
|
{
|
||||||
'name': 'whoami',
|
'name': 'whoami',
|
||||||
|
@@ -1,4 +1,3 @@
|
|||||||
import os
|
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
c.JupyterHub.services = [
|
c.JupyterHub.services = [
|
||||||
|
@@ -6,7 +6,6 @@ showing the user their own info.
|
|||||||
"""
|
"""
|
||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
from getpass import getuser
|
|
||||||
from urllib.parse import urlparse
|
from urllib.parse import urlparse
|
||||||
|
|
||||||
from tornado.httpserver import HTTPServer
|
from tornado.httpserver import HTTPServer
|
||||||
@@ -25,6 +24,7 @@ class WhoAmIHandler(HubOAuthenticated, RequestHandler):
|
|||||||
# `getuser()` here would mean only the user who started the service
|
# `getuser()` here would mean only the user who started the service
|
||||||
# can access the service:
|
# can access the service:
|
||||||
|
|
||||||
|
# from getpass import getuser
|
||||||
# hub_users = {getuser()}
|
# hub_users = {getuser()}
|
||||||
|
|
||||||
@authenticated
|
@authenticated
|
||||||
|
@@ -4,7 +4,6 @@ This serves `/services/whoami/`, authenticated with the Hub, showing the user th
|
|||||||
"""
|
"""
|
||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
from getpass import getuser
|
|
||||||
from urllib.parse import urlparse
|
from urllib.parse import urlparse
|
||||||
|
|
||||||
from tornado.httpserver import HTTPServer
|
from tornado.httpserver import HTTPServer
|
||||||
@@ -21,6 +20,7 @@ class WhoAmIHandler(HubAuthenticated, RequestHandler):
|
|||||||
# `getuser()` here would mean only the user who started the service
|
# `getuser()` here would mean only the user who started the service
|
||||||
# can access the service:
|
# can access the service:
|
||||||
|
|
||||||
|
# from getpass import getuser
|
||||||
# hub_users = {getuser()}
|
# hub_users = {getuser()}
|
||||||
|
|
||||||
@authenticated
|
@authenticated
|
||||||
|
@@ -3,7 +3,6 @@
|
|||||||
# Distributed under the terms of the Modified BSD License.
|
# Distributed under the terms of the Modified BSD License.
|
||||||
import json
|
import json
|
||||||
|
|
||||||
from tornado import gen
|
|
||||||
from tornado import web
|
from tornado import web
|
||||||
|
|
||||||
from .. import orm
|
from .. import orm
|
||||||
|
@@ -2,12 +2,9 @@
|
|||||||
# 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
|
||||||
from urllib.parse import urlparse
|
|
||||||
|
|
||||||
from tornado import gen
|
|
||||||
from tornado import web
|
from tornado import web
|
||||||
|
|
||||||
from .. import orm
|
|
||||||
from ..utils import admin_only
|
from ..utils import admin_only
|
||||||
from .base import APIHandler
|
from .base import APIHandler
|
||||||
|
|
||||||
|
@@ -6,7 +6,6 @@ from concurrent.futures import ThreadPoolExecutor
|
|||||||
|
|
||||||
from traitlets import Any
|
from traitlets import Any
|
||||||
from traitlets import default
|
from traitlets import default
|
||||||
from traitlets import Dict
|
|
||||||
from traitlets import Integer
|
from traitlets import Integer
|
||||||
from traitlets import List
|
from traitlets import List
|
||||||
from traitlets import observe
|
from traitlets import observe
|
||||||
|
@@ -2,7 +2,6 @@
|
|||||||
# 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
|
||||||
import copy
|
|
||||||
import json
|
import json
|
||||||
import math
|
import math
|
||||||
import random
|
import random
|
||||||
@@ -27,14 +26,12 @@ from tornado.httputil import url_concat
|
|||||||
from tornado.ioloop import IOLoop
|
from tornado.ioloop import IOLoop
|
||||||
from tornado.log import app_log
|
from tornado.log import app_log
|
||||||
from tornado.web import addslash
|
from tornado.web import addslash
|
||||||
from tornado.web import MissingArgumentError
|
|
||||||
from tornado.web import RequestHandler
|
from tornado.web import RequestHandler
|
||||||
|
|
||||||
from .. import __version__
|
from .. import __version__
|
||||||
from .. import orm
|
from .. import orm
|
||||||
from ..metrics import PROXY_ADD_DURATION_SECONDS
|
from ..metrics import PROXY_ADD_DURATION_SECONDS
|
||||||
from ..metrics import PROXY_DELETE_DURATION_SECONDS
|
from ..metrics import PROXY_DELETE_DURATION_SECONDS
|
||||||
from ..metrics import ProxyAddStatus
|
|
||||||
from ..metrics import ProxyDeleteStatus
|
from ..metrics import ProxyDeleteStatus
|
||||||
from ..metrics import RUNNING_SERVERS
|
from ..metrics import RUNNING_SERVERS
|
||||||
from ..metrics import SERVER_POLL_DURATION_SECONDS
|
from ..metrics import SERVER_POLL_DURATION_SECONDS
|
||||||
|
@@ -1,7 +1,6 @@
|
|||||||
from prometheus_client import CONTENT_TYPE_LATEST
|
from prometheus_client import CONTENT_TYPE_LATEST
|
||||||
from prometheus_client import generate_latest
|
from prometheus_client import generate_latest
|
||||||
from prometheus_client import REGISTRY
|
from prometheus_client import REGISTRY
|
||||||
from tornado import gen
|
|
||||||
|
|
||||||
from ..utils import metrics_authentication
|
from ..utils import metrics_authentication
|
||||||
from .base import BaseHandler
|
from .base import BaseHandler
|
||||||
|
@@ -2,15 +2,12 @@
|
|||||||
# 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
|
||||||
import codecs
|
|
||||||
import copy
|
|
||||||
import time
|
import time
|
||||||
from collections import defaultdict
|
from collections import defaultdict
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from http.client import responses
|
from http.client import responses
|
||||||
|
|
||||||
from jinja2 import TemplateNotFound
|
from jinja2 import TemplateNotFound
|
||||||
from tornado import gen
|
|
||||||
from tornado import web
|
from tornado import web
|
||||||
from tornado.httputil import url_concat
|
from tornado.httputil import url_concat
|
||||||
|
|
||||||
@@ -464,7 +461,6 @@ class AdminHandler(BaseHandler):
|
|||||||
|
|
||||||
users = self.db.query(orm.User).outerjoin(orm.Spawner).order_by(*ordered)
|
users = self.db.query(orm.User).outerjoin(orm.Spawner).order_by(*ordered)
|
||||||
users = [self._user_from_orm(u) for u in users]
|
users = [self._user_from_orm(u) for u in users]
|
||||||
from itertools import chain
|
|
||||||
|
|
||||||
running = []
|
running = []
|
||||||
for u in users:
|
for u in users:
|
||||||
|
@@ -3,15 +3,12 @@
|
|||||||
implements https://oauthlib.readthedocs.io/en/latest/oauth2/server.html
|
implements https://oauthlib.readthedocs.io/en/latest/oauth2/server.html
|
||||||
"""
|
"""
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from urllib.parse import urlparse
|
|
||||||
|
|
||||||
from oauthlib import uri_validate
|
from oauthlib import uri_validate
|
||||||
from oauthlib.oauth2 import RequestValidator
|
from oauthlib.oauth2 import RequestValidator
|
||||||
from oauthlib.oauth2 import WebApplicationServer
|
from oauthlib.oauth2 import WebApplicationServer
|
||||||
from oauthlib.oauth2.rfc6749.grant_types import authorization_code
|
from oauthlib.oauth2.rfc6749.grant_types import authorization_code
|
||||||
from oauthlib.oauth2.rfc6749.grant_types import base
|
from oauthlib.oauth2.rfc6749.grant_types import base
|
||||||
from sqlalchemy.orm import scoped_session
|
|
||||||
from tornado import web
|
|
||||||
from tornado.escape import url_escape
|
from tornado.escape import url_escape
|
||||||
from tornado.log import app_log
|
from tornado.log import app_log
|
||||||
|
|
||||||
|
@@ -24,7 +24,6 @@ import time
|
|||||||
from functools import wraps
|
from functools import wraps
|
||||||
from subprocess import Popen
|
from subprocess import Popen
|
||||||
from urllib.parse import quote
|
from urllib.parse import quote
|
||||||
from urllib.parse import urlparse
|
|
||||||
|
|
||||||
from tornado import gen
|
from tornado import gen
|
||||||
from tornado.httpclient import AsyncHTTPClient
|
from tornado.httpclient import AsyncHTTPClient
|
||||||
|
@@ -4,8 +4,6 @@ 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
|
||||||
import asyncio
|
|
||||||
import errno
|
|
||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
import pipes
|
import pipes
|
||||||
|
@@ -1,5 +1,4 @@
|
|||||||
"""Tests for the REST API."""
|
"""Tests for the REST API."""
|
||||||
import asyncio
|
|
||||||
import json
|
import json
|
||||||
import re
|
import re
|
||||||
import sys
|
import sys
|
||||||
|
@@ -7,13 +7,11 @@ import time
|
|||||||
from subprocess import check_output
|
from subprocess import check_output
|
||||||
from subprocess import PIPE
|
from subprocess import PIPE
|
||||||
from subprocess import Popen
|
from subprocess import Popen
|
||||||
from subprocess import run
|
|
||||||
from tempfile import NamedTemporaryFile
|
from tempfile import NamedTemporaryFile
|
||||||
from tempfile import TemporaryDirectory
|
from tempfile import TemporaryDirectory
|
||||||
from unittest.mock import patch
|
from unittest.mock import patch
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
from tornado import gen
|
|
||||||
from traitlets.config import Config
|
from traitlets.config import Config
|
||||||
|
|
||||||
from .. import orm
|
from .. import orm
|
||||||
|
@@ -1,7 +1,6 @@
|
|||||||
"""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 os
|
|
||||||
from unittest import mock
|
from unittest import mock
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
@@ -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
|
||||||
"""
|
"""
|
||||||
import asyncio
|
|
||||||
from contextlib import contextmanager
|
from contextlib import contextmanager
|
||||||
from unittest import mock
|
from unittest import mock
|
||||||
from urllib.parse import parse_qs
|
from urllib.parse import parse_qs
|
||||||
|
@@ -1,8 +1,6 @@
|
|||||||
"""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.
|
||||||
import pytest
|
|
||||||
|
|
||||||
from jupyterhub.auth import DummyAuthenticator
|
from jupyterhub.auth import DummyAuthenticator
|
||||||
|
|
||||||
|
|
||||||
|
@@ -1,8 +1,6 @@
|
|||||||
"""Test the JupyterHub entry point with internal ssl"""
|
"""Test the JupyterHub entry point with internal ssl"""
|
||||||
# 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 jupyterhub.tests.mocking
|
import jupyterhub.tests.mocking
|
||||||
from jupyterhub.tests.test_app import *
|
from jupyterhub.tests.test_app import *
|
||||||
|
|
||||||
|
@@ -2,7 +2,6 @@
|
|||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
from contextlib import contextmanager
|
from contextlib import contextmanager
|
||||||
from queue import Queue
|
|
||||||
from subprocess import Popen
|
from subprocess import Popen
|
||||||
from urllib.parse import quote
|
from urllib.parse import quote
|
||||||
from urllib.parse import urlparse
|
from urllib.parse import urlparse
|
||||||
|
@@ -2,18 +2,13 @@
|
|||||||
import asyncio
|
import asyncio
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
import time
|
|
||||||
from binascii import hexlify
|
from binascii import hexlify
|
||||||
from contextlib import contextmanager
|
from contextlib import contextmanager
|
||||||
from subprocess import Popen
|
from subprocess import Popen
|
||||||
from threading import Event
|
|
||||||
|
|
||||||
import pytest
|
|
||||||
import requests
|
|
||||||
from async_generator import async_generator
|
from async_generator import async_generator
|
||||||
from async_generator import asynccontextmanager
|
from async_generator import asynccontextmanager
|
||||||
from async_generator import yield_
|
from async_generator import yield_
|
||||||
from tornado import gen
|
|
||||||
from tornado.ioloop import IOLoop
|
from tornado.ioloop import IOLoop
|
||||||
|
|
||||||
from ..utils import maybe_future
|
from ..utils import maybe_future
|
||||||
|
@@ -11,7 +11,6 @@ from threading import Thread
|
|||||||
from unittest import mock
|
from unittest import mock
|
||||||
from urllib.parse import urlparse
|
from urllib.parse import urlparse
|
||||||
|
|
||||||
import pytest
|
|
||||||
import requests
|
import requests
|
||||||
import requests_mock
|
import requests_mock
|
||||||
from pytest import raises
|
from pytest import raises
|
||||||
|
@@ -3,8 +3,6 @@ import sys
|
|||||||
from subprocess import check_output
|
from subprocess import check_output
|
||||||
from urllib.parse import urlparse
|
from urllib.parse import urlparse
|
||||||
|
|
||||||
import pytest
|
|
||||||
|
|
||||||
import jupyterhub
|
import jupyterhub
|
||||||
from ..utils import url_path_join
|
from ..utils import url_path_join
|
||||||
from .mocking import public_url
|
from .mocking import public_url
|
||||||
|
@@ -444,7 +444,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 asyncio
|
||||||
import resource
|
|
||||||
import traceback
|
import traceback
|
||||||
from .log import coroutine_frames
|
from .log import coroutine_frames
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user