The Gaudi Framework master (1fbcc22a)
Loading...
Searching...
No Matches
GaudiTesting.preprocessors.RegexpReplacer Class Reference
Inheritance diagram for GaudiTesting.preprocessors.RegexpReplacer:
Collaboration diagram for GaudiTesting.preprocessors.RegexpReplacer:

Public Member Functions

 __init__ (self, orig, repl="", when=None)
 __add__ (self, rhs)
 __processLine__ (self, line)
Public Member Functions inherited from GaudiTesting.preprocessors.FilePreprocessor
 __processLine__ (self, line)
 __processFile__ (self, lines)
 __call__ (self, input)
 __add__ (self, rhs)

Protected Attributes

list _operations = [(when, re.compile(orig), repl)]

Detailed Description

Definition at line 113 of file preprocessors.py.

Constructor & Destructor Documentation

◆ __init__()

GaudiTesting.preprocessors.RegexpReplacer.__init__ ( self,
orig,
repl = "",
when = None )

Definition at line 114 of file preprocessors.py.

114 def __init__(self, orig, repl="", when=None):
115 if when:
116 when = re.compile(when)
117 self._operations = [(when, re.compile(orig), repl)]
118

Member Function Documentation

◆ __add__()

GaudiTesting.preprocessors.RegexpReplacer.__add__ ( self,
rhs )

Definition at line 119 of file preprocessors.py.

119 def __add__(self, rhs):
120 if isinstance(rhs, RegexpReplacer):
121 res = RegexpReplacer("", "", None)
122 res._operations = self._operations + rhs._operations
123 else:
124 res = FilePreprocessor.__add__(self, rhs)
125 return res
126

◆ __processLine__()

GaudiTesting.preprocessors.RegexpReplacer.__processLine__ ( self,
line )

Definition at line 127 of file preprocessors.py.

127 def __processLine__(self, line):
128 for w, o, r in self._operations:
129 if w is None or w.search(line):
130 line = o.sub(r, line)
131 return line
132
133
134# Common preprocessors

Member Data Documentation

◆ _operations

list GaudiTesting.preprocessors.RegexpReplacer._operations = [(when, re.compile(orig), repl)]
protected

Definition at line 117 of file preprocessors.py.


The documentation for this class was generated from the following file: