MCPcopy Create free account
hub / github.com/openai/openai-agents-python / _FakeCommandInterface

Class _FakeCommandInterface

tests/extensions/sandbox/test_runloop.py:562–594  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

560
561
562class _FakeCommandInterface:
563 def __init__(self, devbox: _FakeDevbox) -> None:
564 self._devbox = devbox
565
566 async def exec(self, command: str, **params: object) -> _FakeExecutionResult:
567 execution = _FakeExecution(
568 devbox=self._devbox,
569 devbox_id=self._devbox.id,
570 command=command,
571 stdout_cb=params.get("stdout"),
572 stderr_cb=params.get("stderr"),
573 shell_name=cast(str | None, params.get("shell_name")),
574 attach_stdin=bool(params.get("attach_stdin", False)),
575 home_dir=self._devbox.home_dir,
576 )
577 self._devbox.owner.executions[execution.execution_id] = execution
578 self._devbox.exec_calls.append((command, dict(params)))
579 return await execution.result()
580
581 async def exec_async(self, command: str, **params: object) -> _FakeExecution:
582 execution = _FakeExecution(
583 devbox=self._devbox,
584 devbox_id=self._devbox.id,
585 command=command,
586 stdout_cb=params.get("stdout"),
587 stderr_cb=params.get("stderr"),
588 shell_name=cast(str | None, params.get("shell_name")),
589 attach_stdin=bool(params.get("attach_stdin", False)),
590 home_dir=self._devbox.home_dir,
591 )
592 self._devbox.owner.executions[execution.execution_id] = execution
593 self._devbox.exec_async_calls.append((command, dict(params)))
594 return execution
595
596
597class _FakeDevbox:

Callers 1

__init__Method · 0.85

Calls

no outgoing calls

Tested by 1

__init__Method · 0.68