Method: pylint.checkers.utils.decorated_with
Calls: 22183, Exceptions: 192, Paths: 6Back
Path 1: 20857 calls (0.94)
FunctionDef (19683) ClassDef (537) BoundMethod (467) AsyncFunctionDef (106) UnboundMethod (28) Property (20) PartialFunction (13) PropertyModel.attr_f...
{'abc.abstractproperty', 'abc.abstractstaticmethod', 'abc.abstractmethod', 'abc.abstractclassmethod'} (13510) 'contextlib.contextmanager' (4587) [] (1...
False (20857)
1def decorated_with(
2 func: (
3 nodes.ClassDef | nodes.FunctionDef | astroid.BoundMethod | astroid.UnboundMethod
4 ),
5 qnames: Iterable[str],
6) -> bool:
7 """Determine if the `func` node has a decorator with the qualified name `qname`."""
8 decorators = func.decorators.nodes if func.decorators else []
9 for decorator_node in decorators:
10 if isinstance(decorator_node, nodes.Call):
11 # We only want to infer the function name
12 decorator_node = decorator_node.func
13 try:
14 if any(
15 i.name in qnames or i.qname() in qnames
16 for i in decorator_node.infer()
17 if i is not None and i != astroid.Uninferable
18 ):
19 return True
20 except astroid.InferenceError:
21 continue
22 return False
Path 2: 929 calls (0.04)
FunctionDef (822) BoundMethod (53) ClassDef (39) AsyncFunctionDef (11) UnboundMethod (4)
['typing.overload', 'overload'] (359) {'abc.abstractproperty', 'abc.abstractstaticmethod', 'abc.abstractmethod', 'abc.abstractclassmethod'} (227) 'con...
False (929)
1def decorated_with(
2 func: (
3 nodes.ClassDef | nodes.FunctionDef | astroid.BoundMethod | astroid.UnboundMethod
4 ),
5 qnames: Iterable[str],
6) -> bool:
7 """Determine if the `func` node has a decorator with the qualified name `qname`."""
8 decorators = func.decorators.nodes if func.decorators else []
9 for decorator_node in decorators:
10 if isinstance(decorator_node, nodes.Call):
11 # We only want to infer the function name
12 decorator_node = decorator_node.func
13 try:
14 if any(
15 i.name in qnames or i.qname() in qnames
16 for i in decorator_node.infer()
17 if i is not None and i != astroid.Uninferable
18 ):
19 return True
20 except astroid.InferenceError:
21 continue
22 return False
Path 3: 205 calls (0.01)
FunctionDef (168) ClassDef (37)
'contextlib.contextmanager' (119) ['typing.overload', 'overload'] (75) {'abc.abstractproperty', 'abc.abstractstaticmethod', 'abc.abstractmethod', 'abc...
False (205)
1def decorated_with(
2 func: (
3 nodes.ClassDef | nodes.FunctionDef | astroid.BoundMethod | astroid.UnboundMethod
4 ),
5 qnames: Iterable[str],
6) -> bool:
7 """Determine if the `func` node has a decorator with the qualified name `qname`."""
8 decorators = func.decorators.nodes if func.decorators else []
9 for decorator_node in decorators:
10 if isinstance(decorator_node, nodes.Call):
11 # We only want to infer the function name
12 decorator_node = decorator_node.func
13 try:
14 if any(
15 i.name in qnames or i.qname() in qnames
16 for i in decorator_node.infer()
17 if i is not None and i != astroid.Uninferable
18 ):
19 return True
20 except astroid.InferenceError:
21 continue
22 return False
Path 4: 158 calls (0.01)
FunctionDef (151) BoundMethod (4) AsyncFunctionDef (2) ClassDef (1)
{'abc.abstractproperty', 'abc.abstractstaticmethod', 'abc.abstractmethod', 'abc.abstractclassmethod'} (59) ['typing.overload', 'overload'] (31) ['cont...
True (158)
GeneratorExit (158)
1def decorated_with(
2 func: (
3 nodes.ClassDef | nodes.FunctionDef | astroid.BoundMethod | astroid.UnboundMethod
4 ),
5 qnames: Iterable[str],
6) -> bool:
7 """Determine if the `func` node has a decorator with the qualified name `qname`."""
8 decorators = func.decorators.nodes if func.decorators else []
9 for decorator_node in decorators:
10 if isinstance(decorator_node, nodes.Call):
11 # We only want to infer the function name
12 decorator_node = decorator_node.func
13 try:
14 if any(
15 i.name in qnames or i.qname() in qnames
16 for i in decorator_node.infer()
17 if i is not None and i != astroid.Uninferable
18 ):
19 return True
20 except astroid.InferenceError:
21 continue
22 return False
Path 5: 25 calls (0.0)
FunctionDef (25)
'contextlib.contextmanager' (18) ['typing.overload', 'overload'] (6) [] (1)
False (25)
InferenceError (22) NameInferenceError (3)
1def decorated_with(
2 func: (
3 nodes.ClassDef | nodes.FunctionDef | astroid.BoundMethod | astroid.UnboundMethod
4 ),
5 qnames: Iterable[str],
6) -> bool:
7 """Determine if the `func` node has a decorator with the qualified name `qname`."""
8 decorators = func.decorators.nodes if func.decorators else []
9 for decorator_node in decorators:
10 if isinstance(decorator_node, nodes.Call):
11 # We only want to infer the function name
12 decorator_node = decorator_node.func
13 try:
14 if any(
15 i.name in qnames or i.qname() in qnames
16 for i in decorator_node.infer()
17 if i is not None and i != astroid.Uninferable
18 ):
19 return True
20 except astroid.InferenceError:
21 continue
22 return False
Path 6: 9 calls (0.0)
FunctionDef (9)
'contextlib.contextmanager' (7) ['typing.overload', 'overload'] (2)
False (9)
InferenceError (7) NameInferenceError (2)
1def decorated_with(
2 func: (
3 nodes.ClassDef | nodes.FunctionDef | astroid.BoundMethod | astroid.UnboundMethod
4 ),
5 qnames: Iterable[str],
6) -> bool:
7 """Determine if the `func` node has a decorator with the qualified name `qname`."""
8 decorators = func.decorators.nodes if func.decorators else []
9 for decorator_node in decorators:
10 if isinstance(decorator_node, nodes.Call):
11 # We only want to infer the function name
12 decorator_node = decorator_node.func
13 try:
14 if any(
15 i.name in qnames or i.qname() in qnames
16 for i in decorator_node.infer()
17 if i is not None and i != astroid.Uninferable
18 ):
19 return True
20 except astroid.InferenceError:
21 continue
22 return False