Skip to content

Commit 7e26967

Browse files
authored
Import ensure-sync directly from dependence. (#1149)
1 parent 2cc810a commit 7e26967

File tree

18 files changed

+27
-18
lines changed

18 files changed

+27
-18
lines changed

jupyter_server/files/handlers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@
55
from base64 import decodebytes
66
from typing import List
77

8+
from jupyter_core.utils import ensure_async
89
from tornado import web
910

1011
from jupyter_server.auth import authorized
1112
from jupyter_server.base.handlers import JupyterHandler
12-
from jupyter_server.utils import ensure_async
1313

1414
AUTH_RESOURCE = "contents"
1515

jupyter_server/gateway/managers.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,15 @@
1616
from jupyter_client.kernelspec import KernelSpecManager
1717
from jupyter_client.manager import AsyncKernelManager
1818
from jupyter_client.managerabc import KernelManagerABC
19+
from jupyter_core.utils import ensure_async
1920
from tornado import web
2021
from tornado.escape import json_decode, json_encode, url_escape, utf8
2122
from traitlets import DottedObjectName, Instance, Type, default
2223

2324
from .._tz import UTC
2425
from ..services.kernels.kernelmanager import AsyncMappingKernelManager
2526
from ..services.sessions.sessionmanager import SessionManager
26-
from ..utils import ensure_async, url_path_join
27+
from ..utils import url_path_join
2728
from .gateway_client import GatewayClient, gateway_request
2829

2930

jupyter_server/nbconvert/handlers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@
77
import zipfile
88

99
from anyio.to_thread import run_sync
10+
from jupyter_core.utils import ensure_async
1011
from nbformat import from_dict
1112
from tornado import web
1213
from tornado.log import app_log
1314

1415
from jupyter_server.auth import authorized
15-
from jupyter_server.utils import ensure_async
1616

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

jupyter_server/serverapp.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,9 +124,10 @@
124124

125125
from jinja2 import Environment, FileSystemLoader
126126
from jupyter_core.paths import secure_write
127+
from jupyter_core.utils import ensure_async
127128

128129
from jupyter_server.transutils import _i18n, trans
129-
from jupyter_server.utils import ensure_async, pathname2url, urljoin
130+
from jupyter_server.utils import pathname2url, urljoin
130131

131132
# the minimum viable tornado version: needs to be kept in sync with setup.py
132133
MIN_TORNADO = (6, 1, 0)

jupyter_server/services/api/handlers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@
55
import os
66
from typing import Dict, List
77

8+
from jupyter_core.utils import ensure_async
89
from tornado import web
910

1011
from jupyter_server._tz import isoformat, utcfromtimestamp
1112
from jupyter_server.auth import authorized
12-
from jupyter_server.utils import ensure_async
1313

1414
from ...base.handlers import APIHandler, JupyterHandler
1515

jupyter_server/services/contents/handlers.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,12 @@
1111
except ImportError:
1212
from jupyter_client.jsonutil import date_default as json_default
1313

14+
from jupyter_core.utils import ensure_async
1415
from tornado import web
1516

1617
from jupyter_server.auth import authorized
1718
from jupyter_server.base.handlers import APIHandler, JupyterHandler, path_regex
18-
from jupyter_server.utils import ensure_async, url_escape, url_path_join
19+
from jupyter_server.utils import url_escape, url_path_join
1920

2021
AUTH_RESOURCE = "contents"
2122

jupyter_server/services/contents/manager.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import warnings
88
from fnmatch import fnmatch
99

10+
from jupyter_core.utils import ensure_async
1011
from jupyter_events import EventLogger
1112
from nbformat import ValidationError, sign
1213
from nbformat import validate as validate_nb
@@ -17,7 +18,7 @@
1718

1819
from jupyter_server import DEFAULT_EVENTS_SCHEMA_PATH, JUPYTER_SERVER_EVENTS_URI
1920
from jupyter_server.transutils import _i18n
20-
from jupyter_server.utils import ensure_async, import_item
21+
from jupyter_server.utils import import_item
2122

2223
from ...files.handlers import FilesHandler
2324
from .checkpoints import AsyncCheckpoints, Checkpoints

jupyter_server/services/kernels/connection/channels.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
except ImportError:
1919
from jupyter_client.jsonutil import date_default as json_default
2020

21-
from jupyter_client.utils import ensure_async
21+
from jupyter_core.utils import ensure_async
2222

2323
from jupyter_server.transutils import _i18n
2424

jupyter_server/services/kernels/handlers.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,11 @@
1212
except ImportError:
1313
from jupyter_client.jsonutil import date_default as json_default
1414

15+
from jupyter_core.utils import ensure_async
1516
from tornado import web
1617

1718
from jupyter_server.auth import authorized
18-
from jupyter_server.utils import ensure_async, url_escape, url_path_join
19+
from jupyter_server.utils import url_escape, url_path_join
1920

2021
from ...base.handlers import APIHandler
2122

jupyter_server/services/kernels/kernelmanager.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
from jupyter_client.multikernelmanager import AsyncMultiKernelManager, MultiKernelManager
1717
from jupyter_client.session import Session
1818
from jupyter_core.paths import exists
19+
from jupyter_core.utils import ensure_async
1920
from tornado import web
2021
from tornado.concurrent import Future
2122
from tornado.ioloop import IOLoop, PeriodicCallback
@@ -35,7 +36,7 @@
3536

3637
from jupyter_server._tz import isoformat, utcnow
3738
from jupyter_server.prometheus.metrics import KERNEL_CURRENTLY_RUNNING_TOTAL
38-
from jupyter_server.utils import ensure_async, import_item, to_os_path
39+
from jupyter_server.utils import import_item, to_os_path
3940

4041

4142
class MappingKernelManager(MultiKernelManager):

jupyter_server/services/kernelspecs/handlers.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,13 @@
1010

1111
pjoin = os.path.join
1212

13+
from jupyter_core.utils import ensure_async
1314
from tornado import web
1415

1516
from jupyter_server.auth import authorized
1617

1718
from ...base.handlers import APIHandler
18-
from ...utils import ensure_async, url_path_join, url_unescape
19+
from ...utils import url_path_join, url_unescape
1920

2021
AUTH_RESOURCE = "kernelspecs"
2122

jupyter_server/services/sessions/handlers.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,11 @@
1313
from jupyter_client.jsonutil import date_default as json_default
1414

1515
from jupyter_client.kernelspec import NoSuchKernel
16+
from jupyter_core.utils import ensure_async
1617
from tornado import web
1718

1819
from jupyter_server.auth import authorized
19-
from jupyter_server.utils import ensure_async, url_path_join
20+
from jupyter_server.utils import url_path_join
2021

2122
from ...base.handlers import APIHandler
2223

jupyter_server/services/sessions/sessionmanager.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@
1414
from dataclasses import dataclass, fields
1515
from typing import Union
1616

17+
from jupyter_core.utils import ensure_async
1718
from tornado import web
1819
from traitlets import Instance, TraitError, Unicode, validate
1920
from traitlets.config.configurable import LoggingConfigurable
2021

2122
from jupyter_server.traittypes import InstanceFromClasses
22-
from jupyter_server.utils import ensure_async
2323

2424

2525
class KernelSessionRecordConflict(Exception):

jupyter_server/view/handlers.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
"""Tornado handlers for viewing HTML files."""
22
# Copyright (c) Jupyter Development Team.
33
# Distributed under the terms of the Modified BSD License.
4+
from jupyter_core.utils import ensure_async
45
from tornado import web
56

67
from jupyter_server.auth import authorized
78

89
from ..base.handlers import JupyterHandler, path_regex
9-
from ..utils import ensure_async, url_escape, url_path_join
10+
from ..utils import url_escape, url_path_join
1011

1112
AUTH_RESOURCE = "contents"
1213

tests/services/contents/test_checkpoints.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import pytest
2-
from jupyter_client.utils import ensure_async
2+
from jupyter_core.utils import ensure_async
33
from nbformat import from_dict
44
from nbformat.v4 import new_markdown_cell
55

tests/services/contents/test_largefilemanager.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import pytest
22
import tornado
3+
from jupyter_core.utils import ensure_async
34

45
from jupyter_server.services.contents.largefilemanager import (
56
AsyncLargeFileManager,
67
LargeFileManager,
78
)
8-
from jupyter_server.utils import ensure_async
99

1010
from ...utils import expected_http_error
1111

tests/services/contents/test_manager.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
from unittest.mock import patch
77

88
import pytest
9+
from jupyter_core.utils import ensure_async
910
from nbformat import ValidationError
1011
from nbformat import v4 as nbformat
1112
from tornado.web import HTTPError
@@ -15,7 +16,6 @@
1516
AsyncFileContentsManager,
1617
FileContentsManager,
1718
)
18-
from jupyter_server.utils import ensure_async
1919

2020
from ...utils import expected_http_error
2121

tests/test_gateway.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,14 @@
1414

1515
import pytest
1616
import tornado
17+
from jupyter_core.utils import ensure_async
1718
from tornado.httpclient import HTTPRequest, HTTPResponse
1819
from tornado.web import HTTPError
1920
from traitlets import Int, Unicode
2021
from traitlets.config import Config
2122

2223
from jupyter_server.gateway.gateway_client import GatewayTokenRenewerBase, NoOpTokenRenewer
2324
from jupyter_server.gateway.managers import ChannelQueue, GatewayClient, GatewayKernelManager
24-
from jupyter_server.utils import ensure_async
2525

2626
from .utils import expected_http_error
2727

0 commit comments

Comments
 (0)