From cec130aa39f2222c7e2127bfa43a475855041b97 Mon Sep 17 00:00:00 2001 From: "deepsource-autofix[bot]" <62050782+deepsource-autofix[bot]@users.noreply.github.com> Date: Sat, 24 Apr 2021 12:25:52 +0000 Subject: [PATCH] Format code with yapf This commit fixes the style issues introduced in b779a6a according to the output from yapf. Details: https://deepsource.io/gh/kokarare1212/librespot-python/transform/ef955754-0053-413b-8235-a6a87e8254d0/ --- librespot/audio/format/AudioQualityPicker.py | 3 ++- librespot/core/Session.py | 3 ++- librespot/dealer/ApiClient.py | 11 ++++++----- librespot/mercury/MercuryClient.py | 3 ++- librespot/player/StateWrapper.py | 3 ++- librespot/player/codecs/AudioQuality.py | 3 ++- librespot/player/codecs/VorbisOnlyAudioQuality.py | 3 ++- 7 files changed, 18 insertions(+), 11 deletions(-) diff --git a/librespot/audio/format/AudioQualityPicker.py b/librespot/audio/format/AudioQualityPicker.py index 9ca5615..6485ae4 100644 --- a/librespot/audio/format/AudioQualityPicker.py +++ b/librespot/audio/format/AudioQualityPicker.py @@ -6,5 +6,6 @@ if typing.TYPE_CHECKING: class AudioQualityPicker: - def get_file(self, files: typing.List[Metadata.AudioFile]) -> Metadata.AudioFile: + def get_file(self, + files: typing.List[Metadata.AudioFile]) -> Metadata.AudioFile: pass diff --git a/librespot/core/Session.py b/librespot/core/Session.py index 7519503..d97ca41 100644 --- a/librespot/core/Session.py +++ b/librespot/core/Session.py @@ -382,7 +382,8 @@ class Session(Closeable, SubListener, DealerClient.MessageListener): listener.on_closed() self._closeListeners: typing.List[Session.CloseListener] = [] - self._reconnectionListeners: typing.List[Session.ReconnectionListener] = [] + self._reconnectionListeners: typing.List[ + Session.ReconnectionListener] = [] self._LOGGER.info("Closed session. device_id: {}".format( self._inner.device_id)) diff --git a/librespot/dealer/ApiClient.py b/librespot/dealer/ApiClient.py index d15c691..a952f5a 100644 --- a/librespot/dealer/ApiClient.py +++ b/librespot/dealer/ApiClient.py @@ -16,9 +16,10 @@ class ApiClient(Closeable): self._session = session self._baseUrl = "https://{}".format(ApResolver.get_random_spclient()) - def build_request(self, method: str, suffix: str, - headers: typing.Union[None, typing.Dict[str, str]], - body: typing.Union[None, bytes]) -> requests.PreparedRequest: + def build_request( + self, method: str, suffix: str, + headers: typing.Union[None, typing.Dict[str, str]], + body: typing.Union[None, bytes]) -> requests.PreparedRequest: request = requests.PreparedRequest() request.method = method request.data = body @@ -30,8 +31,8 @@ class ApiClient(Closeable): request.url = self._baseUrl + suffix return request - def send(self, method: str, suffix: str, headers: typing.Union[None, typing.Dict[str, - str]], + def send(self, method: str, suffix: str, + headers: typing.Union[None, typing.Dict[str, str]], body: typing.Union[None, bytes]) -> requests.Response: resp = self._session.client().send( self.build_request(method, suffix, headers, body)) diff --git a/librespot/mercury/MercuryClient.py b/librespot/mercury/MercuryClient.py index 0cd96f4..2807043 100644 --- a/librespot/mercury/MercuryClient.py +++ b/librespot/mercury/MercuryClient.py @@ -249,7 +249,8 @@ class MercuryClient(PacketsReceiver.PacketsReceiver, Closeable): payload: typing.List[bytes] status_code: int - def __init__(self, header: Mercury.Header, payload: typing.List[bytes]): + def __init__(self, header: Mercury.Header, + payload: typing.List[bytes]): self.uri = header.uri self.status_code = header.status_code self.payload = payload[1:] diff --git a/librespot/player/StateWrapper.py b/librespot/player/StateWrapper.py index 0b4129d..7398d37 100644 --- a/librespot/player/StateWrapper.py +++ b/librespot/player/StateWrapper.py @@ -55,5 +55,6 @@ class StateWrapper(DeviceStateHandler.Listener, DealerClient.MessageListener): self._device.update_state(Connect.PutStateReason.NEW_DEVICE, 0, self._state) - def on_message(self, uri: str, headers: typing.Dict[str, str], payload: bytes): + def on_message(self, uri: str, headers: typing.Dict[str, str], + payload: bytes): pass diff --git a/librespot/player/codecs/AudioQuality.py b/librespot/player/codecs/AudioQuality.py index 3015278..9ffa731 100644 --- a/librespot/player/codecs/AudioQuality.py +++ b/librespot/player/codecs/AudioQuality.py @@ -27,7 +27,8 @@ class AudioQuality(enum.Enum): return AudioQuality.VERY_HIGH raise RuntimeError("Unknown format: {}".format(format)) - def get_matches(self, files: typing.List[AudioFile]) -> typing.List[AudioFile]: + def get_matches(self, + files: typing.List[AudioFile]) -> typing.List[AudioFile]: file_list = [] for file in files: if hasattr(file, "format") and AudioQuality.get_quality( diff --git a/librespot/player/codecs/VorbisOnlyAudioQuality.py b/librespot/player/codecs/VorbisOnlyAudioQuality.py index fc0abe9..e870316 100644 --- a/librespot/player/codecs/VorbisOnlyAudioQuality.py +++ b/librespot/player/codecs/VorbisOnlyAudioQuality.py @@ -26,7 +26,8 @@ class VorbisOnlyAudioQuality(AudioQualityPicker): return None def get_file(self, files: typing.List[Metadata.AudioFile]): - matches: typing.List[Metadata.AudioFile] = self.preferred.get_matches(files) + matches: typing.List[Metadata.AudioFile] = self.preferred.get_matches( + files) vorbis: Metadata.AudioFile = VorbisOnlyAudioQuality.get_vorbis_file( matches) if vorbis is None: