Misc. xonsh tools.
The following implementations were forked from the IPython project:
Context manager for temporarily redirecting stderr to another file.
Context manager for temporarily redirecting stdout to another file.
# How to send help() to stderr with redirect_stdout(sys.stderr):
# How to write help() to a file with open(‘help.txt’, ‘w’) as f:
- with redirect_stdout(f):
Calculates the Levenshtein distance between a and b.
In recent versions of Python, hasattr() only catches AttributeError. This catches all errors.
Excapsulates a source code line in a uncaptured subprocess $.
Excapsulates tokens in a source code line in a uncaptured subprocess $ starting at a minimum column.