Restyled by isort

This commit is contained in:
Restyled.io 2021-05-22 01:26:35 +00:00
parent 544c57ff1f
commit adb111fa8b
32 changed files with 100 additions and 105 deletions

View File

@ -10,8 +10,7 @@ from librespot.common import Utils
from librespot.core import Session from librespot.core import Session
from librespot.crypto import DiffieHellman from librespot.crypto import DiffieHellman
from librespot.proto import Connect from librespot.proto import Connect
from librespot.standard import Closeable from librespot.standard import Closeable, Runnable
from librespot.standard import Runnable
class ZeroconfServer(Closeable): class ZeroconfServer(Closeable):

View File

@ -1,16 +1,16 @@
from __future__ import annotations from __future__ import annotations
import logging
import queue
import struct import struct
import threading
import typing
from librespot.common import Utils from librespot.common import Utils
from librespot.core import Session from librespot.core import Session
from librespot.core.PacketsReceiver import PacketsReceiver from librespot.core.PacketsReceiver import PacketsReceiver
from librespot.crypto import Packet from librespot.crypto import Packet
from librespot.standard import BytesInputStream, ByteArrayOutputStream from librespot.standard import ByteArrayOutputStream, BytesInputStream
import logging
import queue
import threading
import typing
class AudioKeyManager(PacketsReceiver): class AudioKeyManager(PacketsReceiver):

View File

@ -1,5 +1,8 @@
from __future__ import annotations from __future__ import annotations
import logging
import typing
from librespot.audio import GeneralAudioStream, HaltListener, NormalizationData from librespot.audio import GeneralAudioStream, HaltListener, NormalizationData
from librespot.audio.cdn import CdnFeedHelper from librespot.audio.cdn import CdnFeedHelper
from librespot.audio.format import AudioQualityPicker from librespot.audio.format import AudioQualityPicker
@ -7,8 +10,6 @@ from librespot.common.Utils import Utils
from librespot.core import Session from librespot.core import Session
from librespot.metadata import PlayableId, TrackId from librespot.metadata import PlayableId, TrackId
from librespot.proto import Metadata, StorageResolve from librespot.proto import Metadata, StorageResolve
import logging
import typing
class PlayableContentFeeder: class PlayableContentFeeder:

View File

@ -5,13 +5,11 @@ import random
import time import time
import typing import typing
from librespot.audio import HaltListener from librespot.audio import (HaltListener, NormalizationData,
from librespot.audio import NormalizationData PlayableContentFeeder)
from librespot.audio import PlayableContentFeeder
from librespot.common import Utils from librespot.common import Utils
from librespot.core import Session from librespot.core import Session
from librespot.proto import Metadata from librespot.proto import Metadata, StorageResolve
from librespot.proto import StorageResolve
class CdnFeedHelper: class CdnFeedHelper:

View File

@ -8,12 +8,9 @@ import time
import typing import typing
import urllib.parse import urllib.parse
from librespot.audio import GeneralAudioStream from librespot.audio import GeneralAudioStream, GeneralWritableStream, StreamId
from librespot.audio import GeneralWritableStream
from librespot.audio import StreamId
from librespot.audio.AbsChunkedInputStream import AbsChunkedInputStream from librespot.audio.AbsChunkedInputStream import AbsChunkedInputStream
from librespot.audio.decrypt import AesAudioDecrypt from librespot.audio.decrypt import AesAudioDecrypt, NoopAudioDecrypt
from librespot.audio.decrypt import NoopAudioDecrypt
from librespot.audio.format import SuperAudioFormat from librespot.audio.format import SuperAudioFormat
from librespot.audio.storage import ChannelManager from librespot.audio.storage import ChannelManager
from librespot.common import Utils from librespot.common import Utils

View File

@ -1,8 +1,10 @@
from __future__ import annotations from __future__ import annotations
from librespot.proto.Metadata import AudioFile
import enum import enum
import typing import typing
from librespot.proto.Metadata import AudioFile
class AudioQuality(enum.Enum): class AudioQuality(enum.Enum):
NORMAL = 0x00 NORMAL = 0x00

View File

@ -1,8 +1,10 @@
import time
from Crypto.Cipher import AES from Crypto.Cipher import AES
from Crypto.Util import Counter from Crypto.Util import Counter
from librespot.audio.storage import ChannelManager
from librespot.audio.decrypt.AudioDecrypt import AudioDecrypt from librespot.audio.decrypt.AudioDecrypt import AudioDecrypt
import time from librespot.audio.storage import ChannelManager
class AesAudioDecrypt(AudioDecrypt): class AesAudioDecrypt(AudioDecrypt):

