MCPcopy
hub / github.com/tornadoweb/tornado / __init__

Method __init__

tornado/gen.py:369–386  ·  view source on GitHub ↗
(self, *args: Future, **kwargs: Future)

Source from the content-addressed store, hash-verified

367 _unfinished = {} # type: Dict[Future, Union[int, str]]
368
369 def __init__(self, *args: Future, **kwargs: Future) -> None:
370 if args and kwargs:
371 raise ValueError("You must provide args or kwargs, not both")
372
373 if kwargs:
374 self._unfinished = {f: k for (k, f) in kwargs.items()}
375 futures = list(kwargs.values()) # type: Sequence[Future]
376 else:
377 self._unfinished = {f: i for (i, f) in enumerate(args)}
378 futures = args
379
380 self._finished = collections.deque() # type: Deque[Future]
381 self.current_index = None # type: Optional[Union[str, int]]
382 self.current_future = None # type: Optional[Future]
383 self._running_future = None # type: Optional[Future]
384
385 for future in futures:
386 future_add_done_callback(future, self._done_callback)
387
388 def done(self) -> bool:
389 """Returns True if this iterator has no more results."""

Callers

nothing calls this directly

Calls 2

future_add_done_callbackFunction · 0.90
itemsMethod · 0.80

Tested by

no test coverage detected