mirror of
https://github.com/romanz/amodem.git
synced 2026-04-05 12:16:24 +08:00
send.py should write everything to stdout (without buffering)
This commit is contained in:
@@ -73,14 +73,17 @@ def dumps(sym, n=1):
|
||||
return data * n
|
||||
|
||||
|
||||
def iterate(data, size, func=None):
|
||||
def iterate(data, size, func=None, truncate=True):
|
||||
offset = 0
|
||||
data = iter(data)
|
||||
|
||||
while True:
|
||||
done = False
|
||||
while not done:
|
||||
buf = list(itertools.islice(data, size))
|
||||
if len(buf) < size:
|
||||
return
|
||||
if truncate or not buf:
|
||||
return
|
||||
done = True
|
||||
|
||||
buf = np.array(buf)
|
||||
result = func(buf) if func else buf
|
||||
|
||||
Reference in New Issue
Block a user