Method: pylint.checkers.utils.is_terminating_func
Calls: 5710, Exceptions: 183, Paths: 10Back
Path 1: 3829 calls (0.67)
Call (3829)
False (3829)
1def is_terminating_func(node: nodes.Call) -> bool:
2 """Detect call to exit(), quit(), os._exit(), or sys.exit()."""
3 if (
4 not isinstance(node.func, nodes.Attribute)
5 and not (isinstance(node.func, nodes.Name))
6 or isinstance(node.parent, nodes.Lambda)
7 ):
8 return False
9
10 try:
11 for inferred in node.func.infer():
12 if (
13 hasattr(inferred, "qname")
14 and inferred.qname() in TERMINATING_FUNCS_QNAMES
15 ):
16 return True
17 except (StopIteration, astroid.InferenceError):
18 pass
19
20 return False
Path 2: 1556 calls (0.27)
Call (1556)
False (1556)
1def is_terminating_func(node: nodes.Call) -> bool:
2 """Detect call to exit(), quit(), os._exit(), or sys.exit()."""
3 if (
4 not isinstance(node.func, nodes.Attribute)
5 and not (isinstance(node.func, nodes.Name))
6 or isinstance(node.parent, nodes.Lambda)
7 ):
8 return False
9
10 try:
11 for inferred in node.func.infer():
12 if (
13 hasattr(inferred, "qname")
14 and inferred.qname() in TERMINATING_FUNCS_QNAMES
15 ):
16 return True
17 except (StopIteration, astroid.InferenceError):
18 pass
19
20 return False
Path 3: 151 calls (0.03)
Call (151)
False (151)
InferenceError (116) NameInferenceError (35)
1def is_terminating_func(node: nodes.Call) -> bool:
2 """Detect call to exit(), quit(), os._exit(), or sys.exit()."""
3 if (
4 not isinstance(node.func, nodes.Attribute)
5 and not (isinstance(node.func, nodes.Name))
6 or isinstance(node.parent, nodes.Lambda)
7 ):
8 return False
9
10 try:
11 for inferred in node.func.infer():
12 if (
13 hasattr(inferred, "qname")
14 and inferred.qname() in TERMINATING_FUNCS_QNAMES
15 ):
16 return True
17 except (StopIteration, astroid.InferenceError):
18 pass
19
20 return False
Path 4: 68 calls (0.01)
Call (68)
False (68)
1def is_terminating_func(node: nodes.Call) -> bool:
2 """Detect call to exit(), quit(), os._exit(), or sys.exit()."""
3 if (
4 not isinstance(node.func, nodes.Attribute)
5 and not (isinstance(node.func, nodes.Name))
6 or isinstance(node.parent, nodes.Lambda)
7 ):
8 return False
9
10 try:
11 for inferred in node.func.infer():
12 if (
13 hasattr(inferred, "qname")
14 and inferred.qname() in TERMINATING_FUNCS_QNAMES
15 ):
16 return True
17 except (StopIteration, astroid.InferenceError):
18 pass
19
20 return False
Path 5: 47 calls (0.01)
Call (47)
False (47)
1def is_terminating_func(node: nodes.Call) -> bool:
2 """Detect call to exit(), quit(), os._exit(), or sys.exit()."""
3 if (
4 not isinstance(node.func, nodes.Attribute)
5 and not (isinstance(node.func, nodes.Name))
6 or isinstance(node.parent, nodes.Lambda)
7 ):
8 return False
9
10 try:
11 for inferred in node.func.infer():
12 if (
13 hasattr(inferred, "qname")
14 and inferred.qname() in TERMINATING_FUNCS_QNAMES
15 ):
16 return True
17 except (StopIteration, astroid.InferenceError):
18 pass
19
20 return False
Path 6: 32 calls (0.01)
Call (32)
False (32)
NameInferenceError (32)
1def is_terminating_func(node: nodes.Call) -> bool:
2 """Detect call to exit(), quit(), os._exit(), or sys.exit()."""
3 if (
4 not isinstance(node.func, nodes.Attribute)
5 and not (isinstance(node.func, nodes.Name))
6 or isinstance(node.parent, nodes.Lambda)
7 ):
8 return False
9
10 try:
11 for inferred in node.func.infer():
12 if (
13 hasattr(inferred, "qname")
14 and inferred.qname() in TERMINATING_FUNCS_QNAMES
15 ):
16 return True
17 except (StopIteration, astroid.InferenceError):
18 pass
19
20 return False
Path 7: 11 calls (0.0)
Call (11)
True (11)
1def is_terminating_func(node: nodes.Call) -> bool:
2 """Detect call to exit(), quit(), os._exit(), or sys.exit()."""
3 if (
4 not isinstance(node.func, nodes.Attribute)
5 and not (isinstance(node.func, nodes.Name))
6 or isinstance(node.parent, nodes.Lambda)
7 ):
8 return False
9
10 try:
11 for inferred in node.func.infer():
12 if (
13 hasattr(inferred, "qname")
14 and inferred.qname() in TERMINATING_FUNCS_QNAMES
15 ):
16 return True
17 except (StopIteration, astroid.InferenceError):
18 pass
19
20 return False
Path 8: 10 calls (0.0)
Call (10)
True (10)
1def is_terminating_func(node: nodes.Call) -> bool:
2 """Detect call to exit(), quit(), os._exit(), or sys.exit()."""
3 if (
4 not isinstance(node.func, nodes.Attribute)
5 and not (isinstance(node.func, nodes.Name))
6 or isinstance(node.parent, nodes.Lambda)
7 ):
8 return False
9
10 try:
11 for inferred in node.func.infer():
12 if (
13 hasattr(inferred, "qname")
14 and inferred.qname() in TERMINATING_FUNCS_QNAMES
15 ):
16 return True
17 except (StopIteration, astroid.InferenceError):
18 pass
19
20 return False
Path 9: 5 calls (0.0)
Call (5)
False (5)
1def is_terminating_func(node: nodes.Call) -> bool:
2 """Detect call to exit(), quit(), os._exit(), or sys.exit()."""
3 if (
4 not isinstance(node.func, nodes.Attribute)
5 and not (isinstance(node.func, nodes.Name))
6 or isinstance(node.parent, nodes.Lambda)
7 ):
8 return False
9
10 try:
11 for inferred in node.func.infer():
12 if (
13 hasattr(inferred, "qname")
14 and inferred.qname() in TERMINATING_FUNCS_QNAMES
15 ):
16 return True
17 except (StopIteration, astroid.InferenceError):
18 pass
19
20 return False
Path 10: 1 calls (0.0)
Call (1)
False (1)
1def is_terminating_func(node: nodes.Call) -> bool:
2 """Detect call to exit(), quit(), os._exit(), or sys.exit()."""
3 if (
4 not isinstance(node.func, nodes.Attribute)
5 and not (isinstance(node.func, nodes.Name))
6 or isinstance(node.parent, nodes.Lambda)
7 ):
8 return False
9
10 try:
11 for inferred in node.func.infer():
12 if (
13 hasattr(inferred, "qname")
14 and inferred.qname() in TERMINATING_FUNCS_QNAMES
15 ):
16 return True
17 except (StopIteration, astroid.InferenceError):
18 pass
19
20 return False