##// END OF EJS Templates
Don't document classes defined in if __name__ == '__main__' blocks
Thomas Kluyver -
Show More
@@ -45,6 +45,14 b' class FuncClsScanner(ast.NodeVisitor):'
45 45 def has_undoc_decorator(node):
46 46 return any(isinstance(d, ast.Name) and d.id == 'undoc' \
47 47 for d in node.decorator_list)
48
49 def visit_If(self, node):
50 if isinstance(node.test, ast.Compare) \
51 and isinstance(node.test.left, ast.Name) \
52 and node.test.left.id == '__name__':
53 return # Ignore classes defined in "if __name__ == '__main__':"
54
55 self.generic_visit(node)
48 56
49 57 def visit_FunctionDef(self, node):
50 58 if not (node.name.startswith('_') or self.has_undoc_decorator(node)) \
General Comments 0
You need to be logged in to leave comments. Login now