Show More
@@ -46,6 +46,14 b' class FuncClsScanner(ast.NodeVisitor):' | |||||
46 | return any(isinstance(d, ast.Name) and d.id == 'undoc' \ |
|
46 | return any(isinstance(d, ast.Name) and d.id == 'undoc' \ | |
47 | for d in node.decorator_list) |
|
47 | for d in node.decorator_list) | |
48 |
|
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) | |||
|
56 | ||||
49 | def visit_FunctionDef(self, node): |
|
57 | def visit_FunctionDef(self, node): | |
50 | if not (node.name.startswith('_') or self.has_undoc_decorator(node)) \ |
|
58 | if not (node.name.startswith('_') or self.has_undoc_decorator(node)) \ | |
51 | and node.name not in self.functions: |
|
59 | and node.name not in self.functions: |
General Comments 0
You need to be logged in to leave comments.
Login now