yt.utilities.rpdb module

Some simple localhost-only remote pdb hacks

class yt.utilities.rpdb.PdbXMLRPCServer(addr, requestHandler=<class 'xmlrpc.server.SimpleXMLRPCRequestHandler'>, logRequests=True, allow_none=False, encoding=None, bind_and_activate=True, use_builtin_types=False)[source]

Bases: xmlrpc.server.SimpleXMLRPCServer

shutdown-enabled XMLRPCServer from
address_family = 2
allow_reuse_address = True

Called to clean up an individual request.


Return socket file number.

Interface required by select().

finish_request(request, client_address)

Finish one request by instantiating RequestHandlerClass.

finished = False

Get the request and client address from the socket.

May be overridden.

handle_error(request, client_address)

Handle an error gracefully. May be overridden.

The default is to print a traceback and continue.


Handle one request, possibly blocking.

Respects self.timeout.


Called if no new request arrives within self.timeout.

Overridden by ForkingMixIn.

process_request(request, client_address)

Call finish_request.

Overridden by ForkingMixIn and ThreadingMixIn.

register_function(function, name=None)

Registers a function to respond to XML-RPC requests.

The optional name argument can be used to set a Unicode name for the function.

register_instance(instance, allow_dotted_names=False)

Registers an instance to respond to XML-RPC requests.

Only one instance can be installed at a time.

If the registered instance has a _dispatch method then that method will be called with the name of the XML-RPC method and its parameters as a tuple e.g. instance._dispatch(‘add’,(2,3))

If the registered instance does not have a _dispatch method then the instance will be searched to find a matching method and, if found, will be called. Methods beginning with an ‘_’ are considered private and will not be called by SimpleXMLRPCServer.

If a registered function matches a XML-RPC request, then it will be called instead of the registered instance.

If the optional allow_dotted_names argument is true and the instance does not have a _dispatch method, method names containing dots are supported and resolved, as long as none of the name segments start with an ‘_’.


Enabling the allow_dotted_names options allows intruders to access your module’s global variables and may allow intruders to execute arbitrary code on your machine. Only use this option on a secure, closed network.


Registers the XML-RPC introspection methods in the system namespace.



Registers the XML-RPC multicall method in the system namespace.


request_queue_size = 5

Called by constructor to activate the server.

May be overridden.


Called by constructor to bind the socket.

May be overridden.


Called to clean-up the server.

May be overridden.


Called by the serve_forever() loop.

May be overridden by a subclass / Mixin to implement any code that needs to be run during the loop.


Called to shutdown and close an individual request.

signal_handler(signum, frame)[source]
socket_type = 1

system.listMethods() => [‘add’, ‘subtract’, ‘multiple’]

Returns a list of the methods supported by the server.


system.methodHelp(‘add’) => “Adds two integers together”

Returns a string containing documentation for the specified method.


system.methodSignature(‘add’) => [double, int, int]

Returns a list describing the signature of the method. In the above example, the add method takes two integers as arguments and returns a double result.

This server does NOT support system.methodSignature.


system.multicall([{‘methodName’: ‘add’, ‘params’: [2, 2]}, ...]) => [[4], ...]

Allows the caller to package multiple XML-RPC calls into a single request.


timeout = None
verify_request(request, client_address)

Verify the request. May be overridden.

Return True if we should proceed with this request.

class yt.utilities.rpdb.pdb_handler(tb)[source]

Bases: object

class yt.utilities.rpdb.rpdb_cmd(proxy)[source]

Bases: cmd.Cmd


Repeatedly issue a prompt, accept input, parse an initial prefix off the received input, and dispatch to action methods, passing them the remainder of the line as argument.

columnize(list, displaywidth=80)

Display a list of strings as a compact set of columns.

Each column is only as wide as necessary. Columns are separated by two spaces (one was not legible enough).

complete(text, state)

Return the next possible completion for ‘text’.

If a command has not been entered, then complete against command list. Otherwise try to call complete_<command> to get list of completions.


Method called to complete an input line when no command-specific complete_*() method is available.

By default, it returns an empty list.

completenames(text, *ignored)
doc_header = 'Documented commands (type help <topic>):'
doc_leader = ''

Called when an empty line is entered in response to the prompt.

If this method is not overridden, it repeats the last nonempty command entered.

identchars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_'
intro = None
lastcmd = ''
misc_header = 'Miscellaneous help topics:'
nohelp = '*** No help on %s'

Interpret the argument as though it had been typed in response to the prompt.

This may be overridden, but should not normally need to be; see the precmd() and postcmd() methods for useful execution hooks. The return value is a flag indicating whether interpretation of commands by the interpreter should stop.


Parse the line into a command name and a string containing the arguments. Returns a tuple containing (command, args, line). ‘command’ and ‘args’ may be None if the line couldn’t be parsed.

postcmd(stop, line)[source]

Hook method executed just before the command line is interpreted, but after the input prompt is generated and issued.


Hook method executed once when the cmdloop() method is called.

print_topics(header, cmds, cmdlen, maxcol)
prompt = '(Cmd) '
ruler = '='
undoc_header = 'Undocumented commands:'
use_rawinput = 1
yt.utilities.rpdb.rpdb_excepthook(exc_type, exc, tb)[source]