Skip to content

Instantly share code, notes, and snippets.

@arthur-tacca
arthur-tacca / wrap.py
Last active February 14, 2024 17:08 — forked from smurfix/wrap.py
Trio: results-gathering nursery wrapper
# Original idea by smurfix: https://gist.github.com/smurfix/0130817fa5ba6d3bb4a0f00e4d93cf86
# aioresult variant: https://gist.github.com/arthur-tacca/5c717ae68ac037e72ae45fd1e9ca1345
from collections import deque
import math
import trio
class StreamResultsNursery:
def __init__(self, max_running_tasks=math.inf):