Method: pylint.checkers.utils.overrides_a_method
Calls: 1728, Exceptions: 0, Paths: 6Back
Path 1: 1275 calls (0.74)
ClassDef (1275)
'__init__' (228) 'test' (44) 'method' (31) '__iter__' (21) 'my_func' (21) 'func' (20) 'foo' (19) '__len__' (16) '__getitem__' (15) '__enter__' (15)
False (1275)
1def overrides_a_method(class_node: nodes.ClassDef, name: str) -> bool:
2 """Return True if <name> is a method overridden from an ancestor
3 which is not the base object class.
4 """
5 for ancestor in class_node.ancestors():
6 if ancestor.name == "object":
7 continue
8 if name in ancestor and isinstance(ancestor[name], nodes.FunctionDef):
9 return True
10 return False
Path 2: 254 calls (0.15)
ClassDef (254)
'__init__' (67) 'method' (10) '__getitem__' (8) 'test' (7) 'func' (7) '__new__' (7) 'close' (5) '__setitem__' (4) 'to_dict' (4) 'brew' (3)
True (254)
1def overrides_a_method(class_node: nodes.ClassDef, name: str) -> bool:
2 """Return True if <name> is a method overridden from an ancestor
3 which is not the base object class.
4 """
5 for ancestor in class_node.ancestors():
6 if ancestor.name == "object":
7 continue
8 if name in ancestor and isinstance(ancestor[name], nodes.FunctionDef):
9 return True
10 return False
Path 3: 177 calls (0.1)
ClassDef (177)
'__init__' (19) 'test' (5) 'update' (4) 'digest' (4) 'func' (4) '__iter__' (4) 'keys' (3) 'a' (3) '__getitem__' (3) '__call__' (3)
False (177)
1def overrides_a_method(class_node: nodes.ClassDef, name: str) -> bool:
2 """Return True if <name> is a method overridden from an ancestor
3 which is not the base object class.
4 """
5 for ancestor in class_node.ancestors():
6 if ancestor.name == "object":
7 continue
8 if name in ancestor and isinstance(ancestor[name], nodes.FunctionDef):
9 return True
10 return False
Path 4: 14 calls (0.01)
ClassDef (14)
'__init__' (5) 'test' (3) 'write' (1) 'writelines' (1) 'close' (1) '__aenter__' (1) 'items' (1) 'test1' (1)
False (14)
1def overrides_a_method(class_node: nodes.ClassDef, name: str) -> bool:
2 """Return True if <name> is a method overridden from an ancestor
3 which is not the base object class.
4 """
5 for ancestor in class_node.ancestors():
6 if ancestor.name == "object":
7 continue
8 if name in ancestor and isinstance(ancestor[name], nodes.FunctionDef):
9 return True
10 return False
Path 5: 5 calls (0.0)
ClassDef (5)
'_generate_next_value_' (1) '__str__' (1) 'bar' (1) '__new__' (1) '__len__' (1)
True (5)
1def overrides_a_method(class_node: nodes.ClassDef, name: str) -> bool:
2 """Return True if <name> is a method overridden from an ancestor
3 which is not the base object class.
4 """
5 for ancestor in class_node.ancestors():
6 if ancestor.name == "object":
7 continue
8 if name in ancestor and isinstance(ancestor[name], nodes.FunctionDef):
9 return True
10 return False
Path 6: 3 calls (0.0)
ClassDef (3)
'initialize_options' (1) 'finalize_options' (1) 'run' (1)
False (3)
1def overrides_a_method(class_node: nodes.ClassDef, name: str) -> bool:
2 """Return True if <name> is a method overridden from an ancestor
3 which is not the base object class.
4 """
5 for ancestor in class_node.ancestors():
6 if ancestor.name == "object":
7 continue
8 if name in ancestor and isinstance(ancestor[name], nodes.FunctionDef):
9 return True
10 return False