polytracker.repl

repl classes

Commands

class polytracker.repl.Commands(argument_parser: ArgumentParser)

Bases: Command

__init__(argument_parser: ArgumentParser)
__init_arguments__(parser: ArgumentParser)

Initializes this command’s argument parser.

Subclasses should extend this function and add any necessary options to parser.

extension_types: List[Type[CommandExtension]] | None = None

An auto-populated list of eny extensions to this command.

extensions: List[CommandExtension]
property full_name: str
help: str = 'print the PolyTracker commands'

Help string for this command.

name: str = 'commands'

The name of this plugin.

parent: 'Plugin' | None

The parent of this plugin, if it is a sub-plugin.

parent_parsers: Tuple[ArgumentParser, ...] = ()

An optional sequence of parent argument parsers from which to parse options.

run(args)

Callback for when the command is run.

Parameters:

args – The result of parsing the commandline arguments set up by Command.__init_arguments__().

subcommand_types: List[Type[Subcommand]] | None = None

An auto-populated list of subcommands of this command.

subcommands: List[Subcommand]
subparser: Any | None = None

A subparser, auto-populated if subcommand_types is not None.

PolyTrackerCompleter

class polytracker.repl.PolyTrackerCompleter(repl: PolyTrackerREPL)

Bases: Completer

__init__(repl: PolyTrackerREPL)
bottom_toolbar()
get_completions(document, complete_event)

This should be a generator that yields Completion instances.

If the generation of completions is something expensive (that takes a lot of time), consider wrapping this Completer class in a ThreadedCompleter. In that case, the completer algorithm runs in a background thread and completions will be displayed as soon as they arrive.

Parameters:
  • documentDocument instance.

  • complete_eventCompleteEvent instance.

async get_completions_async(document: Document, complete_event: CompleteEvent) AsyncGenerator[Completion, None]

Asynchronous generator for completions. (Probably, you won’t have to override this.)

Asynchronous generator of Completion objects.

rprompt()

PolyTrackerREPL

class polytracker.repl.PolyTrackerREPL

Bases: object

__init__()
commands: Dict[str, REPLCommand] = {'commands': <polytracker.repl.REPLCommand object>, 'docker_run': <polytracker.repl.REPLCommand object>, 'extract_grammar': <polytracker.repl.REPLCommand object>, 'load_trace_tdag': <polytracker.repl.REPLCommand object>}
classmethod commands_command()

print the PolyTracker commands

classmethod current_instance() PolyTrackerREPL
print_exc()
classmethod prompt(message: str, options: str = 'yN', default: bool = False) bool
classmethod register(command_name: str, discardable: bool = False)

Function decorator for registering a command with this REPL

classmethod register_global(name: str, value: Any)
registered_globals: Dict[str, Any] = {'CAN_RUN_NATIVELY': False, 'commands': <polytracker.repl.REPLCommand object>, 'docker_run': <polytracker.repl.REPLCommand object>, 'extract_grammar': <polytracker.repl.REPLCommand object>, 'load_trace_tdag': <polytracker.repl.REPLCommand object>}
run()
run_on_exit(function: Callable[[], Any])

Registers a function to be executed when this REPL completes

run_python(command)
static warning(message: str)

REPLCommand

class polytracker.repl.REPLCommand(name: str, func: Callable[[...], Any], discardable: bool = False)

Bases: object

__init__(name: str, func: Callable[[...], Any], discardable: bool = False)
property discardable: bool
property func: Callable[[...], Any]
property help: str
property name: str
run_bare()

called when the command is run from the REPL with no parenthesis

repl functions