Module termcolors :: Class StreamProxy
[hide private]
[frames] | no frames]

Class StreamProxy

source code


Wraps a object (such as stdout), acting as a transparent proxy for all attribute access.
Instance Methods [hide private]
 
wrap_stdout(self)
Wrap sys.stdout to this class.
source code
 
restore_stdout(self)
Restore sys.stdout.
source code
 
__init__(self, stream=None, skip=False, term_colors=None)
x.__init__(...) initializes x; see help(type(x)) for signature
source code
 
__getattr__(self, name) source code
 
__enter__(self, *args, **kwargs) source code
 
__exit__(self, *args, **kwargs) source code
 
write(self, s) source code
 
setSkipTags(self, skip=False)
Set skip tag.
source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Instance Variables [hide private]
  _stdout_orig
Original sys.stdout
Properties [hide private]
  closed

Inherited from object: __class__

Method Details [hide private]

wrap_stdout(self)

source code 

Wrap sys.stdout to this class.

Register atexit() for restore sys.stdout. Assign stdout to stream.

If already wrapped, then raise RuntimeError.

restore_stdout(self)

source code 

Restore sys.stdout.

Also set stream to None.

__init__(self, stream=None, skip=False, term_colors=None)
(Constructor)

source code 

x.__init__(...) initializes x; see help(type(x)) for signature

Parameters:
  • stream - stream for wrapping. If stream is None then use sys.stdout.
  • skip - Skip tags (and do not colorize) if True.
  • term_colors - TermColors` instance.
Overrides: object.__init__

setSkipTags(self, skip=False)

source code 
Set skip tag. Skip tags at out and do not colorize.

Property Details [hide private]

closed

Get Method:
unreachable.closed(self)