@@ -292,20 +292,16 @@ def _prepare_templates(self):
292
292
self .initialize_templates ()
293
293
294
294
@classmethod
295
- def initialize_server (cls , argv = [], load_other_extensions = True , ** kwargs ):
296
- """Creates an instance of ServerApp where this extension is enabled
297
- (superceding disabling found in other config from files).
298
-
299
- This is necessary when launching the ExtensionApp directly from
300
- the `launch_instance` classmethod.
301
- """
302
- # The ExtensionApp needs to add itself as enabled extension
303
- # to the jpserver_extensions trait, so that the ServerApp
304
- # initializes it.
305
- config = Config (cls ._jupyter_server_config ())
306
- serverapp = ServerApp .instance (** kwargs , argv = [], config = config )
307
- serverapp .initialize (argv = argv , find_extensions = load_other_extensions )
308
- return serverapp
295
+ def _jupyter_server_config (cls ):
296
+ base_config = {
297
+ "ServerApp" : {
298
+ "jpserver_extensions" : {cls .get_extension_package (): True },
299
+ "open_browser" : True ,
300
+ "default_url" : cls .extension_url
301
+ }
302
+ }
303
+ base_config ["ServerApp" ].update (cls .server_config )
304
+ return base_config
309
305
310
306
def _link_jupyter_server_extension (self , serverapp ):
311
307
"""Link the ExtensionApp to an initialized ServerApp.
@@ -335,6 +331,22 @@ def _link_jupyter_server_extension(self, serverapp):
335
331
# i.e. ServerApp traits <--- ExtensionApp config
336
332
self .serverapp .update_config (self .config )
337
333
334
+ @classmethod
335
+ def initialize_server (cls , argv = [], load_other_extensions = True , ** kwargs ):
336
+ """Creates an instance of ServerApp where this extension is enabled
337
+ (superceding disabling found in other config from files).
338
+
339
+ This is necessary when launching the ExtensionApp directly from
340
+ the `launch_instance` classmethod.
341
+ """
342
+ # The ExtensionApp needs to add itself as enabled extension
343
+ # to the jpserver_extensions trait, so that the ServerApp
344
+ # initializes it.
345
+ config = Config (cls ._jupyter_server_config ())
346
+ serverapp = ServerApp .instance (** kwargs , argv = [], config = config )
347
+ serverapp .initialize (argv = argv , find_extensions = load_other_extensions )
348
+ return serverapp
349
+
338
350
def initialize (self ):
339
351
"""Initialize the extension app. The
340
352
corresponding server app and webapp should already
@@ -374,18 +386,6 @@ def stop(self):
374
386
self .serverapp .stop ()
375
387
self .serverapp .clear_instance ()
376
388
377
- @classmethod
378
- def _jupyter_server_config (cls ):
379
- base_config = {
380
- "ServerApp" : {
381
- "jpserver_extensions" : {cls .get_extension_package (): True },
382
- "open_browser" : True ,
383
- "default_url" : cls .extension_url
384
- }
385
- }
386
- base_config ["ServerApp" ].update (cls .server_config )
387
- return base_config
388
-
389
389
@classmethod
390
390
def _load_jupyter_server_extension (cls , serverapp ):
391
391
"""Initialize and configure this extension, then add the extension's
0 commit comments