mirror of
https://github.com/onyx-and-iris/obsws-python.git
synced 2024-11-22 12:50:53 +00:00
dict expansion for defaultkwarg
This commit is contained in:
parent
051b5898a2
commit
00a97b1d8b
@ -12,8 +12,10 @@ class ObsClient(object):
|
|||||||
DELAY = 0.001
|
DELAY = 0.001
|
||||||
|
|
||||||
def __init__(self, **kwargs):
|
def __init__(self, **kwargs):
|
||||||
defaultkwargs = {key: None for key in ["host", "port", "password"]}
|
defaultkwargs = {
|
||||||
defaultkwargs["subs"] = 0
|
**{key: None for key in ["host", "port", "password"]},
|
||||||
|
"subs": 0,
|
||||||
|
}
|
||||||
kwargs = defaultkwargs | kwargs
|
kwargs = defaultkwargs | kwargs
|
||||||
for attr, val in kwargs.items():
|
for attr, val in kwargs.items():
|
||||||
setattr(self, attr, val)
|
setattr(self, attr, val)
|
||||||
|
@ -23,20 +23,21 @@ class EventClient(object):
|
|||||||
DELAY = 0.001
|
DELAY = 0.001
|
||||||
|
|
||||||
def __init__(self, **kwargs):
|
def __init__(self, **kwargs):
|
||||||
defaultkwargs = dict()
|
defaultkwargs = {
|
||||||
defaultkwargs["subs"] = (
|
"subs": (
|
||||||
(1 << Subs.general)
|
(1 << Subs.general)
|
||||||
| (1 << Subs.config)
|
| (1 << Subs.config)
|
||||||
| (1 << Subs.scenes)
|
| (1 << Subs.scenes)
|
||||||
| (1 << Subs.inputs)
|
| (1 << Subs.inputs)
|
||||||
| (1 << Subs.transitions)
|
| (1 << Subs.transitions)
|
||||||
| (1 << Subs.filters)
|
| (1 << Subs.filters)
|
||||||
| (1 << Subs.outputs)
|
| (1 << Subs.outputs)
|
||||||
| (1 << Subs.sceneitems)
|
| (1 << Subs.sceneitems)
|
||||||
| (1 << Subs.mediainputs)
|
| (1 << Subs.mediainputs)
|
||||||
| (1 << Subs.vendors)
|
| (1 << Subs.vendors)
|
||||||
| (1 << Subs.ui)
|
| (1 << Subs.ui)
|
||||||
)
|
)
|
||||||
|
}
|
||||||
kwargs = defaultkwargs | kwargs
|
kwargs = defaultkwargs | kwargs
|
||||||
self.base_client = ObsClient(**kwargs)
|
self.base_client = ObsClient(**kwargs)
|
||||||
self.base_client.authenticate()
|
self.base_client.authenticate()
|
||||||
|
Loading…
Reference in New Issue
Block a user