Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 2a3d35b

Browse files
committedNov 4, 2024·
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent 4046444 commit 2a3d35b

File tree

4 files changed

+10
-13
lines changed

4 files changed

+10
-13
lines changed
 

‎jupyter_server/base/handlers.py

+1-5
Original file line numberDiff line numberDiff line change
@@ -1194,11 +1194,7 @@ class ExtensionAppsHandler(JupyterHandler):
11941194
@allow_unauthenticated
11951195
def get(self) -> None:
11961196
self.set_header("Content-Type", "application/json")
1197-
self.finish(
1198-
json.dumps(
1199-
self.serverapp.extension_manager.extension_web_apps()
1200-
)
1201-
)
1197+
self.finish(json.dumps(self.serverapp.extension_manager.extension_web_apps()))
12021198

12031199

12041200
# -----------------------------------------------------------------------------

‎jupyter_server/extension/manager.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
from __future__ import annotations
44

55
import importlib
6-
from itertools import starmap
76
import re
7+
from itertools import starmap
88

99
from tornado.gen import multi
1010
from traitlets import Any, Bool, Dict, HasTraits, Instance, List, Unicode, default, observe
@@ -14,8 +14,7 @@
1414
from .config import ExtensionConfigManager
1515
from .utils import ExtensionMetadataError, ExtensionModuleNotFound, get_loader, get_metadata
1616

17-
18-
RE_SLASH = x = re.compile('/+') # match any number of slashes
17+
RE_SLASH = x = re.compile("/+") # match any number of slashes
1918

2019

2120
class ExtensionPoint(HasTraits):
@@ -306,11 +305,12 @@ def extension_web_apps(self):
306305
extensions which provide a default_url (i.e. a web application).
307306
"""
308307
return {
309-
app.name: RE_SLASH.sub('/', f'{self.serverapp.base_url}/{app.default_url}')
308+
app.name: RE_SLASH.sub("/", f"{self.serverapp.base_url}/{app.default_url}")
310309
for extension_apps in self.serverapp.extension_manager.extension_apps.values()
311310
# filter out extensions that do not provide a default_url OR
312311
# set it to the root endpoint.
313-
for app in extension_apps if getattr(app, 'default_url', '/') != '/'
312+
for app in extension_apps
313+
if getattr(app, "default_url", "/") != "/"
314314
}
315315

316316
@property

‎tests/extension/mockextensions/app.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ class MockExtensionApp(ExtensionAppJinjaMixin, ExtensionApp):
5050
static_paths = [STATIC_PATH] # type:ignore[assignment]
5151
mock_trait = Unicode("mock trait", config=True)
5252
loaded = False
53-
default_url = '/mockextension'
53+
default_url = "/mockextension"
5454

5555
serverapp_config = {"jpserver_extensions": {"tests.extension.mockextensions.mock1": True}}
5656

‎tests/extension/test_app.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -198,10 +198,11 @@ async def test_extension_web_apps(jp_serverapp):
198198

199199
# there should be (at least) two extension applications
200200
assert set(jp_serverapp.extension_manager.extension_apps) == {
201-
'tests.extension.mockextensions', 'jupyter_server_terminals'
201+
"tests.extension.mockextensions",
202+
"jupyter_server_terminals",
202203
}
203204

204205
# but only one extension web application
205206
assert jp_serverapp.extension_manager.extension_web_apps == {
206-
'mockextension': '/a%40b/mockextension'
207+
"mockextension": "/a%40b/mockextension"
207208
}

0 commit comments

Comments
 (0)
Please sign in to comment.