Skip to content

Commit b780a2f

Browse files
committed
Remove flush=True from examples
1 parent 1aec2d6 commit b780a2f

2 files changed

Lines changed: 6 additions & 5 deletions

File tree

examples/spectrogram.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,15 +70,15 @@ def callback(indata, frames, time, status):
7070
if status:
7171
text = ' ' + str(status) + ' '
7272
print('\x1b[34;40m', text.center(args.columns, '#'),
73-
'\x1b[0m', sep='', flush=True)
73+
'\x1b[0m', sep='')
7474
if any(indata):
7575
magnitude = np.abs(np.fft.rfft(indata[:, 0], n=fftsize))
7676
magnitude *= args.gain / fftsize
7777
line = (gradient[int(np.clip(x, 0, 1) * (len(gradient) - 1))]
7878
for x in magnitude[low_bin:low_bin + args.columns])
79-
print(*line, sep='', end='\x1b[0m\n', flush=True)
79+
print(*line, sep='', end='\x1b[0m\n')
8080
else:
81-
print('no input', flush=True)
81+
print('no input')
8282

8383
with sd.InputStream(device=args.device, channels=1, callback=callback,
8484
blocksize=int(samplerate * args.block_duration / 1000),
@@ -94,7 +94,7 @@ def callback(indata, frames, time, status):
9494
args.gain /= 2
9595
else:
9696
print('\x1b[31;40m', usage_line.center(args.columns, '#'),
97-
'\x1b[0m', sep='', flush=True)
97+
'\x1b[0m', sep='')
9898
break
9999
except KeyboardInterrupt:
100100
parser.exit('Interrupted by user')

examples/wire.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ def int_or_str(text):
1515
except ValueError:
1616
return text
1717

18+
1819
parser = argparse.ArgumentParser(description=__doc__)
1920
parser.add_argument('-i', '--input-device', type=int_or_str,
2021
help='input device ID or substring')
@@ -33,7 +34,7 @@ def int_or_str(text):
3334

3435
def callback(indata, outdata, frames, time, status):
3536
if status:
36-
print(status, flush=True)
37+
print(status)
3738
outdata[:] = indata
3839

3940
with sd.Stream(device=(args.input_device, args.output_device),

0 commit comments

Comments
 (0)