mirror of
https://github.com/romanz/amodem.git
synced 2026-02-24 16:18:12 +08:00
common: move AttributeHolder
This commit is contained in:
@@ -66,7 +66,7 @@ def detector(config, src):
|
||||
error_index = flags.index(False)
|
||||
message = 'too {0} signal'.format(errors[error_index])
|
||||
|
||||
yield AttributeHolder(dict(
|
||||
yield common.AttributeHolder(dict(
|
||||
freq=freq, rms=rms, peak=peak, coherency=coherency,
|
||||
total=total, error=error, message=message
|
||||
))
|
||||
@@ -74,11 +74,6 @@ def detector(config, src):
|
||||
pass
|
||||
|
||||
|
||||
class AttributeHolder(object):
|
||||
def __init__(self, d):
|
||||
self.__dict__.update(d)
|
||||
|
||||
|
||||
def recv(config, src, verbose=False):
|
||||
fmt = '{0.freq:6.0f} Hz: {0.message:s}'
|
||||
if verbose:
|
||||
|
||||
@@ -72,3 +72,12 @@ class Dummy(object):
|
||||
|
||||
def __call__(self, *args, **kwargs):
|
||||
return self
|
||||
|
||||
|
||||
class AttributeHolder(object):
|
||||
|
||||
def __init__(self, d):
|
||||
self.__dict__.update(d)
|
||||
|
||||
def __repr__(self):
|
||||
return '{}({})'.format(self.__class__.__name__, self.__dict__)
|
||||
|
||||
Reference in New Issue
Block a user