View File

@ -1,4 +1,5 @@
from __future__ import annotations from __future__ import annotations
import typing import typing
if typing.TYPE_CHECKING: if typing.TYPE_CHECKING:

View File

@ -1,16 +1,17 @@
from __future__ import annotations from __future__ import annotations
import concurrent.futures
import logging
import queue import queue
import threading
import typing
from librespot.audio.storage import AudioFile from librespot.audio.storage import AudioFile
from librespot.common import Utils from librespot.common import Utils
from librespot.core import PacketsReceiver, Session from librespot.core import PacketsReceiver, Session
from librespot.crypto import Packet from librespot.crypto import Packet
from librespot.standard import BytesInputStream, BytesOutputStream, Closeable, Runnable from librespot.standard import (BytesInputStream, BytesOutputStream, Closeable,
import concurrent.futures Runnable)
import logging
import threading
import typing
class ChannelManager(Closeable, PacketsReceiver.PacketsReceiver): class ChannelManager(Closeable, PacketsReceiver.PacketsReceiver):

View File

@ -13,35 +13,23 @@ import typing
import defusedxml.ElementTree import defusedxml.ElementTree
import requests import requests
from Crypto.Hash import HMAC from Crypto.Hash import HMAC, SHA1
from Crypto.Hash import SHA1
from Crypto.PublicKey import RSA from Crypto.PublicKey import RSA
from Crypto.Signature import PKCS1_v1_5 from Crypto.Signature import PKCS1_v1_5
from librespot.audio import AudioKeyManager from librespot.audio import AudioKeyManager, PlayableContentFeeder
from librespot.audio import PlayableContentFeeder
from librespot.audio.cdn import CdnManager from librespot.audio.cdn import CdnManager
from librespot.audio.storage import ChannelManager from librespot.audio.storage import ChannelManager
from librespot.cache import CacheManager from librespot.cache import CacheManager
from librespot.common.Utils import Utils from librespot.common.Utils import Utils
from librespot.core import ApResolver from librespot.core import (ApResolver, EventService, SearchManager,
from librespot.core import EventService TokenProvider)
from librespot.core import SearchManager from librespot.crypto import CipherPair, DiffieHellman, Packet
from librespot.core import TokenProvider from librespot.dealer import ApiClient, DealerClient
from librespot.crypto import CipherPair from librespot.mercury import MercuryClient, SubListener
from librespot.crypto import DiffieHellman from librespot.proto import Authentication, Connect, Keyexchange
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.proto.ExplicitContentPubsub import UserAttributesUpdate from librespot.proto.ExplicitContentPubsub import UserAttributesUpdate
from librespot.standard import BytesInputStream from librespot.standard import BytesInputStream, Closeable, Proxy
from librespot.standard import Closeable
from librespot.standard import Proxy
from librespot.Version import Version from librespot.Version import Version

View File

@ -1,9 +1,11 @@
from __future__ import annotations from __future__ import annotations
from librespot.core import Session, TimeProvider
from librespot.mercury import MercuryRequests
import logging import logging
import typing import typing
from librespot.core import Session, TimeProvider
from librespot.mercury import MercuryRequests
class TokenProvider: class TokenProvider:
_LOGGER: logging = logging.getLogger(__name__) _LOGGER: logging = logging.getLogger(__name__)

View File

@ -1,10 +1,12 @@
import logging
import typing
import requests
from librespot.core.ApResolver import ApResolver 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.proto import Connect, Metadata
from librespot.standard import Closeable from librespot.standard import Closeable
import logging
import requests
import typing
class ApiClient(Closeable): class ApiClient(Closeable):

View File

@ -1,7 +1,9 @@
from __future__ import annotations from __future__ import annotations
from librespot.standard.Closeable import Closeable
import typing import typing
from librespot.standard.Closeable import Closeable
class DealerClient(Closeable): class DealerClient(Closeable):
def __init__(self, session): def __init__(self, session):

View File

@ -1,16 +1,19 @@
from __future__ import annotations 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 json
import logging import logging
import queue import queue
import threading import threading
import typing 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): class MercuryClient(PacketsReceiver.PacketsReceiver, Closeable):
_LOGGER: logging = logging.getLogger(__name__) _LOGGER: logging = logging.getLogger(__name__)

View File

@ -1,6 +1,7 @@
from librespot.proto import Mercury
import typing import typing
from librespot.proto import Mercury
class RawMercuryRequest: class RawMercuryRequest:
header: Mercury.Header header: Mercury.Header

