Context management tools for xonsh.
- class xonsh.contexts.Block#
This is a context manager for obtaining a block of lines without actually executing the block. The lines are accessible as the ‘lines’ attribute. This must be used as a macro.
- lineslist of str or None
Block lines as if split by str.splitlines(), if available.
- glbsMapping or None
Global execution context, ie globals().
- locsMapping or None
Local execution context, ie locals().
- class xonsh.contexts.Functor(args=(), kwargs=None, rtn='')#
This is a context manager that turns the block into a callable object, bound to the execution context it was created in.
- argsSequence of str, optional
A tuple of argument names for the functor.
- kwargsMapping of str to values or list of item tuples, optional
Keyword argument names and values, if available.
- rtnstr, optional
Name of object to return, if available.
The underlying function object. This defaults to none and is set after the the block is exited.