MCPcopy Index your code
hub / github.com/RustPython/RustPython / recv

Method recv

Lib/test/support/channels.py:136–159  ·  view source on GitHub ↗

Return the next object from the channel. This blocks until an object has been sent, if none have been sent already.

(self, timeout=None, *,
             _sentinel=object(),
             _delay=10 / 1000,  # 10 milliseconds
             )

Source from the content-addressed store, hash-verified

134 _end = 'recv'
135
136 def recv(self, timeout=None, *,
137 _sentinel=object(),
138 _delay=10 / 1000, # 10 milliseconds
139 ):
140 """Return the next object from the channel.
141
142 This blocks until an object has been sent, if none have been
143 sent already.
144 """
145 if timeout is not None:
146 timeout = int(timeout)
147 if timeout < 0:
148 raise ValueError(f'timeout value must be non-negative')
149 end = time.time() + timeout
150 obj, unboundop = _channels.recv(self._id, _sentinel)
151 while obj is _sentinel:
152 time.sleep(_delay)
153 if timeout is not None and time.time() >= end:
154 raise TimeoutError
155 obj, unboundop = _channels.recv(self._id, _sentinel)
156 if unboundop is not None:
157 assert obj is None, repr(obj)
158 return _resolve_unbound(unboundop)
159 return obj
160
161 def recv_nowait(self, default=_NOT_SET):
162 """Return the next object from the channel.

Callers 1

recv_nowaitMethod · 0.45

Calls 4

reprFunction · 0.85
_resolve_unboundFunction · 0.85
timeMethod · 0.45
sleepMethod · 0.45

Tested by

no test coverage detected