diff --git a/librespot/ZeroconfServer.py b/librespot/ZeroconfServer.py index af20b76..98a154a 100644 --- a/librespot/ZeroconfServer.py +++ b/librespot/ZeroconfServer.py @@ -10,8 +10,7 @@ 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 +from librespot.standard import Closeable, Runnable class ZeroconfServer(Closeable): diff --git a/librespot/audio/AudioKeyManager.py b/librespot/audio/AudioKeyManager.py index ab4df70..1046a2f 100644 --- a/librespot/audio/AudioKeyManager.py +++ b/librespot/audio/AudioKeyManager.py @@ -1,16 +1,16 @@ from __future__ import annotations +import logging +import queue import struct +import threading +import typing from librespot.common import Utils from librespot.core import Session from librespot.core.PacketsReceiver import PacketsReceiver from librespot.crypto import Packet -from librespot.standard import BytesInputStream, ByteArrayOutputStream -import logging -import queue -import threading -import typing +from librespot.standard import ByteArrayOutputStream, BytesInputStream class AudioKeyManager(PacketsReceiver): diff --git a/librespot/audio/PlayableContentFeeder.py b/librespot/audio/PlayableContentFeeder.py index 0756251..0c5f4a0 100644 --- a/librespot/audio/PlayableContentFeeder.py +++ b/librespot/audio/PlayableContentFeeder.py @@ -1,5 +1,8 @@ from __future__ import annotations +import logging +import typing + from librespot.audio import GeneralAudioStream, HaltListener, NormalizationData from librespot.audio.cdn import CdnFeedHelper from librespot.audio.format import AudioQualityPicker @@ -7,8 +10,6 @@ from librespot.common.Utils import Utils from librespot.core import Session from librespot.metadata import PlayableId, TrackId from librespot.proto import Metadata, StorageResolve -import logging -import typing class PlayableContentFeeder: diff --git a/librespot/audio/cdn/CdnFeedHelper.py b/librespot/audio/cdn/CdnFeedHelper.py index b0eca33..dbfaf2c 100644 --- a/librespot/audio/cdn/CdnFeedHelper.py +++ b/librespot/audio/cdn/CdnFeedHelper.py @@ -5,13 +5,11 @@ import random import time import typing -from librespot.audio import HaltListener -from librespot.audio import NormalizationData -from librespot.audio import PlayableContentFeeder +from librespot.audio import (HaltListener, NormalizationData, + PlayableContentFeeder) from librespot.common import Utils from librespot.core import Session -from librespot.proto import Metadata -from librespot.proto import StorageResolve +from librespot.proto import Metadata, StorageResolve class CdnFeedHelper: diff --git a/librespot/audio/cdn/CdnManager.py b/librespot/audio/cdn/CdnManager.py index f25b4c8..8acc876 100644 --- a/librespot/audio/cdn/CdnManager.py +++ b/librespot/audio/cdn/CdnManager.py @@ -8,12 +8,9 @@ import time import typing import urllib.parse -from librespot.audio import GeneralAudioStream -from librespot.audio import GeneralWritableStream -from librespot.audio import StreamId +from librespot.audio import GeneralAudioStream, GeneralWritableStream, StreamId from librespot.audio.AbsChunkedInputStream import AbsChunkedInputStream -from librespot.audio.decrypt import AesAudioDecrypt -from librespot.audio.decrypt import NoopAudioDecrypt +from librespot.audio.decrypt import AesAudioDecrypt, NoopAudioDecrypt from librespot.audio.format import SuperAudioFormat from librespot.audio.storage import ChannelManager from librespot.common import Utils diff --git a/librespot/audio/decoders/AudioQuality.py b/librespot/audio/decoders/AudioQuality.py index 7713516..a514f51 100644 --- a/librespot/audio/decoders/AudioQuality.py +++ b/librespot/audio/decoders/AudioQuality.py @@ -1,8 +1,10 @@ from __future__ import annotations -from librespot.proto.Metadata import AudioFile + import enum import typing +from librespot.proto.Metadata import AudioFile + class AudioQuality(enum.Enum): NORMAL = 0x00 diff --git a/librespot/audio/decrypt/AesAudioDecrypt.py b/librespot/audio/decrypt/AesAudioDecrypt.py index f375bbd..7031e50 100644 --- a/librespot/audio/decrypt/AesAudioDecrypt.py +++ b/librespot/audio/decrypt/AesAudioDecrypt.py @@ -1,8 +1,10 @@ +import time + from Crypto.Cipher import AES from Crypto.Util import Counter -from librespot.audio.storage import ChannelManager + from librespot.audio.decrypt.AudioDecrypt import AudioDecrypt -import time +from librespot.audio.storage import ChannelManager class AesAudioDecrypt(AudioDecrypt): diff --git a/librespot/audio/format/AudioQualityPicker.py b/librespot/audio/format/AudioQualityPicker.py index 9ca5615..15f3bb6 100644 --- a/librespot/audio/format/AudioQualityPicker.py +++ b/librespot/audio/format/AudioQualityPicker.py @@ -1,4 +1,5 @@ from __future__ import annotations + import typing if typing.TYPE_CHECKING: diff --git a/librespot/audio/storage/ChannelManager.py b/librespot/audio/storage/ChannelManager.py index 519618f..e2c0cd3 100644 --- a/librespot/audio/storage/ChannelManager.py +++ b/librespot/audio/storage/ChannelManager.py @@ -1,16 +1,17 @@ from __future__ import annotations +import concurrent.futures +import logging import queue +import threading +import typing from librespot.audio.storage import AudioFile from librespot.common import Utils from librespot.core import PacketsReceiver, Session from librespot.crypto import Packet -from librespot.standard import BytesInputStream, BytesOutputStream, Closeable, Runnable -import concurrent.futures -import logging -import threading -import typing +from librespot.standard import (BytesInputStream, BytesOutputStream, Closeable, + Runnable) class ChannelManager(Closeable, PacketsReceiver.PacketsReceiver): diff --git a/librespot/core/Session.py b/librespot/core/Session.py index 2f47c25..c3ed487 100644 --- a/librespot/core/Session.py +++ b/librespot/core/Session.py @@ -13,35 +13,23 @@ import typing import defusedxml.ElementTree import requests -from Crypto.Hash import HMAC -from Crypto.Hash import SHA1 +from Crypto.Hash import HMAC, SHA1 from Crypto.PublicKey import RSA from Crypto.Signature import PKCS1_v1_5 -from librespot.audio import AudioKeyManager -from librespot.audio import PlayableContentFeeder +from librespot.audio import AudioKeyManager, PlayableContentFeeder from librespot.audio.cdn import CdnManager from librespot.audio.storage import ChannelManager from librespot.cache import CacheManager from librespot.common.Utils import Utils -from librespot.core import ApResolver -from librespot.core import EventService -from librespot.core import SearchManager -from librespot.core import TokenProvider -from librespot.crypto import CipherPair -from librespot.crypto import DiffieHellman -from librespot.crypto import Packet -from librespot.dealer import ApiClient -from librespot.dealer import DealerClient -from librespot.mercury import MercuryClient -from librespot.mercury import SubListener -from librespot.proto import Authentication -from librespot.proto import Connect -from librespot.proto import Keyexchange +from librespot.core import (ApResolver, EventService, SearchManager, + TokenProvider) +from librespot.crypto import CipherPair, DiffieHellman, Packet +from librespot.dealer import ApiClient, DealerClient +from librespot.mercury import MercuryClient, SubListener +from librespot.proto import Authentication, Connect, Keyexchange from librespot.proto.ExplicitContentPubsub import UserAttributesUpdate -from librespot.standard import BytesInputStream -from librespot.standard import Closeable -from librespot.standard import Proxy +from librespot.standard import BytesInputStream, Closeable, Proxy from librespot.Version import Version diff --git a/librespot/core/TokenProvider.py b/librespot/core/TokenProvider.py index f95359d..3918ee6 100644 --- a/librespot/core/TokenProvider.py +++ b/librespot/core/TokenProvider.py @@ -1,9 +1,11 @@ from __future__ import annotations -from librespot.core import Session, TimeProvider -from librespot.mercury import MercuryRequests + import logging import typing +from librespot.core import Session, TimeProvider +from librespot.mercury import MercuryRequests + class TokenProvider: _LOGGER: logging = logging.getLogger(__name__) diff --git a/librespot/dealer/ApiClient.py b/librespot/dealer/ApiClient.py index 2bf04c6..531314e 100644 --- a/librespot/dealer/ApiClient.py +++ b/librespot/dealer/ApiClient.py @@ -1,10 +1,12 @@ +import logging +import typing + +import requests + from librespot.core.ApResolver import ApResolver -from librespot.metadata import AlbumId, ArtistId, EpisodeId, TrackId, ShowId +from librespot.metadata import AlbumId, ArtistId, EpisodeId, ShowId, TrackId from librespot.proto import Connect, Metadata from librespot.standard import Closeable -import logging -import requests -import typing class ApiClient(Closeable): diff --git a/librespot/dealer/DealerClient.py b/librespot/dealer/DealerClient.py index a0359a5..802f595 100644 --- a/librespot/dealer/DealerClient.py +++ b/librespot/dealer/DealerClient.py @@ -1,7 +1,9 @@ from __future__ import annotations -from librespot.standard.Closeable import Closeable + import typing +from librespot.standard.Closeable import Closeable + class DealerClient(Closeable): def __init__(self, session): diff --git a/librespot/mercury/MercuryClient.py b/librespot/mercury/MercuryClient.py index 6b61c53..1d98dd6 100644 --- a/librespot/mercury/MercuryClient.py +++ b/librespot/mercury/MercuryClient.py @@ -1,16 +1,19 @@ from __future__ import annotations -from librespot.common import Utils -from librespot.core import Session, PacketsReceiver -from librespot.crypto import Packet -from librespot.mercury import JsonMercuryRequest, RawMercuryRequest, SubListener -from librespot.standard import BytesInputStream, BytesOutputStream, Closeable -from librespot.proto import Mercury, Pubsub + import json import logging import queue import threading import typing +from librespot.common import Utils +from librespot.core import PacketsReceiver, Session +from librespot.crypto import Packet +from librespot.mercury import (JsonMercuryRequest, RawMercuryRequest, + SubListener) +from librespot.proto import Mercury, Pubsub +from librespot.standard import BytesInputStream, BytesOutputStream, Closeable + class MercuryClient(PacketsReceiver.PacketsReceiver, Closeable): _LOGGER: logging = logging.getLogger(__name__) diff --git a/librespot/mercury/RawMercuryRequest.py b/librespot/mercury/RawMercuryRequest.py index 66e7cda..7571142 100644 --- a/librespot/mercury/RawMercuryRequest.py +++ b/librespot/mercury/RawMercuryRequest.py @@ -1,6 +1,7 @@ -from librespot.proto import Mercury import typing +from librespot.proto import Mercury + class RawMercuryRequest: header: Mercury.Header diff --git a/librespot/metadata/__init__.py b/librespot/metadata/__init__.py index 53dcf1e..9c31da4 100644 --- a/librespot/metadata/__init__.py +++ b/librespot/metadata/__init__.py @@ -2,8 +2,7 @@ from __future__ import annotations import re -from librespot.common import Base62 -from librespot.common import Utils +from librespot.common import Base62, Utils from librespot.proto.ContextTrack import ContextTrack diff --git a/librespot/player/Player.py b/librespot/player/Player.py index d812c42..53cc392 100644 --- a/librespot/player/Player.py +++ b/librespot/player/Player.py @@ -6,8 +6,7 @@ import time import typing from librespot.core.Session import Session -from librespot.player import PlayerConfiguration -from librespot.player import StateWrapper +from librespot.player import PlayerConfiguration, StateWrapper from librespot.player.metrics import PlaybackMetrics from librespot.player.mixing import AudioSink from librespot.player.playback.PlayerSession import PlayerSession diff --git a/librespot/player/PlayerConfiguration.py b/librespot/player/PlayerConfiguration.py index 2f93421..56b2f32 100644 --- a/librespot/player/PlayerConfiguration.py +++ b/librespot/player/PlayerConfiguration.py @@ -1,4 +1,5 @@ from __future__ import annotations + from librespot.audio.decoders import AudioQuality diff --git a/librespot/player/StateWrapper.py b/librespot/player/StateWrapper.py index 32ef488..2bc34b7 100644 --- a/librespot/player/StateWrapper.py +++ b/librespot/player/StateWrapper.py @@ -4,14 +4,11 @@ import typing from librespot.core import Session from librespot.dealer import DealerClient -from librespot.player import Player -from librespot.player import PlayerConfiguration +from librespot.player import Player, PlayerConfiguration from librespot.player.state import DeviceStateHandler from librespot.proto import Connect -from librespot.proto.Player import ContextPlayerOptions -from librespot.proto.Player import PlayerState -from librespot.proto.Player import Restrictions -from librespot.proto.Player import Suppressions +from librespot.proto.Player import (ContextPlayerOptions, PlayerState, + Restrictions, Suppressions) class StateWrapper(DeviceStateHandler.Listener, DealerClient.MessageListener): diff --git a/librespot/player/codecs/VorbisOnlyAudioQuality.py b/librespot/player/codecs/VorbisOnlyAudioQuality.py index cbf9f48..82abf3b 100644 --- a/librespot/player/codecs/VorbisOnlyAudioQuality.py +++ b/librespot/player/codecs/VorbisOnlyAudioQuality.py @@ -3,9 +3,9 @@ from __future__ import annotations import logging import typing +from librespot.audio.decoders.AudioQuality import AudioQuality from librespot.audio.format.AudioQualityPicker import AudioQualityPicker from librespot.audio.format.SuperAudioFormat import SuperAudioFormat -from librespot.audio.decoders.AudioQuality import AudioQuality from librespot.proto import Metadata diff --git a/librespot/player/codecs/__init__.py b/librespot/player/codecs/__init__.py index c56b7eb..837810e 100644 --- a/librespot/player/codecs/__init__.py +++ b/librespot/player/codecs/__init__.py @@ -1 +1,2 @@ -from librespot.player.codecs.VorbisOnlyAudioQuality import VorbisOnlyAudioQuality +from librespot.player.codecs.VorbisOnlyAudioQuality import \ + VorbisOnlyAudioQuality diff --git a/librespot/player/state/DeviceStateHandler.py b/librespot/player/state/DeviceStateHandler.py index a47ab66..8e9c7ec 100644 --- a/librespot/player/state/DeviceStateHandler.py +++ b/librespot/player/state/DeviceStateHandler.py @@ -11,8 +11,7 @@ import urllib.parse from librespot.common import Utils from librespot.core import Session from librespot.player import PlayerConfiguration -from librespot.proto import Connect -from librespot.proto import Player +from librespot.proto import Connect, Player class DeviceStateHandler: diff --git a/librespot/proto/CanvazMeta.py b/librespot/proto/CanvazMeta.py index 633eff2..3b28ae5 100644 --- a/librespot/proto/CanvazMeta.py +++ b/librespot/proto/CanvazMeta.py @@ -2,11 +2,11 @@ # Generated by the protocol buffer compiler. DO NOT EDIT! # source: canvaz-meta.proto """Generated protocol buffer code.""" -from google.protobuf.internal import enum_type_wrapper from google.protobuf import descriptor as _descriptor from google.protobuf import message as _message from google.protobuf import reflection as _reflection from google.protobuf import symbol_database as _symbol_database +from google.protobuf.internal import enum_type_wrapper # @@protoc_insertion_point(imports) diff --git a/librespot/proto/Context.py b/librespot/proto/Context.py index 37a1e46..429c9e0 100644 --- a/librespot/proto/Context.py +++ b/librespot/proto/Context.py @@ -2,8 +2,8 @@ # Generated by the protocol buffer compiler. DO NOT EDIT! # source: context.proto """Generated protocol buffer code.""" -import Restrictions as restrictions__pb2 import ContextPage as context__page__pb2 +import Restrictions as restrictions__pb2 from google.protobuf import descriptor as _descriptor from google.protobuf import message as _message from google.protobuf import reflection as _reflection diff --git a/librespot/proto/Playlist4External.py b/librespot/proto/Playlist4External.py index 8a73d6a..525c431 100644 --- a/librespot/proto/Playlist4External.py +++ b/librespot/proto/Playlist4External.py @@ -2,11 +2,11 @@ # Generated by the protocol buffer compiler. DO NOT EDIT! # source: playlist4_external.proto """Generated protocol buffer code.""" -from google.protobuf.internal import enum_type_wrapper from google.protobuf import descriptor as _descriptor from google.protobuf import message as _message from google.protobuf import reflection as _reflection from google.protobuf import symbol_database as _symbol_database +from google.protobuf.internal import enum_type_wrapper # @@protoc_insertion_point(imports) diff --git a/librespot/proto/PlaylistAnnotate3.py b/librespot/proto/PlaylistAnnotate3.py index 2223306..82ac521 100644 --- a/librespot/proto/PlaylistAnnotate3.py +++ b/librespot/proto/PlaylistAnnotate3.py @@ -2,11 +2,11 @@ # Generated by the protocol buffer compiler. DO NOT EDIT! # source: playlist_annotate3.proto """Generated protocol buffer code.""" -from google.protobuf.internal import enum_type_wrapper from google.protobuf import descriptor as _descriptor from google.protobuf import message as _message from google.protobuf import reflection as _reflection from google.protobuf import symbol_database as _symbol_database +from google.protobuf.internal import enum_type_wrapper # @@protoc_insertion_point(imports) diff --git a/librespot/proto/Session.py b/librespot/proto/Session.py index 2f3a48a..6dd7639 100644 --- a/librespot/proto/Session.py +++ b/librespot/proto/Session.py @@ -2,9 +2,9 @@ # Generated by the protocol buffer compiler. DO NOT EDIT! # source: session.proto """Generated protocol buffer code.""" -import PlayOrigin as play__origin__pb2 -import ContextPlayerOptions as context__player__options__pb2 import Context as context__pb2 +import ContextPlayerOptions as context__player__options__pb2 +import PlayOrigin as play__origin__pb2 from google.protobuf import descriptor as _descriptor from google.protobuf import message as _message from google.protobuf import reflection as _reflection diff --git a/librespot/proto/TransferState.py b/librespot/proto/TransferState.py index 35cfc91..d91b542 100644 --- a/librespot/proto/TransferState.py +++ b/librespot/proto/TransferState.py @@ -2,10 +2,10 @@ # Generated by the protocol buffer compiler. DO NOT EDIT! # source: transfer_state.proto """Generated protocol buffer code.""" +import ContextPlayerOptions as context__player__options__pb2 +import Playback as playback__pb2 import Queue as queue__pb2 import Session as session__pb2 -import Playback as playback__pb2 -import ContextPlayerOptions as context__player__options__pb2 from google.protobuf import descriptor as _descriptor from google.protobuf import message as _message from google.protobuf import reflection as _reflection diff --git a/librespot/proto/spotify/login5/v3/Login5.py b/librespot/proto/spotify/login5/v3/Login5.py index 1709776..b24334d 100644 --- a/librespot/proto/spotify/login5/v3/Login5.py +++ b/librespot/proto/spotify/login5/v3/Login5.py @@ -2,29 +2,25 @@ # Generated by the protocol buffer compiler. DO NOT EDIT! # source: spotify/login5/v3/login5.proto """Generated protocol buffer code.""" -from spotify.login5.v3.identifiers import ( - identifiers_pb2 as spotify_dot_login5_dot_v3_dot_identifiers_dot_identifiers__pb2, -) -from spotify.login5.v3.credentials import ( - credentials_pb2 as spotify_dot_login5_dot_v3_dot_credentials_dot_credentials__pb2, -) -from spotify.login5.v3.challenges import ( - hashcash_pb2 as spotify_dot_login5_dot_v3_dot_challenges_dot_hashcash__pb2, -) -from spotify.login5.v3.challenges import ( - code_pb2 as spotify_dot_login5_dot_v3_dot_challenges_dot_code__pb2, -) -from spotify.login5.v3 import ( - user_info_pb2 as spotify_dot_login5_dot_v3_dot_user__info__pb2, -) -from spotify.login5.v3 import ( - client_info_pb2 as spotify_dot_login5_dot_v3_dot_client__info__pb2, -) -from google.protobuf.internal import enum_type_wrapper from google.protobuf import descriptor as _descriptor from google.protobuf import message as _message from google.protobuf import reflection as _reflection from google.protobuf import symbol_database as _symbol_database +from google.protobuf.internal import enum_type_wrapper +from spotify.login5.v3 import \ + client_info_pb2 as spotify_dot_login5_dot_v3_dot_client__info__pb2 +from spotify.login5.v3 import \ + user_info_pb2 as spotify_dot_login5_dot_v3_dot_user__info__pb2 +from spotify.login5.v3.challenges import \ + code_pb2 as spotify_dot_login5_dot_v3_dot_challenges_dot_code__pb2 +from spotify.login5.v3.challenges import \ + hashcash_pb2 as spotify_dot_login5_dot_v3_dot_challenges_dot_hashcash__pb2 +from spotify.login5.v3.credentials import \ + credentials_pb2 as \ + spotify_dot_login5_dot_v3_dot_credentials_dot_credentials__pb2 +from spotify.login5.v3.identifiers import \ + identifiers_pb2 as \ + spotify_dot_login5_dot_v3_dot_identifiers_dot_identifiers__pb2 # @@protoc_insertion_point(imports) diff --git a/librespot/proto/spotify/login5/v3/challenges/Hashcash.py b/librespot/proto/spotify/login5/v3/challenges/Hashcash.py index 18b06b6..12a9457 100644 --- a/librespot/proto/spotify/login5/v3/challenges/Hashcash.py +++ b/librespot/proto/spotify/login5/v3/challenges/Hashcash.py @@ -2,8 +2,9 @@ # Generated by the protocol buffer compiler. DO NOT EDIT! # source: spotify/login5/v3/challenges/hashcash.proto """Generated protocol buffer code.""" -from google.protobuf import duration_pb2 as google_dot_protobuf_dot_duration__pb2 from google.protobuf import descriptor as _descriptor +from google.protobuf import \ + duration_pb2 as google_dot_protobuf_dot_duration__pb2 from google.protobuf import message as _message from google.protobuf import reflection as _reflection from google.protobuf import symbol_database as _symbol_database diff --git a/librespot/zeroconf/Service.py b/librespot/zeroconf/Service.py index 7e93c61..4b8202b 100644 --- a/librespot/zeroconf/Service.py +++ b/librespot/zeroconf/Service.py @@ -1,4 +1,5 @@ from __future__ import annotations + from librespot.zeroconf import Packet diff --git a/librespot/zeroconf/Zeroconf.py b/librespot/zeroconf/Zeroconf.py index 910b9e8..699be83 100644 --- a/librespot/zeroconf/Zeroconf.py +++ b/librespot/zeroconf/Zeroconf.py @@ -1,9 +1,11 @@ from __future__ import annotations -from librespot.standard import Closeable + import base64 import random import socket +from librespot.standard import Closeable + class Zeroconf(Closeable): __DISCOVERY = "_services._dns-sd._udp.local"