Skip to content

Commit 5e9c1a1

Browse files
committed
refactor: rename to app from nbapp (NotebookApp, ServerApp)
1 parent 622ccba commit 5e9c1a1

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

nbgitpuller/__init__.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,20 @@ def _jupyter_server_extension_points():
2020
}]
2121

2222

23-
def _load_jupyter_server_extension(nbapp):
23+
def _load_jupyter_server_extension(app):
2424
"""
2525
This function is a hook for `notebook` and `jupyter_server` that we use to
2626
register additional endpoints to be handled by nbgitpuller.
2727
28+
Note that as this function is used as a hook for both notebook and
29+
jupyter_server, the argument passed may be a NotebookApp or a ServerApp.
30+
2831
Related documentation:
2932
- notebook: https://jupyter-notebook.readthedocs.io/en/stable/extending/handlers.htmland
3033
- notebook: https://jupyter-notebook.readthedocs.io/en/stable/examples/Notebook/Distributing%20Jupyter%20Extensions%20as%20Python%20Packages.html#Example---Server-extension
3134
- jupyter_server: https://jupyter-server.readthedocs.io/en/latest/developers/extensions.html
3235
"""
33-
web_app = nbapp.web_app
36+
web_app = app.web_app
3437
base_url = url_path_join(web_app.settings['base_url'], 'git-pull')
3538
handlers = [
3639
(url_path_join(base_url, 'api'), SyncHandler),
@@ -43,7 +46,7 @@ def _load_jupyter_server_extension(nbapp):
4346
{'path': os.path.join(os.path.dirname(__file__), 'static')}
4447
)
4548
]
46-
web_app.settings['nbapp'] = nbapp
49+
web_app.settings['app'] = app
4750
web_app.add_handlers('.*', handlers)
4851

4952

nbgitpuller/handlers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ async def get(self):
7171
self.set_header('content-type', 'text/event-stream')
7272
self.set_header('cache-control', 'no-cache')
7373

74-
gp = GitPuller(repo, repo_dir, branch=branch, depth=depth, parent=self.settings['nbapp'])
74+
gp = GitPuller(repo, repo_dir, branch=branch, depth=depth, parent=self.settings['app'])
7575

7676
q = Queue()
7777

0 commit comments

Comments
 (0)