ipython_manager

Module Contents

Classes

IPythonProcess

Process objects represent activity that is run in a separate process

IPythonInteractiveManager

An interactive IPython shell manager for code execution

class lagent.actions.ipython_manager.IPythonProcess(in_q, out_q, timeout=20, ci_lock=None, daemon=True)

Bases: multiprocessing.Process

Process objects represent activity that is run in a separate process

The class is analogous to threading.Thread

参数:
  • in_q (multiprocessing.Queue) –

  • out_q (multiprocessing.Queue) –

  • timeout (int) –

  • ci_lock (str) –

  • daemon (bool) –

in_q
out_q
timeout = 20
session_id2shell
ci_lock
run()

Method to be run in sub-process; can be overridden in sub-class

exec(session_id, code)
static create_shell(enable_history=False, in_memory=True)
参数:
  • enable_history (bool) –

  • in_memory (bool) –

static extract_code(text)

Extract Python code from markup languages.

参数:

text (str) – Markdown-formatted text

返回:

Python code

返回类型:

str

class lagent.actions.ipython_manager.IPythonInteractiveManager(max_workers=50, timeout=20, ci_lock=None, description=None, parser=JsonParser)

Bases: lagent.actions.base_action.BaseAction

An interactive IPython shell manager for code execution

参数:
max_workers = 50
timeout = 20
ci_lock = None
id2queue
id2process
out_queue
process_code(index, session_id, code)
run_code_blocks(session_code_pairs)
clear()
reset()