Public Member Functions | Public Attributes | List of all members
SerialSubstitution.RegExDeleteLineClass Class Reference
Inheritance diagram for SerialSubstitution.RegExDeleteLineClass:
SerialSubstitution.SubstitutionClass

Public Member Functions

def __init__ (self, match, exceptions=[])
 
def __str__ (self)
 
def __call__ (self, s, context=None)
 
def Describe (self)
 
- Public Member Functions inherited from SerialSubstitution.SubstitutionClass
def __init__ (self)
 
def SetOptions (self, options)
 
def __str__ (self)
 
def __call__ (self, s, context=None)
 
def describe (self)
 

Public Attributes

 regex
 
 exceptions
 
- Public Attributes inherited from SerialSubstitution.SubstitutionClass
 options
 

Detailed Description

Definition at line 104 of file SerialSubstitution.py.

Constructor & Destructor Documentation

def SerialSubstitution.RegExDeleteLineClass.__init__ (   self,
  match,
  exceptions = [] 
)

Definition at line 105 of file SerialSubstitution.py.

105  def __init__(self, match, exceptions = []):
106  SubstitutionClass.__init__(self)
107  self.regex = re.compile(match)
108  self.exceptions = list(map(re.compile, exceptions))
def __init__(self, match, exceptions=[])

Member Function Documentation

def SerialSubstitution.RegExDeleteLineClass.__call__ (   self,
  s,
  context = None 
)

Definition at line 113 of file SerialSubstitution.py.

113  def __call__(self, s, context = None):
114  for pattern in self.exceptions:
115  if pattern.search(s) is not None: return s
116  if self.regex.match(s): return []
117  return s
def SerialSubstitution.RegExDeleteLineClass.__str__ (   self)

Definition at line 111 of file SerialSubstitution.py.

111  def __str__(self): return self.regex.pattern
112 
def SerialSubstitution.RegExDeleteLineClass.Describe (   self)

Definition at line 120 of file SerialSubstitution.py.

120  def Describe(self):
121  return "%r (remove)" % (self.regex.pattern, )
122 
123 # class RegExDeleteLineClass
124 
125 

Member Data Documentation

SerialSubstitution.RegExDeleteLineClass.exceptions

Definition at line 108 of file SerialSubstitution.py.

SerialSubstitution.RegExDeleteLineClass.regex

Definition at line 107 of file SerialSubstitution.py.


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