View File

@ -2,8 +2,7 @@ from __future__ import annotations
import re import re
from librespot.common import Base62 from librespot.common import Base62, Utils
from librespot.common import Utils
from librespot.proto.ContextTrack import ContextTrack from librespot.proto.ContextTrack import ContextTrack

View File

@ -6,8 +6,7 @@ import time
import typing import typing
from librespot.core.Session import Session from librespot.core.Session import Session
from librespot.player import PlayerConfiguration from librespot.player import PlayerConfiguration, StateWrapper
from librespot.player import StateWrapper
from librespot.player.metrics import PlaybackMetrics from librespot.player.metrics import PlaybackMetrics
from librespot.player.mixing import AudioSink from librespot.player.mixing import AudioSink
from librespot.player.playback.PlayerSession import PlayerSession from librespot.player.playback.PlayerSession import PlayerSession

View File

@ -1,4 +1,5 @@
from __future__ import annotations from __future__ import annotations
from librespot.audio.decoders import AudioQuality from librespot.audio.decoders import AudioQuality

View File

@ -4,14 +4,11 @@ import typing
from librespot.core import Session from librespot.core import Session
from librespot.dealer import DealerClient from librespot.dealer import DealerClient
from librespot.player import Player from librespot.player import Player, PlayerConfiguration
from librespot.player import PlayerConfiguration
from librespot.player.state import DeviceStateHandler from librespot.player.state import DeviceStateHandler
from librespot.proto import Connect from librespot.proto import Connect
from librespot.proto.Player import ContextPlayerOptions from librespot.proto.Player import (ContextPlayerOptions, PlayerState,
from librespot.proto.Player import PlayerState Restrictions, Suppressions)
from librespot.proto.Player import Restrictions
from librespot.proto.Player import Suppressions
class StateWrapper(DeviceStateHandler.Listener, DealerClient.MessageListener): class StateWrapper(DeviceStateHandler.Listener, DealerClient.MessageListener):

View File

@ -3,9 +3,9 @@ from __future__ import annotations
import logging import logging
import typing import typing
from librespot.audio.decoders.AudioQuality import AudioQuality
from librespot.audio.format.AudioQualityPicker import AudioQualityPicker from librespot.audio.format.AudioQualityPicker import AudioQualityPicker
from librespot.audio.format.SuperAudioFormat import SuperAudioFormat from librespot.audio.format.SuperAudioFormat import SuperAudioFormat
from librespot.audio.decoders.AudioQuality import AudioQuality
from librespot.proto import Metadata from librespot.proto import Metadata

View File

@ -1 +1,2 @@
from librespot.player.codecs.VorbisOnlyAudioQuality import VorbisOnlyAudioQuality from librespot.player.codecs.VorbisOnlyAudioQuality import \
VorbisOnlyAudioQuality

View File

@ -11,8 +11,7 @@ import urllib.parse
from librespot.common import Utils from librespot.common import Utils
from librespot.core import Session from librespot.core import Session
from librespot.player import PlayerConfiguration from librespot.player import PlayerConfiguration
from librespot.proto import Connect from librespot.proto import Connect, Player
from librespot.proto import Player
class DeviceStateHandler: class DeviceStateHandler:

View File

@ -2,11 +2,11 @@
# Generated by the protocol buffer compiler. DO NOT EDIT! # Generated by the protocol buffer compiler. DO NOT EDIT!
# source: canvaz-meta.proto # source: canvaz-meta.proto
"""Generated protocol buffer code.""" """Generated protocol buffer code."""
from google.protobuf.internal import enum_type_wrapper
from google.protobuf import descriptor as _descriptor from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message from google.protobuf import message as _message
from google.protobuf import reflection as _reflection from google.protobuf import reflection as _reflection
from google.protobuf import symbol_database as _symbol_database from google.protobuf import symbol_database as _symbol_database
from google.protobuf.internal import enum_type_wrapper
# @@protoc_insertion_point(imports) # @@protoc_insertion_point(imports)

View File

@ -2,8 +2,8 @@
# Generated by the protocol buffer compiler. DO NOT EDIT! # Generated by the protocol buffer compiler. DO NOT EDIT!
# source: context.proto # source: context.proto
"""Generated protocol buffer code.""" """Generated protocol buffer code."""
import Restrictions as restrictions__pb2
import ContextPage as context__page__pb2 import ContextPage as context__page__pb2
import Restrictions as restrictions__pb2
from google.protobuf import descriptor as _descriptor from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message from google.protobuf import message as _message
from google.protobuf import reflection as _reflection from google.protobuf import reflection as _reflection

