Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleanup unused imports #165

Merged
merged 1 commit into from
Feb 23, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 2 additions & 7 deletions jupyterlab_server/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,11 @@
# Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License.

import os, jinja2
from traitlets import Unicode
from jinja2 import Environment, FileSystemLoader
from traitlets import Bool, Unicode, default, observe
from jupyter_server.extension.application import ExtensionApp, ExtensionAppJinjaMixin
from traitlets import Unicode, Integer, Dict
from traitlets import Dict, Integer, Unicode, observe

from ._version import __version__
from .server import url_path_join as ujoin
from .handlers import add_handlers, LabConfig
from .handlers import LabConfig, add_handlers


class LabServerApp(ExtensionAppJinjaMixin, LabConfig, ExtensionApp):
Expand Down
8 changes: 3 additions & 5 deletions jupyterlab_server/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,18 @@
# Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License.

import json
import os.path as osp
from glob import iglob
from itertools import chain
import json
from os.path import join as pjoin
import os.path as osp
import os

from jupyter_core.paths import jupyter_path, jupyter_config_dir, SYSTEM_CONFIG_PATH
from jupyter_core.paths import SYSTEM_CONFIG_PATH, jupyter_config_dir, jupyter_path
from jupyter_server.services.config.manager import ConfigManager, recursive_update
from traitlets import Bool, HasTraits, List, Unicode, default

from .server import url_path_join as ujoin


# -----------------------------------------------------------------------------
# Module globals
# -----------------------------------------------------------------------------
Expand Down
5 changes: 0 additions & 5 deletions jupyterlab_server/handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,10 @@

# Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License.
from glob import glob
import json
import os
import os.path as osp
from urllib.parse import urlparse

from jinja2 import FileSystemLoader, TemplateError
from tornado import template, web
from traitlets import Bool, HasTraits, List, Unicode, default

from jupyter_server.extension.handler import ExtensionHandlerMixin, ExtensionHandlerJinjaMixin

Expand Down
13 changes: 3 additions & 10 deletions jupyterlab_server/listings_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,12 @@
# Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License.

import os
import time
import json
import re
import tornado

from .server import APIHandler

from traitlets import Instance


import requests
import tornado

from .server import APIHandler

LISTINGS_URL_SUFFIX='@jupyterlab/extensionmanager-extension/listings.json'

Expand Down Expand Up @@ -55,7 +48,7 @@ class ListingsHandler(APIHandler):

"""Below fields are class level fields that are accessed and populated
by the initialization and the fetch_listings methods.
Some fields are initialized before the handler creation in the
Some fields are initialized before the handler creation in the
handlers.py#add_handlers method.
Having those fields predefined reduces the guards in the methods using
them.
Expand Down
9 changes: 2 additions & 7 deletions jupyterlab_server/process_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,12 @@
"""A lab app that runs a sub process for a demo or a test."""
import sys

from jupyter_server.extension.application import ExtensionApp, ExtensionAppJinjaMixin
from tornado.ioloop import IOLoop
from traitlets import Bool

from .server import ServerApp
from .handlers import add_handlers, LabConfig
from .handlers import LabConfig, add_handlers
from .process import Process

from traitlets import Unicode

from jupyter_server.extension.application import ExtensionApp, ExtensionAppJinjaMixin


class ProcessApp(ExtensionAppJinjaMixin, LabConfig, ExtensionApp):
"""A jupyterlab app that runs a separate process and exits on completion."""
Expand Down
10 changes: 4 additions & 6 deletions jupyterlab_server/pytest_plugin.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
import pytest, shutil, os
import json
import os
import os.path as osp
import shutil
from os.path import join as pjoin

from jupyterlab_server import LabServerApp, LabConfig
import pytest

from traitlets import Unicode

from jupyterlab_server.tests.utils import here
from jupyterlab_server import LabServerApp
from jupyterlab_server.app import LabServerApp


pytest_plugins = [
"jupyter_server.pytest_plugin"
]
Expand Down
12 changes: 5 additions & 7 deletions jupyterlab_server/settings_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,16 @@
# Distributed under the terms of the Modified BSD License.
import json
import os

from glob import glob

import json5
from jsonschema import ValidationError
from jsonschema import Draft4Validator as Validator
from tornado import web

from jupyter_server.extension.handler import ExtensionHandlerMixin, ExtensionHandlerJinjaMixin
from jsonschema import ValidationError
from jupyter_server.extension.handler import ExtensionHandlerJinjaMixin, ExtensionHandlerMixin
from jupyter_server.services.config.manager import ConfigManager, recursive_update
from tornado import web

from .server import APIHandler, json_errors, tz

from .server import APIHandler, tz

# The JupyterLab settings file extension.
SETTINGS_EXTENSION = '.jupyterlab-settings'
Expand Down
9 changes: 5 additions & 4 deletions jupyterlab_server/themes_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@
# Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License.

from glob import glob
from os import path as osp
import os
import re
from glob import glob
from os import path as osp
from urllib.parse import urlparse

from .server import FileFindHandler, url_path_join as ujoin
from .server import FileFindHandler
from .server import url_path_join as ujoin


class ThemesHandler(FileFindHandler):
Expand All @@ -24,7 +25,7 @@ def initialize(self, path, default_filename=None,
for ext_dir in labextensions_path:
theme_pattern = ext_dir + '/**/themes'
ext_paths.extend([path for path in glob(theme_pattern, recursive=True)])

# Add the core theme path last
if not isinstance(path, list):
path = [path]
Expand Down
4 changes: 2 additions & 2 deletions jupyterlab_server/translation_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
"""

import gettext
import json
import importlib
import json
import os
import subprocess
import sys
Expand Down Expand Up @@ -621,7 +621,7 @@ def load(cls, domain: str) -> TranslationBundle:
----------
domain: str
The translations domain. The normalized python package name.

Returns
-------
Translator
Expand Down
5 changes: 2 additions & 3 deletions jupyterlab_server/translations_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,15 @@
"""

import json
import os
import traceback

import tornado
from tornado import gen, web
from tornado import gen

from .server import APIHandler
from .settings_handler import get_settings
from .translation_utils import get_language_pack, get_language_packs, is_valid_locale, translator

from .server import APIHandler, url_path_join

SCHEMA_NAME = '@jupyterlab/translation-extension:plugin'

Expand Down
8 changes: 4 additions & 4 deletions jupyterlab_server/workspaces_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@
import re
import unicodedata
import urllib
from datetime import datetime
from tornado import web

from .server import APIHandler, json_errors, url_path_join as ujoin, tz
from jupyter_server.extension.handler import ExtensionHandlerJinjaMixin, ExtensionHandlerMixin
from tornado import web

from jupyter_server.extension.handler import ExtensionHandlerMixin, ExtensionHandlerJinjaMixin
from .server import APIHandler, tz
from .server import url_path_join as ujoin

# The JupyterLab workspace file extension.
WORKSPACE_EXTENSION = '.jupyterlab-workspace'
Expand Down