Merge pull request #25 from kokarare1212/restyled/deepsource-transform-7c5ce39c

Restyle Format code with yapf
This commit is contained in:
こうから
2021-05-16 16:06:22 +09:00
committed by GitHub

View File

@@ -1,13 +1,16 @@
from __future__ import annotations from __future__ import annotations
from librespot.common import Utils
from librespot.core import Session
from librespot.crypto import DiffieHellman
from librespot.standard import Closeable, Runnable
from librespot.proto import Connect
import concurrent.futures import concurrent.futures
import random import random
import socket import socket
from librespot.common import Utils
from librespot.core import Session
from librespot.crypto import DiffieHellman
from librespot.proto import Connect
from librespot.standard import Closeable
from librespot.standard import Runnable
class ZeroconfServer(Closeable): class ZeroconfServer(Closeable):
__MAX_PORT = 65536 __MAX_PORT = 65536
@@ -41,10 +44,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,23 +62,25 @@ class ZeroconfServer(Closeable):
preferred_locale: str = None preferred_locale: str = None
conf = None conf = None
def __init__(self, def __init__(
self,
device_type: Connect.DeviceType, device_type: Connect.DeviceType,
device_name: str, device_name: str,
preferred_locale: str, preferred_locale: str,
conf: Session.Configuration, conf: Session.Configuration,
device_id: str = None): 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 = (device_id if device_id is not None else
40) 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
def __init__(self, port: int): def __init__(self, port: int):