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

Class MyProtocol

Lib/test/test_asyncio/test_subprocess.py:802–821  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

800 ]
801
802 class MyProtocol(asyncio.SubprocessProtocol):
803 def __init__(self, exit_future: asyncio.Future) -> None:
804 self.exit_future = exit_future
805
806 def pipe_data_received(self, fd, data) -> None:
807 events.append(('pipe_data_received', fd, data))
808 self.exit_maybe()
809
810 def pipe_connection_lost(self, fd, exc) -> None:
811 events.append(('pipe_connection_lost', fd))
812 self.exit_maybe()
813
814 def process_exited(self) -> None:
815 events.append('process_exited')
816 self.exit_maybe()
817
818 def exit_maybe(self):
819 # Only exit when we got all expected events
820 if len(events) >= len(expected):
821 self.exit_future.set_result(True)
822
823 async def main() -> None:
824 loop = asyncio.get_running_loop()

Callers 1

mainMethod · 0.85

Calls

no outgoing calls

Tested by 1

mainMethod · 0.68