11"""Manager for jupyter server proxy"""
22
33import asyncio
4-
54from collections import namedtuple
65
7- from traitlets import List , Int
8- from traitlets .config import LoggingConfigurable
9-
106from jupyter_server .utils import url_path_join as ujoin
11-
7+ from traitlets import Int , List
8+ from traitlets .config import LoggingConfigurable
129
1310ServerProxy = namedtuple (
1411 "ServerProxy" ,
15- [
16- "name" ,
17- "url" ,
18- "cmd" ,
19- "port" ,
20- "managed" ,
21- "unix_socket"
22- ],
23- defaults = ["" ] * 6
24- )
25- ServerProxyProc = namedtuple (
26- "ServerProxyProc" ,
27- [
28- "name" ,
29- "proc"
30- ],
31- defaults = ["" ] * 2
12+ ["name" , "url" , "cmd" , "port" , "managed" , "unix_socket" ],
13+ defaults = ["" ] * 6 ,
3214)
15+ ServerProxyProc = namedtuple ("ServerProxyProc" , ["name" , "proc" ], defaults = ["" ] * 2 )
3316
3417
3518class ServerProxyAppManager (LoggingConfigurable ):
@@ -38,17 +21,12 @@ class ServerProxyAppManager(LoggingConfigurable):
3821 by jupyter server proxy.
3922 """
4023
41- server_proxy_apps = List (
42- help = "List of server proxy apps"
43- )
24+ server_proxy_apps = List (help = "List of server proxy apps" )
4425
45- _server_proxy_procs = List (
46- help = "List of server proxy app proc objects"
47- )
26+ _server_proxy_procs = List (help = "List of server proxy app proc objects" )
4827
4928 num_active_server_proxy_apps = Int (
50- 0 ,
51- help = "Total number of currently running proxy apps"
29+ 0 , help = "Total number of currently running proxy apps"
5230 )
5331
5432 def add_server_proxy_app (self , name , base_url , cmd , port , proc , unix_socket ):
@@ -63,7 +41,7 @@ def add_server_proxy_app(self, name, base_url, cmd, port, proc, unix_socket):
6341 cmd = " " .join (cmd ),
6442 port = port ,
6543 managed = True if proc else False ,
66- unix_socket = unix_socket if unix_socket is not None else ''
44+ unix_socket = unix_socket if unix_socket is not None else "" ,
6745 )
6846 )
6947
@@ -89,11 +67,16 @@ def del_server_proxy_app(self, name):
8967
9068 def get_server_proxy_app (self , name ):
9169 """Get a given server proxy app"""
92- return next ((app for app in self .server_proxy_apps if app .name == name ), ServerProxy ())
70+ return next (
71+ (app for app in self .server_proxy_apps if app .name == name ), ServerProxy ()
72+ )
9373
9474 def _get_server_proxy_proc (self , name ):
9575 """Get a given server proxy app"""
96- return next ((app for app in self ._server_proxy_procs if app .name == name ), ServerProxyProc ())
76+ return next (
77+ (app for app in self ._server_proxy_procs if app .name == name ),
78+ ServerProxyProc (),
79+ )
9780
9881 def list_server_proxy_apps (self ):
9982 """List all active server proxy apps"""
0 commit comments