MCPcopy Index your code
hub / github.com/python/cpython / __init__

Method __init__

Lib/asyncio/futures.py:75–93  ·  view source on GitHub ↗

Initialize the future. The optional event_loop argument allows explicitly setting the event loop object used by the future. If it's not provided, the future uses the default event loop.

(self, *, loop=None)

Source from the content-addressed store, hash-verified

73 __log_traceback = False
74
75 def __init__(self, *, loop=None):
76 """Initialize the future.
77
78 The optional event_loop argument allows explicitly setting the event
79 loop object used by the future. If it's not provided, the future uses
80 the default event loop.
81 """
82 if self._loop is not None:
83 raise RuntimeError(f"{self.__class__.__name__} object is already "
84 "initialized")
85
86 if loop is None:
87 self._loop = events.get_event_loop()
88 else:
89 self._loop = loop
90 self._callbacks = []
91 if self._loop.get_debug():
92 self._source_traceback = format_helpers.extract_stack(
93 sys._getframe(1))
94
95 def __repr__(self):
96 return base_futures._future_repr(self)

Callers

nothing calls this directly

Calls 2

get_event_loopMethod · 0.45
get_debugMethod · 0.45

Tested by

no test coverage detected