MCPcopy Index your code
hub / github.com/python-cmd2/cmd2 / _restore_cmd2_env

Method _restore_cmd2_env

cmd2/cmd2.py:4851–4860  ·  view source on GitHub ↗

Restore cmd2 environment after exiting an interactive Python shell. :param cmd2_env: the environment settings to restore

(self, cmd2_env: _SavedCmd2Env)

Source from the content-addressed store, hash-verified

4849 return cmd2_env
4850
4851 def _restore_cmd2_env(self, cmd2_env: _SavedCmd2Env) -> None:
4852 """Restore cmd2 environment after exiting an interactive Python shell.
4853
4854 :param cmd2_env: the environment settings to restore
4855 """
4856 # Restore the readline completer
4857 if not sys.platform.startswith("win"):
4858 import readline
4859
4860 readline.set_completer(cmd2_env.completer)
4861
4862 def _run_python(self, *, pyscript: str | None = None) -> bool | None:
4863 """Run an interactive Python shell or execute a pyscript file.

Callers 2

_run_pythonMethod · 0.95

Calls

no outgoing calls

Tested by 1