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

Class MyProtocol

Lib/test/test_asyncio/test_subprocess.py:833–852  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

831 ]
832
833 class MyProtocol(asyncio.SubprocessProtocol):
834 def __init__(self, exit_future: asyncio.Future) -> None:
835 self.exit_future = exit_future
836
837 def pipe_data_received(self, fd, data) -> None:
838 events.append(('pipe_data_received', fd, data))
839 self.exit_maybe()
840
841 def pipe_connection_lost(self, fd, exc) -> None:
842 events.append(('pipe_connection_lost', fd))
843 self.exit_maybe()
844
845 def process_exited(self) -> None:
846 events.append('process_exited')
847 self.exit_maybe()
848
849 def exit_maybe(self):
850 # Only exit when we got all expected events
851 if len(events) >= len(expected):
852 self.exit_future.set_result(True)
853
854 async def main() -> None:
855 loop = asyncio.get_running_loop()

Callers 1

mainMethod · 0.85

Calls

no outgoing calls

Tested by 1

mainMethod · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…