Method: pylint.checkers.utils._supports_protocol
Calls: 1699, Exceptions: 0, Paths: 10Back
Path 1: 1312 calls (0.77)
Instance (423) Dict (332) List (298) Tuple (163) Const (54) Set (27) FrozenSet (5) Generator (5) AsyncGenerator (5)
_supports_iteration_protocol def (712) _supports_getitem_protocol def (286) _supports_mapping_protocol def (116) _supports_membership_test_protocol de...
True (1312)
1def _supports_protocol(
2 value: nodes.NodeNG, protocol_callback: Callable[[nodes.NodeNG], bool]
3) -> bool:
4 if isinstance(value, nodes.ClassDef):
5 if not has_known_bases(value):
6 return True
7 # classobj can only be iterable if it has an iterable metaclass
8 meta = value.metaclass()
9 if meta is not None:
10 if protocol_callback(meta):
11 return True
12 if isinstance(value, astroid.BaseInstance):
13 if not has_known_bases(value):
14 return True
15 if value.has_dynamic_getattr():
16 return True
17 if protocol_callback(value):
18 return True
19
20 if isinstance(value, nodes.ComprehensionScope):
21 return True
22
23 if (
24 isinstance(value, astroid.bases.Proxy)
25 and isinstance(value._proxied, astroid.BaseInstance)
26 and has_known_bases(value._proxied)
27 ):
28 value = value._proxied
29 return protocol_callback(value)
30
31 return False
Path 2: 162 calls (0.1)
Instance (162)
_supports_getitem_protocol def (160) _supports_iteration_protocol def (1) _supports_mapping_protocol def (1)
True (162)
1def _supports_protocol(
2 value: nodes.NodeNG, protocol_callback: Callable[[nodes.NodeNG], bool]
3) -> bool:
4 if isinstance(value, nodes.ClassDef):
5 if not has_known_bases(value):
6 return True
7 # classobj can only be iterable if it has an iterable metaclass
8 meta = value.metaclass()
9 if meta is not None:
10 if protocol_callback(meta):
11 return True
12 if isinstance(value, astroid.BaseInstance):
13 if not has_known_bases(value):
14 return True
15 if value.has_dynamic_getattr():
16 return True
17 if protocol_callback(value):
18 return True
19
20 if isinstance(value, nodes.ComprehensionScope):
21 return True
22
23 if (
24 isinstance(value, astroid.bases.Proxy)
25 and isinstance(value._proxied, astroid.BaseInstance)
26 and has_known_bases(value._proxied)
27 ):
28 value = value._proxied
29 return protocol_callback(value)
30
31 return False
Path 3: 90 calls (0.05)
DictItems (54) DictKeys (29) DictValues (7)
_supports_iteration_protocol def (79) _supports_membership_test_protocol def (11)
True (90)
1def _supports_protocol(
2 value: nodes.NodeNG, protocol_callback: Callable[[nodes.NodeNG], bool]
3) -> bool:
4 if isinstance(value, nodes.ClassDef):
5 if not has_known_bases(value):
6 return True
7 # classobj can only be iterable if it has an iterable metaclass
8 meta = value.metaclass()
9 if meta is not None:
10 if protocol_callback(meta):
11 return True
12 if isinstance(value, astroid.BaseInstance):
13 if not has_known_bases(value):
14 return True
15 if value.has_dynamic_getattr():
16 return True
17 if protocol_callback(value):
18 return True
19
20 if isinstance(value, nodes.ComprehensionScope):
21 return True
22
23 if (
24 isinstance(value, astroid.bases.Proxy)
25 and isinstance(value._proxied, astroid.BaseInstance)
26 and has_known_bases(value._proxied)
27 ):
28 value = value._proxied
29 return protocol_callback(value)
30
31 return False
Path 4: 72 calls (0.04)
Instance (45) Const (26) Generator (1)
_supports_iteration_protocol def (36) _supports_membership_test_protocol def (17) _supports_getitem_protocol def (11) _supports_mapping_protocol def (...
False (72)
1def _supports_protocol(
2 value: nodes.NodeNG, protocol_callback: Callable[[nodes.NodeNG], bool]
3) -> bool:
4 if isinstance(value, nodes.ClassDef):
5 if not has_known_bases(value):
6 return True
7 # classobj can only be iterable if it has an iterable metaclass
8 meta = value.metaclass()
9 if meta is not None:
10 if protocol_callback(meta):
11 return True
12 if isinstance(value, astroid.BaseInstance):
13 if not has_known_bases(value):
14 return True
15 if value.has_dynamic_getattr():
16 return True
17 if protocol_callback(value):
18 return True
19
20 if isinstance(value, nodes.ComprehensionScope):
21 return True
22
23 if (
24 isinstance(value, astroid.bases.Proxy)
25 and isinstance(value._proxied, astroid.BaseInstance)
26 and has_known_bases(value._proxied)
27 ):
28 value = value._proxied
29 return protocol_callback(value)
30
31 return False
Path 5: 21 calls (0.01)
ClassDef (21)
_supports_getitem_protocol def (10) _supports_iteration_protocol def (8) _supports_membership_test_protocol def (2) _supports_mapping_protocol def (1)...
False (21)
1def _supports_protocol(
2 value: nodes.NodeNG, protocol_callback: Callable[[nodes.NodeNG], bool]
3) -> bool:
4 if isinstance(value, nodes.ClassDef):
5 if not has_known_bases(value):
6 return True
7 # classobj can only be iterable if it has an iterable metaclass
8 meta = value.metaclass()
9 if meta is not None:
10 if protocol_callback(meta):
11 return True
12 if isinstance(value, astroid.BaseInstance):
13 if not has_known_bases(value):
14 return True
15 if value.has_dynamic_getattr():
16 return True
17 if protocol_callback(value):
18 return True
19
20 if isinstance(value, nodes.ComprehensionScope):
21 return True
22
23 if (
24 isinstance(value, astroid.bases.Proxy)
25 and isinstance(value._proxied, astroid.BaseInstance)
26 and has_known_bases(value._proxied)
27 ):
28 value = value._proxied
29 return protocol_callback(value)
30
31 return False
Path 6: 18 calls (0.01)
ClassDef (18)
_supports_getitem_protocol def (10) _supports_membership_test_protocol def (5) _supports_iteration_protocol def (3)
False (18)
1def _supports_protocol(
2 value: nodes.NodeNG, protocol_callback: Callable[[nodes.NodeNG], bool]
3) -> bool:
4 if isinstance(value, nodes.ClassDef):
5 if not has_known_bases(value):
6 return True
7 # classobj can only be iterable if it has an iterable metaclass
8 meta = value.metaclass()
9 if meta is not None:
10 if protocol_callback(meta):
11 return True
12 if isinstance(value, astroid.BaseInstance):
13 if not has_known_bases(value):
14 return True
15 if value.has_dynamic_getattr():
16 return True
17 if protocol_callback(value):
18 return True
19
20 if isinstance(value, nodes.ComprehensionScope):
21 return True
22
23 if (
24 isinstance(value, astroid.bases.Proxy)
25 and isinstance(value._proxied, astroid.BaseInstance)
26 and has_known_bases(value._proxied)
27 ):
28 value = value._proxied
29 return protocol_callback(value)
30
31 return False
Path 7: 10 calls (0.01)
FunctionDef (6) Property (3) Module (1)
_supports_iteration_protocol def (7) _supports_membership_test_protocol def (2) _supports_getitem_protocol def (1)
False (10)
1def _supports_protocol(
2 value: nodes.NodeNG, protocol_callback: Callable[[nodes.NodeNG], bool]
3) -> bool:
4 if isinstance(value, nodes.ClassDef):
5 if not has_known_bases(value):
6 return True
7 # classobj can only be iterable if it has an iterable metaclass
8 meta = value.metaclass()
9 if meta is not None:
10 if protocol_callback(meta):
11 return True
12 if isinstance(value, astroid.BaseInstance):
13 if not has_known_bases(value):
14 return True
15 if value.has_dynamic_getattr():
16 return True
17 if protocol_callback(value):
18 return True
19
20 if isinstance(value, nodes.ComprehensionScope):
21 return True
22
23 if (
24 isinstance(value, astroid.bases.Proxy)
25 and isinstance(value._proxied, astroid.BaseInstance)
26 and has_known_bases(value._proxied)
27 ):
28 value = value._proxied
29 return protocol_callback(value)
30
31 return False
Path 8: 7 calls (0.0)
ClassDef (7)
_supports_iteration_protocol def (5) _supports_mapping_protocol def (1) _supports_membership_test_protocol def (1)
True (7)
1def _supports_protocol(
2 value: nodes.NodeNG, protocol_callback: Callable[[nodes.NodeNG], bool]
3) -> bool:
4 if isinstance(value, nodes.ClassDef):
5 if not has_known_bases(value):
6 return True
7 # classobj can only be iterable if it has an iterable metaclass
8 meta = value.metaclass()
9 if meta is not None:
10 if protocol_callback(meta):
11 return True
12 if isinstance(value, astroid.BaseInstance):
13 if not has_known_bases(value):
14 return True
15 if value.has_dynamic_getattr():
16 return True
17 if protocol_callback(value):
18 return True
19
20 if isinstance(value, nodes.ComprehensionScope):
21 return True
22
23 if (
24 isinstance(value, astroid.bases.Proxy)
25 and isinstance(value._proxied, astroid.BaseInstance)
26 and has_known_bases(value._proxied)
27 ):
28 value = value._proxied
29 return protocol_callback(value)
30
31 return False
Path 9: 5 calls (0.0)
Instance (5)
_supports_getitem_protocol def (2) _supports_iteration_protocol def (1) _supports_mapping_protocol def (1) _supports_membership_test_protocol def (1) ...
True (5)
1def _supports_protocol(
2 value: nodes.NodeNG, protocol_callback: Callable[[nodes.NodeNG], bool]
3) -> bool:
4 if isinstance(value, nodes.ClassDef):
5 if not has_known_bases(value):
6 return True
7 # classobj can only be iterable if it has an iterable metaclass
8 meta = value.metaclass()
9 if meta is not None:
10 if protocol_callback(meta):
11 return True
12 if isinstance(value, astroid.BaseInstance):
13 if not has_known_bases(value):
14 return True
15 if value.has_dynamic_getattr():
16 return True
17 if protocol_callback(value):
18 return True
19
20 if isinstance(value, nodes.ComprehensionScope):
21 return True
22
23 if (
24 isinstance(value, astroid.bases.Proxy)
25 and isinstance(value._proxied, astroid.BaseInstance)
26 and has_known_bases(value._proxied)
27 ):
28 value = value._proxied
29 return protocol_callback(value)
30
31 return False
Path 10: 2 calls (0.0)
ClassDef (2)
_supports_getitem_protocol def (2)
True (2)
1def _supports_protocol(
2 value: nodes.NodeNG, protocol_callback: Callable[[nodes.NodeNG], bool]
3) -> bool:
4 if isinstance(value, nodes.ClassDef):
5 if not has_known_bases(value):
6 return True
7 # classobj can only be iterable if it has an iterable metaclass
8 meta = value.metaclass()
9 if meta is not None:
10 if protocol_callback(meta):
11 return True
12 if isinstance(value, astroid.BaseInstance):
13 if not has_known_bases(value):
14 return True
15 if value.has_dynamic_getattr():
16 return True
17 if protocol_callback(value):
18 return True
19
20 if isinstance(value, nodes.ComprehensionScope):
21 return True
22
23 if (
24 isinstance(value, astroid.bases.Proxy)
25 and isinstance(value._proxied, astroid.BaseInstance)
26 and has_known_bases(value._proxied)
27 ):
28 value = value._proxied
29 return protocol_callback(value)
30
31 return False