From f03c100f06c8c9edc76a23f5b3b0a8f00e852416 Mon Sep 17 00:00:00 2001 From: "deepsource-autofix[bot]" <62050782+deepsource-autofix[bot]@users.noreply.github.com> Date: Sat, 15 May 2021 00:01:51 +0000 Subject: [PATCH 1/5] Format code with yapf This commit fixes the style issues introduced in 145e9a7 according to the output from yapf. Details: https://deepsource.io/gh/kokarare1212/librespot-python/transform/67a153b1-288c-42c3-b483-041e162b9474/ --- librespot/ZeroconfServer.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/librespot/ZeroconfServer.py b/librespot/ZeroconfServer.py index d1a551a..36590ba 100644 --- a/librespot/ZeroconfServer.py +++ b/librespot/ZeroconfServer.py @@ -16,7 +16,8 @@ class ZeroconfServer(Closeable): __keys: DiffieHellman __inner: ZeroconfServer.Inner - def __init__(self, inner: ZeroconfServer.Inner, listen_port: int, listen_all: bool): + def __init__(self, inner: ZeroconfServer.Inner, listen_port: int, + listen_all: bool): self.__inner = inner self.__keys = DiffieHellman() @@ -39,7 +40,11 @@ def set_listen_port(self, listen_port: int) -> ZeroconfServer.Builder: return self def create(self) -> ZeroconfServer: - return ZeroconfServer(ZeroconfServer.Inner(self.device_type, self.device_name, self.preferred_locale, self.conf, self.device_id), self.__listenPort, self.__listenAll) + return ZeroconfServer( + ZeroconfServer.Inner(self.device_type, self.device_name, + self.preferred_locale, self.conf, + self.device_id), self.__listenPort, + self.__listenAll) class Inner: device_type: Connect.DeviceType = None @@ -63,7 +68,8 @@ def __init__(self, class HttpRunner(Runnable, Closeable): __sock: socket - __executorService: concurrent.futures.ThreadPoolExecutor = concurrent.futures.ThreadPoolExecutor() + __executorService: concurrent.futures.ThreadPoolExecutor = concurrent.futures.ThreadPoolExecutor( + ) __shouldStop: bool = False def __init__(self, port: int): @@ -86,4 +92,3 @@ def __handle(self, client: socket.socket): def close(self) -> None: super().close() - From 1c2c6b5b94bfe1e34e36202813eed117a928ffe0 Mon Sep 17 00:00:00 2001 From: "Restyled.io" Date: Sat, 15 May 2021 00:02:04 +0000 Subject: [PATCH 2/5] Restyled by black --- librespot/ZeroconfServer.py | 39 +++++++++++++++++++++++-------------- 1 file changed, 24 insertions(+), 15 deletions(-) diff --git a/librespot/ZeroconfServer.py b/librespot/ZeroconfServer.py index 36590ba..d0ee0ad 100644 --- a/librespot/ZeroconfServer.py +++ b/librespot/ZeroconfServer.py @@ -16,8 +16,7 @@ class ZeroconfServer(Closeable): __keys: DiffieHellman __inner: ZeroconfServer.Inner - def __init__(self, inner: ZeroconfServer.Inner, listen_port: int, - listen_all: bool): + def __init__(self, inner: ZeroconfServer.Inner, listen_port: int, listen_all: bool): self.__inner = inner self.__keys = DiffieHellman() @@ -41,10 +40,16 @@ def set_listen_port(self, listen_port: int) -> ZeroconfServer.Builder: def create(self) -> ZeroconfServer: return ZeroconfServer( - ZeroconfServer.Inner(self.device_type, self.device_name, - self.preferred_locale, self.conf, - self.device_id), self.__listenPort, - self.__listenAll) + ZeroconfServer.Inner( + self.device_type, + self.device_name, + self.preferred_locale, + self.conf, + self.device_id, + ), + self.__listenPort, + self.__listenAll, + ) class Inner: device_type: Connect.DeviceType = None @@ -53,22 +58,26 @@ class Inner: preferred_locale: str = None conf = None - def __init__(self, - device_type: Connect.DeviceType, - device_name: str, - preferred_locale: str, - conf: Session.Configuration, - device_id: str = None): + def __init__( + self, + device_type: Connect.DeviceType, + device_name: str, + preferred_locale: str, + conf: Session.Configuration, + device_id: str = None, + ): self.preferred_locale = preferred_locale self.conf = conf self.device_type = device_type self.device_name = device_name - self.device_id = device_id if device_id is not None else Utils.random_hex_string( - 40) + self.device_id = ( + device_id if device_id is not None else Utils.random_hex_string(40) + ) class HttpRunner(Runnable, Closeable): __sock: socket - __executorService: concurrent.futures.ThreadPoolExecutor = concurrent.futures.ThreadPoolExecutor( + __executorService: concurrent.futures.ThreadPoolExecutor = ( + concurrent.futures.ThreadPoolExecutor() ) __shouldStop: bool = False From 74c1d9d3e8422bdaf791db417d05366686276a91 Mon Sep 17 00:00:00 2001 From: "Restyled.io" Date: Sat, 15 May 2021 00:02:06 +0000 Subject: [PATCH 3/5] Restyled by isort --- librespot/ZeroconfServer.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/librespot/ZeroconfServer.py b/librespot/ZeroconfServer.py index d0ee0ad..353a74c 100644 --- a/librespot/ZeroconfServer.py +++ b/librespot/ZeroconfServer.py @@ -1,12 +1,14 @@ from __future__ import annotations + +import concurrent.futures +import random +import socket + 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 random -import socket +from librespot.standard import Closeable, Runnable class ZeroconfServer(Closeable): From 4aa72c73696b74718727898e7ef2ca1f240092d3 Mon Sep 17 00:00:00 2001 From: "Restyled.io" Date: Sat, 15 May 2021 00:02:10 +0000 Subject: [PATCH 4/5] Restyled by reorder-python-imports --- librespot/ZeroconfServer.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/librespot/ZeroconfServer.py b/librespot/ZeroconfServer.py index 353a74c..b691ad2 100644 --- a/librespot/ZeroconfServer.py +++ b/librespot/ZeroconfServer.py @@ -8,7 +8,8 @@ from librespot.core import Session from librespot.crypto import DiffieHellman from librespot.proto import Connect -from librespot.standard import Closeable, Runnable +from librespot.standard import Closeable +from librespot.standard import Runnable class ZeroconfServer(Closeable): From f81b4bcf53270131a72369ca62723acb6fb94ec8 Mon Sep 17 00:00:00 2001 From: "Restyled.io" Date: Sat, 15 May 2021 00:02:15 +0000 Subject: [PATCH 5/5] Restyled by yapf --- librespot/ZeroconfServer.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/librespot/ZeroconfServer.py b/librespot/ZeroconfServer.py index b691ad2..bb2c6f4 100644 --- a/librespot/ZeroconfServer.py +++ b/librespot/ZeroconfServer.py @@ -19,7 +19,8 @@ class ZeroconfServer(Closeable): __keys: DiffieHellman __inner: ZeroconfServer.Inner - def __init__(self, inner: ZeroconfServer.Inner, listen_port: int, listen_all: bool): + def __init__(self, inner: ZeroconfServer.Inner, listen_port: int, + listen_all: bool): self.__inner = inner self.__keys = DiffieHellman() @@ -73,15 +74,13 @@ def __init__( self.conf = conf self.device_type = device_type self.device_name = device_name - self.device_id = ( - device_id if device_id is not None else Utils.random_hex_string(40) - ) + self.device_id = (device_id if device_id is not None else + Utils.random_hex_string(40)) class HttpRunner(Runnable, Closeable): __sock: socket __executorService: concurrent.futures.ThreadPoolExecutor = ( - concurrent.futures.ThreadPoolExecutor() - ) + concurrent.futures.ThreadPoolExecutor()) __shouldStop: bool = False def __init__(self, port: int):