99from daemons .prefab import run
1010
1111from simulaqron .network import Network
12- from simulaqron .settings import simulaqron_settings , network_config
1312from simulaqron .settings import LOCAL_SIMULAQRON_SETTINGS , LOCAL_NETWORK_SETTINGS , HOME_NETWORK_SETTINGS
13+ from simulaqron .settings import simulaqron_settings , network_config
1414from simulaqron .settings .network_config import NodeConfig , DEFAULT_SIMULAQRON_NETWORK_FILENAME
1515from simulaqron .settings .simulaqron_config import SimBackend
1616
@@ -29,6 +29,7 @@ class RunningSimulaQronDaemon(run.RunDaemon):
2929 This class is useful to stop the already-running daemons without needed to read all
3030 the required configurations.
3131 """
32+
3233 def __init__ (self , pidfile : Path ):
3334 assert pidfile is not None
3435 super ().__init__ (pidfile = pidfile )
@@ -74,8 +75,8 @@ def version():
7475@cli .command ()
7576@click .option (
7677 "--network-config-file" ,
77- help = f"Use the given network config file. Defaults to the file named ' { DEFAULT_SIMULAQRON_NETWORK_FILENAME } ' "
78- f"on the current directory." ,
78+ help = f"Use the given network config file. Defaults to the file named " # noqa: E131
79+ f"' { DEFAULT_SIMULAQRON_NETWORK_FILENAME } ' on the current directory." , # noqa: E131
7980 type = click .Path (exists = True , dir_okay = False , resolve_path = True , path_type = Path ),
8081 default = LOCAL_NETWORK_SETTINGS
8182)
@@ -109,9 +110,9 @@ def start(name: str, nrnodes: int, nodes: str, network_config_file: Path):
109110 logging .warning ("The pidfile for this network is located at %s" , pidfile )
110111 return
111112 nodes = nodes .split ("," )
112- if len (nodes ) <= 0 :
113- print (f "WARNING - The list of nodes to start is empty. If you specified the --nrnodes option "
114- f "this can be normal. Please check your invocation line if needed." )
113+ if len (nodes ) <= 0 :
114+ print ("WARNING - The list of nodes to start is empty. If you specified the --nrnodes option "
115+ "this can be normal. Please check your invocation line if needed." )
115116 if nrnodes > 0 and len (nodes ) < nrnodes :
116117 nodes += [f"Node{ i } " for i in range (nrnodes - len (nodes ))]
117118 d = SimulaQronDaemon (pidfile = pidfile , name = name , nodes = nodes )
@@ -381,9 +382,9 @@ def get():
381382def sim_backend ():
382383 if LOCAL_SIMULAQRON_SETTINGS .exists () and LOCAL_SIMULAQRON_SETTINGS .is_file ():
383384 simulaqron_settings .load_from_file (LOCAL_SIMULAQRON_SETTINGS )
384- print (f"Configuration loaded from file: '{ LOCAL_SIMULAQRON_SETTINGS } ': " )
385+ print (f"Configuration loaded from file: '{ LOCAL_SIMULAQRON_SETTINGS } '" )
385386 else :
386- print (f "Configuration from default configuration: " )
387+ print ("Configuration from default configuration" )
387388 simulaqron_settings .default_settings ()
388389 print (simulaqron_settings .sim_backend )
389390
@@ -394,9 +395,9 @@ def sim_backend():
394395def max_qubits ():
395396 if LOCAL_SIMULAQRON_SETTINGS .exists () and LOCAL_SIMULAQRON_SETTINGS .is_file ():
396397 simulaqron_settings .load_from_file (LOCAL_SIMULAQRON_SETTINGS )
397- print (f"Configuration loaded from file: '{ LOCAL_SIMULAQRON_SETTINGS } ': " )
398+ print (f"Configuration loaded from file: '{ LOCAL_SIMULAQRON_SETTINGS } '" )
398399 else :
399- print (f "Configuration from default configuration: " )
400+ print ("Configuration from default configuration" )
400401 simulaqron_settings .default_settings ()
401402 print (simulaqron_settings .max_qubits )
402403
@@ -407,9 +408,9 @@ def max_qubits():
407408def max_registers ():
408409 if LOCAL_SIMULAQRON_SETTINGS .exists () and LOCAL_SIMULAQRON_SETTINGS .is_file ():
409410 simulaqron_settings .load_from_file (LOCAL_SIMULAQRON_SETTINGS )
410- print (f"Configuration loaded from file: '{ LOCAL_SIMULAQRON_SETTINGS } ': " )
411+ print (f"Configuration loaded from file: '{ LOCAL_SIMULAQRON_SETTINGS } '" )
411412 else :
412- print (f "Configuration from default configuration: " )
413+ print ("Configuration from default configuration" )
413414 simulaqron_settings .default_settings ()
414415 print (simulaqron_settings .max_registers )
415416
@@ -420,9 +421,9 @@ def max_registers():
420421def conn_retry_time ():
421422 if LOCAL_SIMULAQRON_SETTINGS .exists () and LOCAL_SIMULAQRON_SETTINGS .is_file ():
422423 simulaqron_settings .load_from_file (LOCAL_SIMULAQRON_SETTINGS )
423- print (f"Configuration loaded from file: '{ LOCAL_SIMULAQRON_SETTINGS } ': " )
424+ print (f"Configuration loaded from file: '{ LOCAL_SIMULAQRON_SETTINGS } '" )
424425 else :
425- print (f "Configuration from default configuration: " )
426+ print ("Configuration from default configuration" )
426427 simulaqron_settings .default_settings ()
427428 print (simulaqron_settings .conn_retry_time )
428429
@@ -433,9 +434,9 @@ def conn_retry_time():
433434def recv_timeout ():
434435 if LOCAL_SIMULAQRON_SETTINGS .exists () and LOCAL_SIMULAQRON_SETTINGS .is_file ():
435436 simulaqron_settings .load_from_file (LOCAL_SIMULAQRON_SETTINGS )
436- print (f"Configuration loaded from file: '{ LOCAL_SIMULAQRON_SETTINGS } ': " )
437+ print (f"Configuration loaded from file: '{ LOCAL_SIMULAQRON_SETTINGS } '" )
437438 else :
438- print (f "Configuration from default configuration: " )
439+ print ("Configuration from default configuration" )
439440 simulaqron_settings .default_settings ()
440441 print (simulaqron_settings .recv_timeout )
441442
@@ -446,9 +447,9 @@ def recv_timeout():
446447def recv_retry_time ():
447448 if LOCAL_SIMULAQRON_SETTINGS .exists () and LOCAL_SIMULAQRON_SETTINGS .is_file ():
448449 simulaqron_settings .load_from_file (LOCAL_SIMULAQRON_SETTINGS )
449- print (f"Configuration loaded from file: '{ LOCAL_SIMULAQRON_SETTINGS } ': " )
450+ print (f"Configuration loaded from file: '{ LOCAL_SIMULAQRON_SETTINGS } '" )
450451 else :
451- print (f "Configuration from default configuration: " )
452+ print ("Configuration from default configuration" )
452453 simulaqron_settings .default_settings ()
453454 print (simulaqron_settings .recv_retry_time )
454455
@@ -459,9 +460,9 @@ def recv_retry_time():
459460def log_level ():
460461 if LOCAL_SIMULAQRON_SETTINGS .exists () and LOCAL_SIMULAQRON_SETTINGS .is_file ():
461462 simulaqron_settings .load_from_file (LOCAL_SIMULAQRON_SETTINGS )
462- print (f"Configuration loaded from file: '{ LOCAL_SIMULAQRON_SETTINGS } ': " )
463+ print (f"Configuration loaded from file: '{ LOCAL_SIMULAQRON_SETTINGS } '" )
463464 else :
464- print (f "Configuration from default configuration: " )
465+ print ("Configuration from default configuration" )
465466 simulaqron_settings .default_settings ()
466467 print (simulaqron_settings .log_level )
467468
@@ -472,9 +473,9 @@ def log_level():
472473def noisy_qubits ():
473474 if LOCAL_SIMULAQRON_SETTINGS .exists () and LOCAL_SIMULAQRON_SETTINGS .is_file ():
474475 simulaqron_settings .load_from_file (LOCAL_SIMULAQRON_SETTINGS )
475- print (f"Configuration loaded from file: '{ LOCAL_SIMULAQRON_SETTINGS } ': " )
476+ print (f"Configuration loaded from file: '{ LOCAL_SIMULAQRON_SETTINGS } '" )
476477 else :
477- print (f "Configuration from default configuration: " )
478+ print ("Configuration from default configuration" )
478479 simulaqron_settings .default_settings ()
479480 if simulaqron_settings .noisy_qubits :
480481 print ("on" )
@@ -488,9 +489,9 @@ def noisy_qubits():
488489def t1 ():
489490 if LOCAL_SIMULAQRON_SETTINGS .exists () and LOCAL_SIMULAQRON_SETTINGS .is_file ():
490491 simulaqron_settings .load_from_file (LOCAL_SIMULAQRON_SETTINGS )
491- print (f"Configuration loaded from file: '{ LOCAL_SIMULAQRON_SETTINGS } ': " )
492+ print (f"Configuration loaded from file: '{ LOCAL_SIMULAQRON_SETTINGS } '" )
492493 else :
493- print (f "Configuration from default configuration: " )
494+ print ("Configuration from default configuration" )
494495 simulaqron_settings .default_settings ()
495496 print (simulaqron_settings .t1 )
496497
@@ -531,8 +532,8 @@ def nodes():
531532 help = "The neighbors of the node in the network separated by ',' (no space).\n \
532533 For example '--neighbors Bob,Charlie,David'.\n \
533534 If not specified all current nodes in the network will be neighbors." )
534- def add (name : str , network_name : str , hostname : str , app_port : int , qnodeos_port : int ,
535- vnode_port : int , neighbors : Optional [str ]= None ):
535+ def add (name : str , network_name : str , hostname : str , app_port : int , qnodeos_port : int ,
536+ vnode_port : int , neighbors : Optional [str ] = None ):
536537 """
537538 Add a node to the network.
538539
@@ -545,13 +546,13 @@ def add(name: str, network_name: str, hostname: str , app_port: int, qnodeos_por
545546 neighbors = [neighbor .strip () for neighbor in neighbors ]
546547 network_config .read_from_file (LOCAL_NETWORK_SETTINGS )
547548 network_config .add_node (node_name = name , network_name = network_name ,
548- app_hostname = hostname , qnodeos_hostname = hostname , vnode_hostname = hostname ,
549- app_port = app_port , qnodeos_port = qnodeos_port , vnode_port = vnode_port ,
550- neighbors = neighbors )
549+ app_hostname = hostname , qnodeos_hostname = hostname , vnode_hostname = hostname ,
550+ app_port = app_port , qnodeos_port = qnodeos_port , vnode_port = vnode_port ,
551+ neighbors = neighbors )
551552 network_config .write_to_file (LOCAL_NETWORK_SETTINGS )
552553 added_node : NodeConfig = network_config .get_nodes (network_name = network_name )[name ]
553554 print (f"Node with name '{ added_node .name } ' was added to the network with name '{ network_name } '.\n "
554- f "Socket addresses are:\n "
555+ "Socket addresses are: \n "
555556 f"* App/Classical: '({ added_node .app_hostname } , { added_node .app_port } )\n "
556557 f"* QNodeOS: '({ added_node .qnodeos_hostname } , { added_node .qnodeos_port } )\n "
557558 f"* Virtual Node: '({ added_node .vnode_hostname } , { added_node .vnode_port } )\n " )
0 commit comments