xonsh.tracer

Implements a xonsh tracer.

class xonsh.tracer.TracerAlias(threadable=True, **kwargs)[source]

Tool for tracing xonsh code as it runs.

exception Error(message: str, errno=1)

Special case, when raised, the traceback will not be shown. Instead the process with exit with error code and message

add_note()

Exception.add_note(note) – add a note to the exception

with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

args
build()[source]

Sub-classes should return constructed ArgumentParser

create_parser(func=None, has_args=False, allowed_params=None, **kwargs) ArgParser

create root parser

err(*args, **kwargs)

Write text to error stream

out(*args, **kwargs)

Write text to output stream

write_to(stream: str, *args, **kwargs)
xonsh_complete(command, **kwargs)
property parser
class xonsh.tracer.TracerType(*args, **kwargs)[source]

Represents a xonsh tracer object, which keeps track of all tracing state. This is a singleton.

color_output(usecolor)[source]

Specify whether or not the tracer output should be colored.

off_files(_args, files: Iterable[str] = ('__file__',))[source]

removes selected files fom tracing.

Parameters:
files

file paths to stop watching, use __file__ (default) to select the current file.

on_files(_args, files: Iterable[str] = ('__file__',))[source]

begins tracing selected files.

Parameters:
_args

argv from alias parser

files

file paths to watch, use “__file__” (default) to select the current file.

start(filename)[source]

Starts tracing a file.

stop(filename)[source]

Stops tracing a file.

toggle_color(toggle: bool = False)[source]

output color management for tracer

Parameters:
toggle

true/false, y/n, etc. to toggle color usage.

trace(frame, event, arg)[source]

Implements a line tracing function.

valid_events = frozenset({'call', 'line'})
xonsh.tracer.tracer_format_line(fname, lineno, line, color=True, lexer=None, formatter=None)[source]

Formats a trace line suitable for printing.