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

Public Member Functions

def __init__ (self, match, replacement, 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

 pattern
 
 repl
 
 exceptions
 
- Public Attributes inherited from SerialSubstitution.SubstitutionClass
 options
 

Detailed Description

Definition at line 126 of file SerialSubstitution.py.

Constructor & Destructor Documentation

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

Definition at line 127 of file SerialSubstitution.py.

127  def __init__(self, match, replacement, exceptions = []):
128  SubstitutionClass.__init__(self)
129  self.pattern = match
130  self.repl = replacement
131  self.exceptions = exceptions
def __init__(self, match, replacement, exceptions=[])

Member Function Documentation

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

Definition at line 136 of file SerialSubstitution.py.

136  def __call__(self, s, context = None):
137  for pattern in self.exceptions:
138  if pattern in s: return s
139  return s.replace(self.pattern, self.repl)
def __call__(self, s, context=None)
def SerialSubstitution.ReplacementClass.__str__ (   self)

Definition at line 134 of file SerialSubstitution.py.

134  def __str__(self): return self.pattern
135 
def SerialSubstitution.ReplacementClass.Describe (   self)

Definition at line 142 of file SerialSubstitution.py.

142  def Describe(self):
143  return "%r -> %r (literal)" % (self.pattern, self.repl)
144 
145 # class ReplacementClass
146 
147 

Member Data Documentation

SerialSubstitution.ReplacementClass.exceptions

Definition at line 131 of file SerialSubstitution.py.

SerialSubstitution.ReplacementClass.pattern

Definition at line 129 of file SerialSubstitution.py.

SerialSubstitution.ReplacementClass.repl

Definition at line 130 of file SerialSubstitution.py.


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