enforcing type better

This commit is contained in:
2022-03-24 22:11:02 -05:00
parent fdccf77367
commit 88db4171cf
8 changed files with 58 additions and 58 deletions

View File

@@ -17,7 +17,7 @@ def threaded(fn):
class IPCServer:
''' Create a listener so that other instances send requests back to existing instance. '''
def __init__(self, conn_type="socket"):
def __init__(self, conn_type: str = "socket"):
self.is_ipc_alive = False
self._conn_type = conn_type
self.ipc_authkey = b'app-ipc'
@@ -30,7 +30,7 @@ class IPCServer:
self.ipc_port = 8888
@threaded
def create_ipc_server(self):
def create_ipc_server(self) -> None:
if self._conn_type == "socket":
if os.path.exists(self.ipc_address):
return
@@ -74,7 +74,7 @@ class IPCServer:
listener.close()
def send_ipc_message(self, message="Empty Data..."):
def send_ipc_message(self, message: str = "Empty Data...") -> None:
try:
if self._conn_type == "socket":
conn = Client(address=self.ipc_address, family="AF_UNIX", authkey=self.ipc_authkey)
@@ -83,5 +83,6 @@ class IPCServer:
conn.send(message)
conn.send('close connection')
conn.close()
except Exception as e:
print(repr(e))