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

Import ensure-sync directly from dependence. #1149

Merged
merged 1 commit into from
Dec 22, 2022
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion jupyter_server/files/handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
from base64 import decodebytes
from typing import List

from jupyter_core.utils import ensure_async
from tornado import web

from jupyter_server.auth import authorized
from jupyter_server.base.handlers import JupyterHandler
from jupyter_server.utils import ensure_async

AUTH_RESOURCE = "contents"

Expand Down
3 changes: 2 additions & 1 deletion jupyter_server/gateway/managers.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,15 @@
from jupyter_client.kernelspec import KernelSpecManager
from jupyter_client.manager import AsyncKernelManager
from jupyter_client.managerabc import KernelManagerABC
from jupyter_core.utils import ensure_async
from tornado import web
from tornado.escape import json_decode, json_encode, url_escape, utf8
from traitlets import DottedObjectName, Instance, Type, default

from .._tz import UTC
from ..services.kernels.kernelmanager import AsyncMappingKernelManager
from ..services.sessions.sessionmanager import SessionManager
from ..utils import ensure_async, url_path_join
from ..utils import url_path_join
from .gateway_client import GatewayClient, gateway_request


Expand Down
2 changes: 1 addition & 1 deletion jupyter_server/nbconvert/handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@
import zipfile

from anyio.to_thread import run_sync
from jupyter_core.utils import ensure_async
from nbformat import from_dict
from tornado import web
from tornado.log import app_log

from jupyter_server.auth import authorized
from jupyter_server.utils import ensure_async

from ..base.handlers import FilesRedirectHandler, JupyterHandler, path_regex

Expand Down
3 changes: 2 additions & 1 deletion jupyter_server/serverapp.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,9 +124,10 @@

from jinja2 import Environment, FileSystemLoader
from jupyter_core.paths import secure_write
from jupyter_core.utils import ensure_async

from jupyter_server.transutils import _i18n, trans
from jupyter_server.utils import ensure_async, pathname2url, urljoin
from jupyter_server.utils import pathname2url, urljoin

# the minimum viable tornado version: needs to be kept in sync with setup.py
MIN_TORNADO = (6, 1, 0)
Expand Down
2 changes: 1 addition & 1 deletion jupyter_server/services/api/handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
import os
from typing import Dict, List

from jupyter_core.utils import ensure_async
from tornado import web

from jupyter_server._tz import isoformat, utcfromtimestamp
from jupyter_server.auth import authorized
from jupyter_server.utils import ensure_async

from ...base.handlers import APIHandler, JupyterHandler

Expand Down
3 changes: 2 additions & 1 deletion jupyter_server/services/contents/handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,12 @@
except ImportError:
from jupyter_client.jsonutil import date_default as json_default

from jupyter_core.utils import ensure_async
from tornado import web

from jupyter_server.auth import authorized
from jupyter_server.base.handlers import APIHandler, JupyterHandler, path_regex
from jupyter_server.utils import ensure_async, url_escape, url_path_join
from jupyter_server.utils import url_escape, url_path_join

AUTH_RESOURCE = "contents"

Expand Down
3 changes: 2 additions & 1 deletion jupyter_server/services/contents/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import warnings
from fnmatch import fnmatch

from jupyter_core.utils import ensure_async
from jupyter_events import EventLogger
from nbformat import ValidationError, sign
from nbformat import validate as validate_nb
Expand All @@ -17,7 +18,7 @@

from jupyter_server import DEFAULT_EVENTS_SCHEMA_PATH, JUPYTER_SERVER_EVENTS_URI
from jupyter_server.transutils import _i18n
from jupyter_server.utils import ensure_async, import_item
from jupyter_server.utils import import_item

from ...files.handlers import FilesHandler
from .checkpoints import AsyncCheckpoints, Checkpoints
Expand Down
2 changes: 1 addition & 1 deletion jupyter_server/services/kernels/connection/channels.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
except ImportError:
from jupyter_client.jsonutil import date_default as json_default

from jupyter_client.utils import ensure_async
from jupyter_core.utils import ensure_async

from jupyter_server.transutils import _i18n

Expand Down
3 changes: 2 additions & 1 deletion jupyter_server/services/kernels/handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,11 @@
except ImportError:
from jupyter_client.jsonutil import date_default as json_default

from jupyter_core.utils import ensure_async
from tornado import web

from jupyter_server.auth import authorized
from jupyter_server.utils import ensure_async, url_escape, url_path_join
from jupyter_server.utils import url_escape, url_path_join

from ...base.handlers import APIHandler

Expand Down
3 changes: 2 additions & 1 deletion jupyter_server/services/kernels/kernelmanager.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
from jupyter_client.multikernelmanager import AsyncMultiKernelManager, MultiKernelManager
from jupyter_client.session import Session
from jupyter_core.paths import exists
from jupyter_core.utils import ensure_async
from tornado import web
from tornado.concurrent import Future
from tornado.ioloop import IOLoop, PeriodicCallback
Expand All @@ -35,7 +36,7 @@

from jupyter_server._tz import isoformat, utcnow
from jupyter_server.prometheus.metrics import KERNEL_CURRENTLY_RUNNING_TOTAL
from jupyter_server.utils import ensure_async, import_item, to_os_path
from jupyter_server.utils import import_item, to_os_path


class MappingKernelManager(MultiKernelManager):
Expand Down
3 changes: 2 additions & 1 deletion jupyter_server/services/kernelspecs/handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,13 @@

pjoin = os.path.join

from jupyter_core.utils import ensure_async
from tornado import web

from jupyter_server.auth import authorized

from ...base.handlers import APIHandler
from ...utils import ensure_async, url_path_join, url_unescape
from ...utils import url_path_join, url_unescape

AUTH_RESOURCE = "kernelspecs"

Expand Down
3 changes: 2 additions & 1 deletion jupyter_server/services/sessions/handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,11 @@
from jupyter_client.jsonutil import date_default as json_default

from jupyter_client.kernelspec import NoSuchKernel
from jupyter_core.utils import ensure_async
from tornado import web

from jupyter_server.auth import authorized
from jupyter_server.utils import ensure_async, url_path_join
from jupyter_server.utils import url_path_join

from ...base.handlers import APIHandler

Expand Down
2 changes: 1 addition & 1 deletion jupyter_server/services/sessions/sessionmanager.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@
from dataclasses import dataclass, fields
from typing import Union

from jupyter_core.utils import ensure_async
from tornado import web
from traitlets import Instance, TraitError, Unicode, validate
from traitlets.config.configurable import LoggingConfigurable

from jupyter_server.traittypes import InstanceFromClasses
from jupyter_server.utils import ensure_async


class KernelSessionRecordConflict(Exception):
Expand Down
3 changes: 2 additions & 1 deletion jupyter_server/view/handlers.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
"""Tornado handlers for viewing HTML files."""
# Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License.
from jupyter_core.utils import ensure_async
from tornado import web

from jupyter_server.auth import authorized

from ..base.handlers import JupyterHandler, path_regex
from ..utils import ensure_async, url_escape, url_path_join
from ..utils import url_escape, url_path_join

AUTH_RESOURCE = "contents"

Expand Down
2 changes: 1 addition & 1 deletion tests/services/contents/test_checkpoints.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import pytest
from jupyter_client.utils import ensure_async
from jupyter_core.utils import ensure_async
from nbformat import from_dict
from nbformat.v4 import new_markdown_cell

Expand Down
2 changes: 1 addition & 1 deletion tests/services/contents/test_largefilemanager.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import pytest
import tornado
from jupyter_core.utils import ensure_async

from jupyter_server.services.contents.largefilemanager import (
AsyncLargeFileManager,
LargeFileManager,
)
from jupyter_server.utils import ensure_async

from ...utils import expected_http_error

Expand Down
2 changes: 1 addition & 1 deletion tests/services/contents/test_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from unittest.mock import patch

import pytest
from jupyter_core.utils import ensure_async
from nbformat import ValidationError
from nbformat import v4 as nbformat
from tornado.web import HTTPError
Expand All @@ -15,7 +16,6 @@
AsyncFileContentsManager,
FileContentsManager,
)
from jupyter_server.utils import ensure_async

from ...utils import expected_http_error

Expand Down
2 changes: 1 addition & 1 deletion tests/test_gateway.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@

import pytest
import tornado
from jupyter_core.utils import ensure_async
from tornado.httpclient import HTTPRequest, HTTPResponse
from tornado.web import HTTPError
from traitlets import Int, Unicode
from traitlets.config import Config

from jupyter_server.gateway.gateway_client import GatewayTokenRenewerBase, NoOpTokenRenewer
from jupyter_server.gateway.managers import ChannelQueue, GatewayClient, GatewayKernelManager
from jupyter_server.utils import ensure_async

from .utils import expected_http_error

Expand Down