MCPcopy Create free account
hub / github.com/OpenBMB/BMTools / _lazy_import_pexpect

Function _lazy_import_pexpect

bmtools/tools/shell/api.py:14–26  ·  view source on GitHub ↗

Import pexpect only when needed.

()

Source from the content-addressed store, hash-verified

12import pexpect
13
14def _lazy_import_pexpect() -> pexpect:
15 """Import pexpect only when needed."""
16 if platform.system() == "Windows":
17 raise ValueError("Persistent bash processes are not yet supported on Windows.")
18 try:
19 import pexpect
20
21 except ImportError:
22 raise ImportError(
23 "pexpect required for persistent bash processes."
24 " To install, run `pip install pexpect`."
25 )
26 return pexpect
27
28class BashProcess:
29 """Executes bash commands and returns the output."""

Callers 2

_run_persistentMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected