mirror of
https://github.com/romanz/amodem.git
synced 2026-02-25 00:31:08 +08:00
Fix lint nits
This commit is contained in:
@@ -88,11 +88,11 @@ def FileType(mode, interface_factory=None):
|
||||
|
||||
|
||||
def get_volume_cmd(args):
|
||||
volume_controllers = [
|
||||
dict(test='pactl --version',
|
||||
send='pactl set-sink-volume @DEFAULT_SINK@',
|
||||
recv='pactl set-source-volume @DEFAULT_SOURCE@')
|
||||
]
|
||||
volume_controllers = [{
|
||||
'test': 'pactl --version',
|
||||
'send': 'pactl set-sink-volume @DEFAULT_SINK@',
|
||||
'recv': 'pactl set-source-volume @DEFAULT_SOURCE@'
|
||||
}]
|
||||
if args.calibrate == 'auto':
|
||||
for c in volume_controllers:
|
||||
if os.system(c['test']) == 0:
|
||||
|
||||
@@ -7,6 +7,10 @@ import time
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class AudioError(Exception):
|
||||
pass
|
||||
|
||||
|
||||
class Interface:
|
||||
def __init__(self, config, debug=False):
|
||||
self.debug = bool(debug)
|
||||
@@ -35,7 +39,7 @@ class Interface:
|
||||
|
||||
def _error_check(self, res):
|
||||
if res != 0:
|
||||
raise Exception(res, self._error_string(res))
|
||||
raise AudioError(res, self._error_string(res))
|
||||
|
||||
def __enter__(self):
|
||||
self.call('Initialize')
|
||||
|
||||
@@ -75,10 +75,10 @@ def detector(config, src, frame_length=200):
|
||||
else:
|
||||
msg = f'too {errors[flags.index(False)]} signal'
|
||||
|
||||
yield dict(
|
||||
freq=freq, rms=rms, peak=peak, coherency=coherency,
|
||||
total=total, success=success, msg=msg
|
||||
)
|
||||
yield {
|
||||
'freq': freq, 'rms': rms, 'peak': peak, 'coherency': coherency,
|
||||
'total': total, 'success': success, 'msg': msg
|
||||
}
|
||||
|
||||
|
||||
def volume_calibration(result_iterator, volume_ctl):
|
||||
|
||||
@@ -79,7 +79,7 @@ class MODEM:
|
||||
symbols = np.array(list(symbols))
|
||||
bits_per_symbol = np.log2(len(symbols))
|
||||
bits_per_symbol = np.round(bits_per_symbol)
|
||||
N = (2 ** bits_per_symbol)
|
||||
N = 2 ** bits_per_symbol
|
||||
assert N == len(symbols)
|
||||
bits_per_symbol = int(bits_per_symbol)
|
||||
|
||||
|
||||
@@ -43,7 +43,7 @@ class Receiver:
|
||||
self.plt.subplot(1, 2, 2)
|
||||
self.plt.plot(np.abs(S))
|
||||
self.plt.plot(equalizer.prefix)
|
||||
errors = (bits != equalizer.prefix)
|
||||
errors = bits != equalizer.prefix
|
||||
if any(errors):
|
||||
msg = f'Incorrect prefix: {sum(errors)} errors'
|
||||
raise ValueError(msg)
|
||||
|
||||
@@ -5,7 +5,7 @@ class Reader:
|
||||
|
||||
wait = 0.2
|
||||
timeout = 2.0
|
||||
bufsize = (8 << 10)
|
||||
bufsize = 8 << 10
|
||||
|
||||
def __init__(self, fd, data_type=None, eof=False):
|
||||
self.fd = fd
|
||||
|
||||
Reference in New Issue
Block a user