View File

@ -2,11 +2,11 @@
# Generated by the protocol buffer compiler. DO NOT EDIT! # Generated by the protocol buffer compiler. DO NOT EDIT!
# source: playlist4_external.proto # source: playlist4_external.proto
"""Generated protocol buffer code.""" """Generated protocol buffer code."""
from google.protobuf.internal import enum_type_wrapper
from google.protobuf import descriptor as _descriptor from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message from google.protobuf import message as _message
from google.protobuf import reflection as _reflection from google.protobuf import reflection as _reflection
from google.protobuf import symbol_database as _symbol_database from google.protobuf import symbol_database as _symbol_database
from google.protobuf.internal import enum_type_wrapper
# @@protoc_insertion_point(imports) # @@protoc_insertion_point(imports)

View File

@ -2,11 +2,11 @@
# Generated by the protocol buffer compiler. DO NOT EDIT! # Generated by the protocol buffer compiler. DO NOT EDIT!
# source: playlist_annotate3.proto # source: playlist_annotate3.proto
"""Generated protocol buffer code.""" """Generated protocol buffer code."""
from google.protobuf.internal import enum_type_wrapper
from google.protobuf import descriptor as _descriptor from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message from google.protobuf import message as _message
from google.protobuf import reflection as _reflection from google.protobuf import reflection as _reflection
from google.protobuf import symbol_database as _symbol_database from google.protobuf import symbol_database as _symbol_database
from google.protobuf.internal import enum_type_wrapper
# @@protoc_insertion_point(imports) # @@protoc_insertion_point(imports)

View File

@ -2,9 +2,9 @@
# Generated by the protocol buffer compiler. DO NOT EDIT! # Generated by the protocol buffer compiler. DO NOT EDIT!
# source: session.proto # source: session.proto
"""Generated protocol buffer code.""" """Generated protocol buffer code."""
import PlayOrigin as play__origin__pb2
import ContextPlayerOptions as context__player__options__pb2
import Context as context__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 descriptor as _descriptor
from google.protobuf import message as _message from google.protobuf import message as _message
from google.protobuf import reflection as _reflection from google.protobuf import reflection as _reflection

View File

@ -2,10 +2,10 @@
# Generated by the protocol buffer compiler. DO NOT EDIT! # Generated by the protocol buffer compiler. DO NOT EDIT!
# source: transfer_state.proto # source: transfer_state.proto
"""Generated protocol buffer code.""" """Generated protocol buffer code."""
import ContextPlayerOptions as context__player__options__pb2
import Playback as playback__pb2
import Queue as queue__pb2 import Queue as queue__pb2
import Session as session__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 descriptor as _descriptor
from google.protobuf import message as _message from google.protobuf import message as _message
from google.protobuf import reflection as _reflection from google.protobuf import reflection as _reflection

View File

@ -2,29 +2,25 @@
# Generated by the protocol buffer compiler. DO NOT EDIT! # Generated by the protocol buffer compiler. DO NOT EDIT!
# source: spotify/login5/v3/login5.proto # source: spotify/login5/v3/login5.proto
"""Generated protocol buffer code.""" """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 descriptor as _descriptor
from google.protobuf import message as _message from google.protobuf import message as _message
from google.protobuf import reflection as _reflection from google.protobuf import reflection as _reflection
from google.protobuf import symbol_database as _symbol_database 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) # @@protoc_insertion_point(imports)

View File

@ -2,8 +2,9 @@
# Generated by the protocol buffer compiler. DO NOT EDIT! # Generated by the protocol buffer compiler. DO NOT EDIT!
# source: spotify/login5/v3/challenges/hashcash.proto # source: spotify/login5/v3/challenges/hashcash.proto
"""Generated protocol buffer code.""" """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 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 message as _message
from google.protobuf import reflection as _reflection from google.protobuf import reflection as _reflection
from google.protobuf import symbol_database as _symbol_database from google.protobuf import symbol_database as _symbol_database

View File

@ -1,4 +1,5 @@
from __future__ import annotations from __future__ import annotations
from librespot.zeroconf import Packet from librespot.zeroconf import Packet

View File

@ -1,9 +1,11 @@
from __future__ import annotations from __future__ import annotations
from librespot.standard import Closeable
import base64 import base64
import random import random
import socket import socket
from librespot.standard import Closeable
class Zeroconf(Closeable): class Zeroconf(Closeable):
__DISCOVERY = "_services._dns-sd._udp.local" __DISCOVERY = "_services._dns-sd._udp.local"