Fix lint nits

This commit is contained in:
Roman Zeyde
2023-07-15 21:48:13 +03:00
parent d8059b5ff0
commit 8557faba6e
6 changed files with 17 additions and 13 deletions

View File

@@ -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:

View File

@@ -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')

View File

@@ -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):

View File

@@ -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)

View File

@@ -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)

View File

@@ -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