Use a for loop to set the defaults for __call__ params
Instead of setting the default kwargs based on a repeated setdefault() call, just use a for loop to set the defaults. Change-Id: I5c7fd22856912545bf5f95fd07568375dbecbe5b
This commit is contained in:
parent
c90581937c
commit
0c4a564d9c
@ -69,12 +69,9 @@ class Target(object):
|
|||||||
self.fanout = fanout
|
self.fanout = fanout
|
||||||
|
|
||||||
def __call__(self, **kwargs):
|
def __call__(self, **kwargs):
|
||||||
kwargs.setdefault('exchange', self.exchange)
|
for a in ('exchange', 'topic', 'namespace',
|
||||||
kwargs.setdefault('topic', self.topic)
|
'version', 'server', 'fanout'):
|
||||||
kwargs.setdefault('namespace', self.namespace)
|
kwargs.setdefault(a, getattr(self, a))
|
||||||
kwargs.setdefault('version', self.version)
|
|
||||||
kwargs.setdefault('server', self.server)
|
|
||||||
kwargs.setdefault('fanout', self.fanout)
|
|
||||||
return Target(**kwargs)
|
return Target(**kwargs)
|
||||||
|
|
||||||
def __eq__(self, other):
|
def __eq__(self, other):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user