abc-master
|
Functions | |
def | _dup |
def | save_stdout |
def | redirect |
def | start_redirect |
def | end_redirect |
Variables | |
tuple | null_file = open( os.devnull, "w" ) |
A simple context manager for redirecting streams in Python. The streams are redirected at the the C runtime level so that the output of C extensions that use stdio will also be redirected. null_file : a stream representing the null device (e.g. /dev/null on Unix) redirect: a context manager for redirecting streams Author: Baruch Sterin (sterin@berkeley.edu)
|
private |
Definition at line 22 of file redirect.py.
def redirect.end_redirect | ( | src, | |
fd_dup_src | |||
) |
End redirection of stream src.Redirect the src stream into dst. src is the source stream and fd_dup_src is the value returned by start_redirect()
Definition at line 97 of file redirect.py.
def redirect.redirect | ( | dst = null_file , |
|
src = sys.stdout |
|||
) |
Redirect the src stream into dst. Example: with redirect( open("somefile.txt", sys.stdout ) ): do some stuff ...
Definition at line 45 of file redirect.py.
def redirect.save_stdout | ( | src = sys.stdout | ) |
def redirect.start_redirect | ( | dst = null_file , |
|
src = sys.stdout |
|||
) |
Start redirection of src stream into dst. Return the duplicated file handle of the source. Example: fd = start_redirect( open("somefile.txt"), sys.stdout ) ... do some stuff ... end_redirect(sys.stdout, fd)
Definition at line 73 of file redirect.py.
tuple redirect.null_file = open( os.devnull, "w" ) |
Definition at line 19 of file redirect.py.