Skip to content

Commit b7b291e

Browse files
committed
Small fixes in the simulaqron cli entry point code
1 parent 0e16726 commit b7b291e

File tree

1 file changed

+5
-12
lines changed

1 file changed

+5
-12
lines changed

simulaqron/simulaqron.py

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
#!/usr/bin/env python3
21
import importlib.metadata as metadata
32
import logging
43
import time
54
from pathlib import Path
6-
from typing import Optional, Callable, List
5+
from typing import Optional, List
76

87
import click
98
from daemons.interfaces import exit
@@ -50,15 +49,6 @@ def run(self):
5049
time.sleep(0.1)
5150

5251

53-
def _is_positive_answer(answer: str):
54-
"""
55-
Used to check if an answer is positive from a user.
56-
"""
57-
if answer.lower() in ["yes", "y"]:
58-
return True
59-
return False
60-
61-
6252
@click.group(context_settings=CONTEXT_SETTINGS)
6353
def cli():
6454
"""Command line interface for interacting with SimulaQron."""
@@ -119,6 +109,9 @@ def start(name: str, nrnodes: int, nodes: str, network_config_file: Path):
119109
logging.warning("The pidfile for this network is located at %s", pidfile)
120110
return
121111
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.")
122115
if nrnodes > 0 and len(nodes) < nrnodes:
123116
nodes += [f"Node{i}" for i in range(nrnodes - len(nodes))]
124117
d = SimulaQronDaemon(pidfile=pidfile, name=name, nodes=nodes)
@@ -174,7 +167,7 @@ def reset(force: bool):
174167
"(yes/no)")
175168
else:
176169
answer = "yes"
177-
if _is_positive_answer(answer):
170+
if answer.lower() in ["yes", "y"]:
178171
for entry in PID_FOLDER.iterdir():
179172
if entry.suffix == ".pid":
180173
d = RunningSimulaQronDaemon(pidfile=entry)

0 commit comments

Comments
 (0)