manhole
- class mautrix.util.manhole.StatefulCommandCompiler
Bases:
codeop.CommandCompiler
A command compiler that buffers input until a full command is available.
- buf: _io.BytesIO
- class mautrix.util.manhole.AsyncInterpreter
Bases:
mautrix.util.manhole.Interpreter
An interactive asynchronous interpreter.
- reader: asyncio.streams.StreamReader
- writer: asyncio.streams.StreamWriter
- __init__(namespace, banner)
- async send_exception()
When an exception has occurred, write the traceback to the user.
- Return type
- async run_command(codeobj)
Execute a compiled code object, and write the output back to the client.
- Parameters
codeobj (code) –
- Return type
- async read_command()
Read a command from the user line by line.
Returns a code object suitable for execution.
- Return type
Optional[code]
- 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
- class mautrix.util.manhole.InterpreterFactory
Bases:
object
- __init__(namespace, banner, interpreter_class, whitelist)
- interpreter_class: Type[mautrix.util.manhole.Interpreter]
- clients: List[mautrix.util.manhole.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 (Optional[Dict[str, Any]]) – The globals to provide to connected clients.
loop (Optional[asyncio.events.AbstractEventLoop]) – The asyncio event loop to use.
whitelist (Optional[Set[int]]) – List of user IDs to allow connecting.
- Return type
Tuple[asyncio.events.AbstractServer, Callable[[], None]]