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

Class MyWritePipeProto

Lib/test/test_asyncio/test_events.py:190–212  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

188
189
190class MyWritePipeProto(asyncio.BaseProtocol):
191 done = None
192
193 def __init__(self, loop=None):
194 self.state = 'INITIAL'
195 self.transport = None
196 if loop is not None:
197 self.done = loop.create_future()
198
199 def _assert_state(self, expected):
200 if self.state != expected:
201 raise AssertionError(f'state: {self.state!r}, expected: {expected!r}')
202
203 def connection_made(self, transport):
204 self.transport = transport
205 self._assert_state('INITIAL')
206 self.state = 'CONNECTED'
207
208 def connection_lost(self, exc):
209 self._assert_state('CONNECTED')
210 self.state = 'CLOSED'
211 if self.done:
212 self.done.set_result(None)
213
214
215class MySubprocessProtocol(asyncio.SubprocessProtocol):

Callers 5

test_write_pipeMethod · 0.85
test_write_ptyMethod · 0.85

Calls

no outgoing calls

Tested by 5

test_write_pipeMethod · 0.68
test_write_ptyMethod · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…