codegen.py: use open() instead of file()

master
András Veres-Szentkirályi 2023-11-06 08:28:13 +01:00
rodzic 5d3d6a2584
commit cb00cf20ad
1 zmienionych plików z 3 dodań i 3 usunięć

Wyświetl plik

@ -138,12 +138,12 @@ def test(img_file):
assert gen[n * 8:(n + 1) * 8] == struct.pack('ff', freq, msec)
except AssertionError:
mode_name = sstv_class.__name__
with file('/tmp/{0}-c.bin'.format(mode_name), 'wb') as f:
with open('/tmp/{0}-c.bin'.format(mode_name), 'wb') as f:
f.write(gen)
with file('/tmp/{0}-py.bin'.format(mode_name), 'wb') as f:
with open('/tmp/{0}-py.bin'.format(mode_name), 'wb') as f:
for n, (freq, msec) in enumerate(sstv.gen_freq_bits()):
f.write(struct.pack('ff', freq, msec))
with file('/tmp/{0}.c'.format(mode_name), 'w') as f:
with open('/tmp/{0}.c'.format(mode_name), 'w') as f:
f.write(c_src)
print((" ! Outputs are different, they've been saved to "
"/tmp/{0}-{{c,py}}.bin, along with the C source code "