Use literal syntax instead of function calls to create data structure

This commit is contained in:
deepsource-autofix[bot] 2021-04-09 23:23:34 +00:00 committed by GitHub
parent 2a5a9b35fb
commit a06c94a69e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 12 additions and 12 deletions

View File

@ -15,7 +15,7 @@ class AudioKeyManager(PacketsReceiver):
_AUDIO_KEY_REQUEST_TIMEOUT: int = 20
_seqHolder: int = 0
_seqHolderLock: threading.Condition = threading.Condition()
_callbacks: dict[int, AudioKeyManager.Callback] = dict()
_callbacks: dict[int, AudioKeyManager.Callback] = {}
_session: Session = None
def __init__(self, session: Session):

View File

@ -15,7 +15,7 @@ import threading
class ChannelManager(Closeable, PacketsReceiver.PacketsReceiver):
CHUNK_SIZE: int = 128 * 1024
_LOGGER: logging = logging.getLogger(__name__)
_channels: dict[int, Channel] = dict()
_channels: dict[int, Channel] = {}
_seqHolder: int = 0
_seqHolderLock: threading.Condition = threading.Condition()
_executorService: concurrent.futures.ThreadPoolExecutor = concurrent.futures.ThreadPoolExecutor(

View File

@ -60,11 +60,11 @@ class Session(Closeable, SubListener, DealerClient.MessageListener):
_authLock: threading.Condition = threading.Condition()
_authLockBool: bool = False
_client: requests.Session = None
_closeListeners: list[Session.CloseListener] = list()
_closeListeners: list[Session.CloseListener] = []
_closeListenersLock: threading.Condition = threading.Condition()
_reconnectionListeners: list[Session.ReconnectionListener] = list()
_reconnectionListeners: list[Session.ReconnectionListener] = []
_reconnectionListenersLock: threading.Condition = threading.Condition()
_userAttributes: dict[str, str] = dict()
_userAttributes: dict[str, str] = {}
_conn: Session.ConnectionHolder = None
_cipherPair: CipherPair = None
_receiver: Session.Receiver = None
@ -379,10 +379,10 @@ class Session(Closeable, SubListener, DealerClient.MessageListener):
with self._closeListenersLock:
for listener in self._closeListeners:
listener.on_closed()
self._closeListeners: list[Session.CloseListener] = list()
self._closeListeners: list[Session.CloseListener] = []
self._reconnectionListeners: list[
Session.ReconnectionListener] = list()
Session.ReconnectionListener] = []
self._LOGGER.info("Closed session. device_id: {}".format(
self._inner.device_id))

View File

@ -17,11 +17,11 @@ class MercuryClient(PacketsReceiver.PacketsReceiver, Closeable):
_MERCURY_REQUEST_TIMEOUT: int = 3
_seqHolder: int = 1
_seqHolderLock: threading.Condition = threading.Condition()
_callbacks: dict[int, Callback] = dict()
_callbacks: dict[int, Callback] = {}
_removeCallbackLock: threading.Condition = threading.Condition()
_subscriptions: list[MercuryClient.InternalSubListener] = list()
_subscriptions: list[MercuryClient.InternalSubListener] = []
_subscriptionsLock: threading.Condition = threading.Condition()
_partials: dict[int, bytes] = dict()
_partials: dict[int, bytes] = {}
_session: Session = None
def __init__(self, session: Session):

View File

@ -22,7 +22,7 @@ class Player(Closeable, PlayerSession.Listener, AudioSink.Listener):
_conf: PlayerConfiguration = None
_events: Player.EventsDispatcher = None
_sink: AudioSink = None
_metrics: dict[str, PlaybackMetrics] = dict()
_metrics: dict[str, PlaybackMetrics] = {}
_state: StateWrapper = None
_playerSession: PlayerSession = None
_releaseLineFuture = None

View File

@ -19,7 +19,7 @@ class DeviceStateHandler:
_LOGGER: logging = logging.getLogger(__name__)
_session: Session = None
_deviceInfo: Connect.DeviceInfo = None
_listeners: list[DeviceStateHandler.Listener] = list()
_listeners: list[DeviceStateHandler.Listener] = []
_putState: Connect.PutStateRequest = None
_putStateWorker: concurrent.futures.ThreadPoolExecutor = (
concurrent.futures.ThreadPoolExecutor())