A wrapper around an (output) file object which supports
diversions and filtering.
Methods
|
|
|
|
__init__
|
__init__ ( self, file )
|
|
attach
|
attach ( self, shortcut )
Attached a solitary filter (no sequences allowed here) at the
end of the current filter chain.
|
|
close
|
close ( self )
|
|
create
|
create ( self, name )
Create a diversion if one does not already exist, but do not
divert to it yet.
Exceptions
|
|
DiversionError, "diversion name must be non-None"
|
|
|
divert
|
divert ( self, name )
Start diverting.
Exceptions
|
|
DiversionError, "diversion name must be non-None"
|
|
|
flush
|
flush ( self )
|
|
install
|
install ( self, shortcut=None )
Install a new filter; None means no filter. Handle all the
special shortcuts for filters here.
|
|
last
|
last ( self )
Find the last filter in the current filter chain, or None if
there are no filters installed.
|
|
purge
|
purge ( self, name )
Purge the specified diversion.
Exceptions
|
|
DiversionError, "diversion name must be non-None"
|
|
|
purgeAll
|
purgeAll ( self )
Eliminate all existing diversions.
|
|
retrieve
|
retrieve ( self, name )
Retrieve the given diversion.
Exceptions
|
|
DiversionError, "diversion name must be non-None"
DiversionError, "nonexistent diversion: %s" % name
|
|
|
revert
|
revert ( self )
Reset any current diversions.
|
|
shortcut
|
shortcut ( self, shortcut )
Take a filter shortcut and translate it into a filter, returning
it. Sequences don't count here; these should be detected
independently.
Exceptions
|
|
NotImplementedError, "mapping filters not yet supported"
|
|
|
undivert
|
undivert (
self,
name,
purgeAfterwards=False,
)
Undivert a particular diversion.
Exceptions
|
|
DiversionError, "diversion name must be non-None"
DiversionError, "nonexistent diversion: %s" % name
|
|
|
undivertAll
|
undivertAll ( self, purgeAfterwards=True )
Undivert all pending diversions.
|
|
write
|
write ( self, data )
|
|
writelines
|
writelines ( self, lines )
|