Skip to content
This repository was archived by the owner on Sep 10, 2025. It is now read-only.

Commit d8e89fb

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent dc586b8 commit d8e89fb

File tree

6 files changed

+11
-21
lines changed

6 files changed

+11
-21
lines changed

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ jupyter server extension list
4545
pip install -e .
4646
```
4747

48-
4948
You can watch the source directory and run your Jupyter Server-based application at the same time in different terminals to watch for changes in the extension's source and automatically rebuild the extension. For example,
5049
when running JupyterLab:
5150

conftest.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
pytest_plugins = ["jupyter_server.pytest_plugin"]
44

5+
56
@pytest.fixture
67
def jp_server_config(jp_server_config):
7-
return {"ServerApp": {"jpserver_extensions": {"message_replay": True}}}
8+
return {"ServerApp": {"jpserver_extensions": {"message_replay": True}}}

message_replay/__init__.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
"""Restore Notebook execution progress when a browser page is reloaded"""
22
from .extension import Extension
3+
34
__version__ = "0.1.0"
45

56

67
def _jupyter_server_extension_points():
7-
return [{
8-
"module": "message_replay",
9-
"app": Extension
10-
}]
8+
return [{"module": "message_replay", "app": Extension}]

message_replay/extension.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,17 @@
1+
from jupyter_server.extension.application import ExtensionApp
12
from traitlets import Unicode
23

3-
from jupyter_server.extension.application import ExtensionApp
44
from .handlers import PingHandler
55

66

77
class Extension(ExtensionApp):
88

99
name = "message_replay"
10-
handlers = [
11-
("message-replay/ping", PingHandler)
12-
]
10+
handlers = [("message-replay/ping", PingHandler)]
1311

1412
# Example of a configurable trait. This is meant to be replaced
1513
# with configurable traits for this extension.
1614
ping_response = Unicode(default_value="pong").tag(config=True)
1715

1816
def initialize_settings(self):
19-
self.settings.update({
20-
"ping_response": self.ping_response
21-
})
17+
self.settings.update({"ping_response": self.ping_response})

message_replay/handlers.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import json
22

3-
from jupyter_server.extension.handler import ExtensionHandlerMixin
4-
from jupyter_server.base.handlers import APIHandler
53
import tornado
4+
from jupyter_server.base.handlers import APIHandler
5+
from jupyter_server.extension.handler import ExtensionHandlerMixin
66

77

88
class PingHandler(ExtensionHandlerMixin, APIHandler):
@@ -15,6 +15,4 @@ def ping_response(self):
1515

1616
@tornado.web.authenticated
1717
def get(self):
18-
self.finish(json.dumps({
19-
"ping_response": self.ping_response
20-
}))
18+
self.finish(json.dumps({"ping_response": self.ping_response}))

message_replay/tests/test_handlers.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,4 @@ async def test_get(jp_fetch):
66

77
assert response.code == 200
88
payload = json.loads(response.body)
9-
assert payload == {
10-
"ping_response": "pong"
11-
}
9+
assert payload == {"ping_response": "pong"}

0 commit comments

Comments
 (0)