Use literal syntax instead of function calls to create data structure
This commit is contained in:
committed by
GitHub
parent
2a5a9b35fb
commit
a06c94a69e
@@ -15,7 +15,7 @@ class AudioKeyManager(PacketsReceiver):
|
|||||||
_AUDIO_KEY_REQUEST_TIMEOUT: int = 20
|
_AUDIO_KEY_REQUEST_TIMEOUT: int = 20
|
||||||
_seqHolder: int = 0
|
_seqHolder: int = 0
|
||||||
_seqHolderLock: threading.Condition = threading.Condition()
|
_seqHolderLock: threading.Condition = threading.Condition()
|
||||||
_callbacks: dict[int, AudioKeyManager.Callback] = dict()
|
_callbacks: dict[int, AudioKeyManager.Callback] = {}
|
||||||
_session: Session = None
|
_session: Session = None
|
||||||
|
|
||||||
def __init__(self, session: Session):
|
def __init__(self, session: Session):
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ import threading
|
|||||||
class ChannelManager(Closeable, PacketsReceiver.PacketsReceiver):
|
class ChannelManager(Closeable, PacketsReceiver.PacketsReceiver):
|
||||||
CHUNK_SIZE: int = 128 * 1024
|
CHUNK_SIZE: int = 128 * 1024
|
||||||
_LOGGER: logging = logging.getLogger(__name__)
|
_LOGGER: logging = logging.getLogger(__name__)
|
||||||
_channels: dict[int, Channel] = dict()
|
_channels: dict[int, Channel] = {}
|
||||||
_seqHolder: int = 0
|
_seqHolder: int = 0
|
||||||
_seqHolderLock: threading.Condition = threading.Condition()
|
_seqHolderLock: threading.Condition = threading.Condition()
|
||||||
_executorService: concurrent.futures.ThreadPoolExecutor = concurrent.futures.ThreadPoolExecutor(
|
_executorService: concurrent.futures.ThreadPoolExecutor = concurrent.futures.ThreadPoolExecutor(
|
||||||
|
|||||||
@@ -60,11 +60,11 @@ class Session(Closeable, SubListener, DealerClient.MessageListener):
|
|||||||
_authLock: threading.Condition = threading.Condition()
|
_authLock: threading.Condition = threading.Condition()
|
||||||
_authLockBool: bool = False
|
_authLockBool: bool = False
|
||||||
_client: requests.Session = None
|
_client: requests.Session = None
|
||||||
_closeListeners: list[Session.CloseListener] = list()
|
_closeListeners: list[Session.CloseListener] = []
|
||||||
_closeListenersLock: threading.Condition = threading.Condition()
|
_closeListenersLock: threading.Condition = threading.Condition()
|
||||||
_reconnectionListeners: list[Session.ReconnectionListener] = list()
|
_reconnectionListeners: list[Session.ReconnectionListener] = []
|
||||||
_reconnectionListenersLock: threading.Condition = threading.Condition()
|
_reconnectionListenersLock: threading.Condition = threading.Condition()
|
||||||
_userAttributes: dict[str, str] = dict()
|
_userAttributes: dict[str, str] = {}
|
||||||
_conn: Session.ConnectionHolder = None
|
_conn: Session.ConnectionHolder = None
|
||||||
_cipherPair: CipherPair = None
|
_cipherPair: CipherPair = None
|
||||||
_receiver: Session.Receiver = None
|
_receiver: Session.Receiver = None
|
||||||
@@ -379,10 +379,10 @@ class Session(Closeable, SubListener, DealerClient.MessageListener):
|
|||||||
with self._closeListenersLock:
|
with self._closeListenersLock:
|
||||||
for listener in self._closeListeners:
|
for listener in self._closeListeners:
|
||||||
listener.on_closed()
|
listener.on_closed()
|
||||||
self._closeListeners: list[Session.CloseListener] = list()
|
self._closeListeners: list[Session.CloseListener] = []
|
||||||
|
|
||||||
self._reconnectionListeners: list[
|
self._reconnectionListeners: list[
|
||||||
Session.ReconnectionListener] = list()
|
Session.ReconnectionListener] = []
|
||||||
|
|
||||||
self._LOGGER.info("Closed session. device_id: {}".format(
|
self._LOGGER.info("Closed session. device_id: {}".format(
|
||||||
self._inner.device_id))
|
self._inner.device_id))
|
||||||
|
|||||||
@@ -17,11 +17,11 @@ class MercuryClient(PacketsReceiver.PacketsReceiver, Closeable):
|
|||||||
_MERCURY_REQUEST_TIMEOUT: int = 3
|
_MERCURY_REQUEST_TIMEOUT: int = 3
|
||||||
_seqHolder: int = 1
|
_seqHolder: int = 1
|
||||||
_seqHolderLock: threading.Condition = threading.Condition()
|
_seqHolderLock: threading.Condition = threading.Condition()
|
||||||
_callbacks: dict[int, Callback] = dict()
|
_callbacks: dict[int, Callback] = {}
|
||||||
_removeCallbackLock: threading.Condition = threading.Condition()
|
_removeCallbackLock: threading.Condition = threading.Condition()
|
||||||
_subscriptions: list[MercuryClient.InternalSubListener] = list()
|
_subscriptions: list[MercuryClient.InternalSubListener] = []
|
||||||
_subscriptionsLock: threading.Condition = threading.Condition()
|
_subscriptionsLock: threading.Condition = threading.Condition()
|
||||||
_partials: dict[int, bytes] = dict()
|
_partials: dict[int, bytes] = {}
|
||||||
_session: Session = None
|
_session: Session = None
|
||||||
|
|
||||||
def __init__(self, session: Session):
|
def __init__(self, session: Session):
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ class Player(Closeable, PlayerSession.Listener, AudioSink.Listener):
|
|||||||
_conf: PlayerConfiguration = None
|
_conf: PlayerConfiguration = None
|
||||||
_events: Player.EventsDispatcher = None
|
_events: Player.EventsDispatcher = None
|
||||||
_sink: AudioSink = None
|
_sink: AudioSink = None
|
||||||
_metrics: dict[str, PlaybackMetrics] = dict()
|
_metrics: dict[str, PlaybackMetrics] = {}
|
||||||
_state: StateWrapper = None
|
_state: StateWrapper = None
|
||||||
_playerSession: PlayerSession = None
|
_playerSession: PlayerSession = None
|
||||||
_releaseLineFuture = None
|
_releaseLineFuture = None
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ class DeviceStateHandler:
|
|||||||
_LOGGER: logging = logging.getLogger(__name__)
|
_LOGGER: logging = logging.getLogger(__name__)
|
||||||
_session: Session = None
|
_session: Session = None
|
||||||
_deviceInfo: Connect.DeviceInfo = None
|
_deviceInfo: Connect.DeviceInfo = None
|
||||||
_listeners: list[DeviceStateHandler.Listener] = list()
|
_listeners: list[DeviceStateHandler.Listener] = []
|
||||||
_putState: Connect.PutStateRequest = None
|
_putState: Connect.PutStateRequest = None
|
||||||
_putStateWorker: concurrent.futures.ThreadPoolExecutor = (
|
_putStateWorker: concurrent.futures.ThreadPoolExecutor = (
|
||||||
concurrent.futures.ThreadPoolExecutor())
|
concurrent.futures.ThreadPoolExecutor())
|
||||||
|
|||||||
Reference in New Issue
Block a user