Skip to content

Commit

Permalink
Fix Flake8 issues
Browse files Browse the repository at this point in the history
  • Loading branch information
Anydroid committed Feb 13, 2024
1 parent b01d4fe commit 9775b12
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions start_aks_bsv.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,15 +64,15 @@ def __init__(self, command, path=None):
self.command = command
self.path = path
self.process = None

def open(self, blocking=True, stderr=None):
report(f"Running {self.command}...")
if blocking:
# Open the process and wait for it to finish
self.process = subprocess.Popen(self.command,
stdin=subprocess.PIPE,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
self.process = subprocess.Popen(self.command,
stdin=subprocess.PIPE,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
universal_newlines=True,
cwd=self.path)
cli_stdout, cli_stderr = self.process.communicate()
Expand All @@ -90,7 +90,7 @@ class SSHCall(): # Representing a call over the SSH with the key-based authenti
def __init__(self, host, user, key):
self.ssh_command = ["ssh", "-i", key, f"{user}@{host}"]
self.process = None

def run(self, command, blocking=True, stderr=None):
ssh_call = self.ssh_command + [command]
self.process = Process(ssh_call)
Expand All @@ -112,7 +112,7 @@ def __init__(self, port=None, ssh_args={}, timeout=60):
host = ssh_args.get("host")
self.service = f"{host}:{port}"
self.process = None

def wait_for_synced(self, process=None):
wait_until = time.time() + self.timeout
while time.time() < wait_until:
Expand Down Expand Up @@ -189,7 +189,7 @@ def __init__(self, args=[], ssh=None):
def run_command_locally(self, command):
process = Process(command)
return process.open()

# Runs bitcoin-cli command remotely (SSH) and returns the result
def run_command_ssh(self, command):
return self.ssh.run(command)
Expand Down Expand Up @@ -228,13 +228,13 @@ def run_node_ssh(self):
self.wait_for_node_ready(self.ssh.process)
# We can terminate the SSH process
self.ssh.process.process.terminate()

def run_node_locally(self):
process = Process(self.command)
# We want to get the stderr to be able to report bitcoind issues
process.open(blocking=False, stderr=subprocess.PIPE)
self.wait_for_node_ready(process)

def wait_for_node_ready(self, process):
report("Waiting for RPC connection...")
self.wait_for_rpc_connection(process)
Expand Down Expand Up @@ -265,7 +265,7 @@ def wait_for_rpc_connection(self, process):
time.sleep(1.0)
if not running:
raise AssertionError("RPC connection timeout exceeded")

def wait_for_initialization(self):
wait_until = time.time() + self.timeout
while time.time() < wait_until:
Expand Down Expand Up @@ -386,7 +386,7 @@ def parse_arguments(*args):
bsv_args["ssh"][key[4:]] = value
# BSV OPTIONS for everything else
else:
bsv_args["options"].append(arg)
bsv_args["options"].append(arg)
report(f"Input parameters: {args}")
if show_help:
help()
Expand Down

0 comments on commit 9775b12

Please sign in to comment.