dict expansion for defaultkwarg

This commit is contained in:
onyx-and-iris 2022-07-28 10:00:24 +01:00
parent 051b5898a2
commit 00a97b1d8b
2 changed files with 19 additions and 16 deletions

View File

@ -12,8 +12,10 @@ class ObsClient(object):
DELAY = 0.001
def __init__(self, **kwargs):
defaultkwargs = {key: None for key in ["host", "port", "password"]}
defaultkwargs["subs"] = 0
defaultkwargs = {
**{key: None for key in ["host", "port", "password"]},
"subs": 0,
}
kwargs = defaultkwargs | kwargs
for attr, val in kwargs.items():
setattr(self, attr, val)

View File

@ -23,8 +23,8 @@ class EventClient(object):
DELAY = 0.001
def __init__(self, **kwargs):
defaultkwargs = dict()
defaultkwargs["subs"] = (
defaultkwargs = {
"subs": (
(1 << Subs.general)
| (1 << Subs.config)
| (1 << Subs.scenes)
@ -37,6 +37,7 @@ class EventClient(object):
| (1 << Subs.vendors)
| (1 << Subs.ui)
)
}
kwargs = defaultkwargs | kwargs
self.base_client = ObsClient(**kwargs)
self.base_client.authenticate()