Restyled by black

This commit is contained in:
Restyled.io
2021-05-15 00:02:04 +00:00
parent f03c100f06
commit 1c2c6b5b94

View File

@@ -16,8 +16,7 @@ class ZeroconfServer(Closeable):
__keys: DiffieHellman __keys: DiffieHellman
__inner: ZeroconfServer.Inner __inner: ZeroconfServer.Inner
def __init__(self, inner: ZeroconfServer.Inner, listen_port: int, def __init__(self, inner: ZeroconfServer.Inner, listen_port: int, listen_all: bool):
listen_all: bool):
self.__inner = inner self.__inner = inner
self.__keys = DiffieHellman() self.__keys = DiffieHellman()
@@ -41,10 +40,16 @@ class ZeroconfServer(Closeable):
def create(self) -> ZeroconfServer: def create(self) -> ZeroconfServer:
return ZeroconfServer( return ZeroconfServer(
ZeroconfServer.Inner(self.device_type, self.device_name, ZeroconfServer.Inner(
self.preferred_locale, self.conf, self.device_type,
self.device_id), self.__listenPort, self.device_name,
self.__listenAll) self.preferred_locale,
self.conf,
self.device_id,
),
self.__listenPort,
self.__listenAll,
)
class Inner: class Inner:
device_type: Connect.DeviceType = None device_type: Connect.DeviceType = None
@@ -53,22 +58,26 @@ class ZeroconfServer(Closeable):
preferred_locale: str = None preferred_locale: str = None
conf = None conf = None
def __init__(self, def __init__(
device_type: Connect.DeviceType, self,
device_name: str, device_type: Connect.DeviceType,
preferred_locale: str, device_name: str,
conf: Session.Configuration, preferred_locale: str,
device_id: str = None): conf: Session.Configuration,
device_id: str = None,
):
self.preferred_locale = preferred_locale self.preferred_locale = preferred_locale
self.conf = conf self.conf = conf
self.device_type = device_type self.device_type = device_type
self.device_name = device_name self.device_name = device_name
self.device_id = device_id if device_id is not None else Utils.random_hex_string( self.device_id = (
40) device_id if device_id is not None else Utils.random_hex_string(40)
)
class HttpRunner(Runnable, Closeable): class HttpRunner(Runnable, Closeable):
__sock: socket __sock: socket
__executorService: concurrent.futures.ThreadPoolExecutor = concurrent.futures.ThreadPoolExecutor( __executorService: concurrent.futures.ThreadPoolExecutor = (
concurrent.futures.ThreadPoolExecutor()
) )
__shouldStop: bool = False __shouldStop: bool = False