Module Command :: Class replace
[hide private]

Class replace

source code

       object --+    
                |    
             pype --+
                    |
       object --+   |
                |   |
          stacker --+
                    |
   object --+       |
            |       |
   linebuffer --+   |
                |   |
inputfilterbuffer --+
                    |
                   replace

Copy lines from src to a destination file while replacing occurences of pattern.

Instance Methods [hide private]
 
__init__(self, pattern, replacement, *args, **kw)
Returns: nothing.
source code

Inherited from pype: __gt__, __or__, __repr__, __str__

Inherited from stacker: __call__, __sub__

Inherited from inputfilterbuffer: write

Inherited from linebuffer: __iter__

Inherited from linebuffer (private): _buffer

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

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, pattern, replacement, *args, **kw)
(Constructor)

source code 

x.__init__(...) initializes x; see x.__class__.__doc__ for signature

Parameters:
  • pattern (str or compiled regular expression.) - a regular expression.
  • replacement - see re for all possibilities.
  • args (str) - files, last one is destination.
  • all - if True all occurences of pattern in a line are replaced (default is only the first)
  • count - number of occurences in a line to replace (default only the first)
  • ignore - if True all errors are ignored.
Returns:
nothing.
Overrides: object.__init__