Simple datapoint sender script for testing local DP3 instance.
batched
Batch data into tuples of length n. The last batch may be shorter.
Source code in dp3/scripts/dummy_sender.py
| def batched(iterable, n):
"""Batch data into tuples of length n. The last batch may be shorter."""
# batched('ABCDEFG', 3) --> ABC DEF G
if n < 1:
raise ValueError("n must be at least one")
it = iter(iterable)
while batch := list(islice(it, n)):
yield batch
|