apply TRY lint

This commit is contained in:
Jörg Thalheim
2024-09-03 17:56:59 +02:00
parent 850bb3314a
commit 29909e49d3
26 changed files with 70 additions and 49 deletions

View File

@@ -48,11 +48,12 @@ def send_join_request_api(host: str, port: int) -> bool:
body = response.split("\n")[-1]
print(body)
moonlight.terminate()
return True
except Exception as e:
print(f"An error occurred: {e}")
moonlight.terminate()
return False
else:
return True
def send_join_request_native(host: str, port: int, cert: str) -> bool:
@@ -78,9 +79,10 @@ def send_join_request_native(host: str, port: int, cert: str) -> bool:
lines = response.split("\n")
body = "\n".join(lines[2:])[2:]
print(body)
return True
except Exception as e:
print(f"An error occurred: {e}")
else:
return True
# TODO: fix
try:
print(f"response: {response}")

View File

@@ -23,21 +23,23 @@ class MoonlightPairing:
)
thread.start()
print("Thread started")
return True
except Exception as e:
print(
"Error occurred while starting the process: ", str(e), file=sys.stderr
)
return False
else:
return True
def check(self, host: str) -> bool:
try:
result = subprocess.run(
["moonlight", "list", "localhost", host], check=True
)
return result.returncode == 0
except subprocess.CalledProcessError:
return False
else:
return result.returncode == 0
def terminate(self) -> None:
if self.process: