Back to index

python3.2  3.2.2
Public Member Functions | Public Attributes | Static Public Attributes
suspicious.SuspiciousVisitor Class Reference

List of all members.

Public Member Functions

def __init__
def default_visit
def visit_document
def visit_comment

Public Attributes

 builder
 lastlineno

Static Public Attributes

int lastlineno = 0
 unknown_visit = default_visit

Detailed Description

Definition at line 232 of file suspicious.py.


Constructor & Destructor Documentation

def suspicious.SuspiciousVisitor.__init__ (   self,
  document,
  builder 
)

Definition at line 236 of file suspicious.py.

00236 
00237     def __init__(self, document, builder):
00238         nodes.GenericNodeVisitor.__init__(self, document)
00239         self.builder = builder

Here is the caller graph for this function:


Member Function Documentation

def suspicious.SuspiciousVisitor.default_visit (   self,
  node 
)

Definition at line 240 of file suspicious.py.

00240 
00241     def default_visit(self, node):
00242         if isinstance(node, (nodes.Text, nodes.image)): # direct text containers
00243             text = node.astext()
00244             # lineno seems to go backwards sometimes (?)
00245             self.lastlineno = lineno = max(get_lineno(node) or 0, self.lastlineno)
00246             seen = set() # don't report the same issue more than only once per line
00247             for match in detect_all(text):
00248                 issue = match.group()
00249                 line = extract_line(text, match.start())
00250                 if (issue, line) not in seen:
00251                     self.builder.check_issue(line, lineno, issue)
00252                     seen.add((issue, line))

def suspicious.SuspiciousVisitor.visit_comment (   self,
  node 
)

Definition at line 258 of file suspicious.py.

00258 
00259     def visit_comment(self, node):
00260         # ignore comments -- too much false positives.
00261         # (although doing this could miss some errors;
00262         # there were two sections "commented-out" by mistake
00263         # in the Python docs that would not be catched)
00264         raise nodes.SkipNode
def suspicious.SuspiciousVisitor.visit_document (   self,
  node 
)

Definition at line 255 of file suspicious.py.

00255 
00256     def visit_document(self, node):
00257         self.lastlineno = 0


Member Data Documentation

Definition at line 238 of file suspicious.py.

Definition at line 234 of file suspicious.py.

Definition at line 244 of file suspicious.py.

Definition at line 253 of file suspicious.py.


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