All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Public Attributes | List of all members
SerialSubstitution.WarningClass Class Reference
Inheritance diagram for SerialSubstitution.WarningClass:
SerialSubstitution.SubstitutionClass

Public Member Functions

def __init__
 
def __str__
 
def __call__
 
def Describe
 
- Public Member Functions inherited from SerialSubstitution.SubstitutionClass
def __init__
 
def SetOptions
 
def __str__
 
def __call__
 
def describe
 

Public Attributes

 pattern
 
 regex
 
 msg
 
 exceptions
 
- Public Attributes inherited from SerialSubstitution.SubstitutionClass
 options
 

Detailed Description

Definition at line 148 of file SerialSubstitution.py.

Constructor & Destructor Documentation

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

Definition at line 149 of file SerialSubstitution.py.

150  def __init__(self, match, message, exceptions = []):
151  SubstitutionClass.__init__(self)
152  if hasattr(match, 'search'):
153  self.pattern = match.pattern
154  self.regex = match
155  else:
156  self.pattern = match
157  self.regex = re.compile(match)
158  self.msg = message
self.exceptions = list(map(re.compile, exceptions))
list
Definition: file_to_url.sh:28

Member Function Documentation

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

Definition at line 163 of file SerialSubstitution.py.

164  def __call__(self, s, context = None):
165  for pattern in self.exceptions:
166  if pattern.search(s) is not None: return s
167  match = self.regex.search(s)
168  if match is not None:
169  msg = match.expand(self.msg)
170  if context is None:
171  logging.warning(
172  "From line '%s': %s", s,
173  Colorize(msg, 'warning', self.options)
174  )
175  else:
176  logging.warning(
177  "From %s: %s\n => %s",
178  context.Location(), Colorize(msg, 'warning', self.options), s
179  )
180  # if ... else
181  logging.debug("(pattern: %r on %r)", self.regex.pattern, s)
182  # if
return s
def Colorize
Library code.
def SerialSubstitution.WarningClass.__str__ (   self)

Definition at line 161 of file SerialSubstitution.py.

162  def __str__(self): return self.pattern
def SerialSubstitution.WarningClass.Describe (   self)

Definition at line 185 of file SerialSubstitution.py.

186  def Describe(self):
187  return "%r -> %r (warning)" % (self.pattern, self.msg)
188 
189 # class WarningClass
190 
191 
192 

Member Data Documentation

SerialSubstitution.WarningClass.exceptions

Definition at line 158 of file SerialSubstitution.py.

SerialSubstitution.WarningClass.msg

Definition at line 157 of file SerialSubstitution.py.

SerialSubstitution.WarningClass.pattern

Definition at line 152 of file SerialSubstitution.py.

SerialSubstitution.WarningClass.regex

Definition at line 153 of file SerialSubstitution.py.


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