1+ """Jupyter notebook application."""
12import os
23from os .path import join as pjoin
34
2930
3031
3132class NotebookBaseHandler (ExtensionHandlerJinjaMixin , ExtensionHandlerMixin , JupyterHandler ):
33+ """The base notebook API handler."""
34+
3235 def get_page_config (self ): # noqa:C901
36+ """Get the page config."""
3337 config = LabConfig ()
3438 app = self .extensionapp
3539 base_url = self .settings .get ("base_url" )
@@ -112,12 +116,17 @@ def get_page_config(self): # noqa:C901
112116
113117
114118class RedirectHandler (NotebookBaseHandler ):
119+ """A redirect handler."""
120+
115121 @web .authenticated
116122 def get (self ):
123+ """Get the redirect url."""
117124 return self .redirect (self .base_url + "tree" )
118125
119126
120127class TreeHandler (NotebookBaseHandler ):
128+ """A tree page handler."""
129+
121130 @web .authenticated
122131 async def get (self , path = None ):
123132 """
@@ -156,29 +165,41 @@ async def get(self, path=None):
156165
157166
158167class ConsoleHandler (NotebookBaseHandler ):
168+ """A console page handler."""
169+
159170 @web .authenticated
160171 def get (self , path = None ):
172+ """Get the console page."""
161173 tpl = self .render_template ("consoles.html" , page_config = self .get_page_config ())
162174 return self .write (tpl )
163175
164176
165177class TerminalHandler (NotebookBaseHandler ):
178+ """A terminal page handler."""
179+
166180 @web .authenticated
167181 def get (self , path = None ):
182+ """Get the terminal page."""
168183 tpl = self .render_template ("terminals.html" , page_config = self .get_page_config ())
169184 return self .write (tpl )
170185
171186
172187class FileHandler (NotebookBaseHandler ):
188+ """A file page handler."""
189+
173190 @web .authenticated
174191 def get (self , path = None ):
192+ """Get the file page."""
175193 tpl = self .render_template ("edit.html" , page_config = self .get_page_config ())
176194 return self .write (tpl )
177195
178196
179197class NotebookHandler (NotebookBaseHandler ):
198+ """A notebook page handler."""
199+
180200 @web .authenticated
181201 def get (self , path = None ):
202+ """Get the notebook page."""
182203 tpl = self .render_template ("notebooks.html" , page_config = self .get_page_config ())
183204 return self .write (tpl )
184205
@@ -187,6 +208,8 @@ def get(self, path=None):
187208
188209
189210class JupyterNotebookApp (NotebookConfigShimMixin , LabServerApp ):
211+ """The notebook server extension app."""
212+
190213 name = "notebook"
191214 app_name = "Jupyter Notebook"
192215 description = "Jupyter Notebook - A web-based notebook environment for interactive computing"
@@ -246,6 +269,7 @@ def _default_workspaces_dir(self):
246269 return get_workspaces_dir ()
247270
248271 def initialize_handlers (self ):
272+ """Initialize handlers."""
249273 self .handlers .append (
250274 (
251275 rf"/{ self .file_url_prefix } /((?!.*\.ipynb($|\?)).*)" ,
@@ -261,9 +285,6 @@ def initialize_handlers(self):
261285 self .handlers .append (("/terminals/(.*)" , TerminalHandler ))
262286 super ().initialize_handlers ()
263287
264- def initialize_settings (self ):
265- super ().initialize_settings ()
266-
267288 def initialize (self , argv = None ):
268289 """Subclass because the ExtensionApp.initialize() method does not take arguments"""
269290 super ().initialize ()
0 commit comments