manhole
- class mautrix.util.manhole.StatefulCommandCompiler
Bases:
CommandCompiler
A command compiler that buffers input until a full command is available.
- __init__()
- Return type:
None
- reset()
- Return type:
None
- class mautrix.util.manhole.Interpreter
Bases:
ABC
- abstractmethod __init__(namespace, banner)
- abstractmethod close()
- Return type:
None
- class mautrix.util.manhole.AsyncInterpreter
Bases:
Interpreter
An interactive asynchronous interpreter.
- reader: StreamReader
- writer: StreamWriter
- __init__(namespace, banner)
- compiler: StatefulCommandCompiler
- async send_exception()
When an exception has occurred, write the traceback to the user.
- Return type:
None
- async handle_one_command()
Process a single command. May have many lines.
- Return type:
None
- async run_command(codeobj)
Execute a compiled code object, and write the output back to the client.
- Parameters:
codeobj (CodeType)
- Return type:
None
- async write_prompt()
- Return type:
None
- async read_command()
Read a command from the user line by line.
Returns a code object suitable for execution.
- Return type:
CodeType | None
- async send_output(value, stdout)
Write the output or value of the expression back to user.
>>> 5 5 >>> print('cash rules everything around me') cash rules everything around me
- close()
- Return type:
None
- class mautrix.util.manhole.InterpreterFactory
Bases:
object
- __init__(namespace, banner, interpreter_class, whitelist)
- interpreter_class: Type[Interpreter]
- clients: List[Interpreter]
- async mautrix.util.manhole.start_manhole(path, banner='', namespace=None, loop=None, whitelist=None)
Starts a manhole server on a given UNIX address.
- Parameters:
path (str) – The path to create the UNIX socket at.
banner (str) – The banner to show when clients connect.
namespace (Dict[str, Any] | None) – The globals to provide to connected clients.
loop (AbstractEventLoop) – The asyncio event loop to use.
whitelist (Set[int]) – List of user IDs to allow connecting.
- Return type: