Built-Ins (xonsh.built_ins)

The xonsh built-ins.

Note that this module is named ‘built_ins’ so as not to be confused with the special Python builtins module.

xonsh.built_ins.ensure_list_of_strs(x)[source]

Ensures that x is a list of strings.

xonsh.built_ins.expand_path(s)[source]

Takes a string path and expands ~ to home and environment vars.

xonsh.built_ins.get_script_subproc_command(fname, args)[source]

Given the name of a script outside the path, returns a list representing an appropriate subprocess command to execute the script. Raises PermissionError if the script is not executable.

xonsh.built_ins.helper(x, name='')[source]

Prints help about, and then returns that variable.

xonsh.built_ins.load_builtins(execer=None, config=None, login=False, ctx=None)[source]

Loads the xonsh builtins into the Python builtins. Sets the BUILTINS_LOADED variable to True.

xonsh.built_ins.regexpath(s, pymode=False)[source]

Takes a regular expression string and returns a list of file paths that match the regex.

xonsh.built_ins.reglob(path, parts=None, i=None)[source]

Regular expression-based globbing.

xonsh.built_ins.resetting_signal_handle(sig, f)[source]

Sets a new signal handle that will automatically restore the old value once the new handle is finished.

xonsh.built_ins.run_subproc(cmds, captured=False)[source]

Runs a subprocess, in its many forms. This takes a list of ‘commands,’ which may be a list of command line arguments or a string, representing a special connecting character. For example:

$ ls | grep wakka

is represented by the following cmds:

[['ls'], '|', ['grep', 'wakka']]

Lastly, the captured argument affects only the last real command.

xonsh.built_ins.subproc_captured_hiddenobject(*cmds)[source]

Runs a subprocess, capturing the output. Returns an instance of HiddenCompletedCommand representing the completed command.

xonsh.built_ins.subproc_captured_inject(*cmds)[source]

Runs a subprocess, capturing the output. Returns a list of whitespace-separated strings in the stdout that was produced.

xonsh.built_ins.subproc_captured_object(*cmds)[source]

Runs a subprocess, capturing the output. Returns an instance of CompletedCommand representing the completed command.

xonsh.built_ins.subproc_captured_stdout(*cmds)[source]

Runs a subprocess, capturing the output. Returns the stdout that was produced as a str.

xonsh.built_ins.subproc_uncaptured(*cmds)[source]

Runs a subprocess, without capturing the output. Returns the stdout that was produced as a str.

xonsh.built_ins.superhelper(x, name='')[source]

Prints help about, and then returns that variable.

xonsh.built_ins.unload_builtins()[source]

Removes the xonsh builtins from the Python builtins, if the BUILTINS_LOADED is True, sets BUILTINS_LOADED to False, and returns.

xonsh.built_ins.xonsh_builtins(execer=None)[source]

A context manager for using the xonsh builtins only in a limited scope. Likely useful in testing.