| 188 | |
| 189 | |
| 190 | class 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 | |
| 215 | class MySubprocessProtocol(asyncio.SubprocessProtocol): |
no outgoing calls
searching dependent graphs…