Path 1: 3 calls (0.21)

Module (3)

dict (3)

1def _check_all(
2        self, node: nodes.Module, not_consumed: dict[str, list[nodes.NodeNG]]
3    ) -> None:
4        assigned = next(node.igetattr("__all__"))
5        if assigned is astroid.Uninferable:
6            return
7        if not assigned.pytype() in {"builtins.list", "builtins.tuple"}:
8            line, col = assigned.tolineno, assigned.col_offset
9            self.add_message("invalid-all-format", line=line, col_offset=col, node=node)
10            return
11        for elt in getattr(assigned, "elts", ()):
12            try:
13                elt_name = next(elt.infer())
14            except astroid.InferenceError:
15                continue
16            if elt_name is astroid.Uninferable:
17                continue
18            if not elt_name.parent:
19                continue
20
21            if not isinstance(elt_name, nodes.Const) or not isinstance(
22                elt_name.value, str
23            ):
24                self.add_message("invalid-all-object", args=elt.as_string(), node=elt)
25                continue
26
27            elt_name = elt_name.value
28            # If elt is in not_consumed, remove it from not_consumed
29            if elt_name in not_consumed:
30                del not_consumed[elt_name]
31                continue
32
33            if elt_name not in node.locals:
34                if not node.package:
35                    self.add_message(
36                        "undefined-all-variable", args=(elt_name,), node=elt
37                    )
38                else:
39                    basename = os.path.splitext(node.file)[0]
40                    if os.path.basename(basename) == "__init__":
41                        name = node.name + "." + elt_name
42                        try:
43                            astroid.modutils.file_from_modpath(name.split("."))
44                        except ImportError:
45                            self.add_message(
46                                "undefined-all-variable", args=(elt_name,), node=elt
47                            )
48                        except SyntaxError:
49                            # don't yield a syntax-error warning,
50                            # because it will be later yielded
51                            # when the file will be checked
52                            pass
            

Path 2: 2 calls (0.14)

Module (2)

dict (2)

1def _check_all(
2        self, node: nodes.Module, not_consumed: dict[str, list[nodes.NodeNG]]
3    ) -> None:
4        assigned = next(node.igetattr("__all__"))
5        if assigned is astroid.Uninferable:
6            return
7        if not assigned.pytype() in {"builtins.list", "builtins.tuple"}:
8            line, col = assigned.tolineno, assigned.col_offset
9            self.add_message("invalid-all-format", line=line, col_offset=col, node=node)
10            return
11        for elt in getattr(assigned, "elts", ()):
12            try:
13                elt_name = next(elt.infer())
14            except astroid.InferenceError:
15                continue
16            if elt_name is astroid.Uninferable:
17                continue
18            if not elt_name.parent:
19                continue
20
21            if not isinstance(elt_name, nodes.Const) or not isinstance(
22                elt_name.value, str
23            ):
24                self.add_message("invalid-all-object", args=elt.as_string(), node=elt)
25                continue
26
27            elt_name = elt_name.value
28            # If elt is in not_consumed, remove it from not_consumed
29            if elt_name in not_consumed:
30                del not_consumed[elt_name]
31                continue
32
33            if elt_name not in node.locals:
34                if not node.package:
35                    self.add_message(
36                        "undefined-all-variable", args=(elt_name,), node=elt
37                    )
38                else:
39                    basename = os.path.splitext(node.file)[0]
40                    if os.path.basename(basename) == "__init__":
41                        name = node.name + "." + elt_name
42                        try:
43                            astroid.modutils.file_from_modpath(name.split("."))
44                        except ImportError:
45                            self.add_message(
46                                "undefined-all-variable", args=(elt_name,), node=elt
47                            )
48                        except SyntaxError:
49                            # don't yield a syntax-error warning,
50                            # because it will be later yielded
51                            # when the file will be checked
52                            pass
            

Path 3: 2 calls (0.14)

Module (2)

dict (2)

1def _check_all(
2        self, node: nodes.Module, not_consumed: dict[str, list[nodes.NodeNG]]
3    ) -> None:
4        assigned = next(node.igetattr("__all__"))
5        if assigned is astroid.Uninferable:
6            return
7        if not assigned.pytype() in {"builtins.list", "builtins.tuple"}:
8            line, col = assigned.tolineno, assigned.col_offset
9            self.add_message("invalid-all-format", line=line, col_offset=col, node=node)
10            return
11        for elt in getattr(assigned, "elts", ()):
12            try:
13                elt_name = next(elt.infer())
14            except astroid.InferenceError:
15                continue
16            if elt_name is astroid.Uninferable:
17                continue
18            if not elt_name.parent:
19                continue
20
21            if not isinstance(elt_name, nodes.Const) or not isinstance(
22                elt_name.value, str
23            ):
24                self.add_message("invalid-all-object", args=elt.as_string(), node=elt)
25                continue
26
27            elt_name = elt_name.value
28            # If elt is in not_consumed, remove it from not_consumed
29            if elt_name in not_consumed:
30                del not_consumed[elt_name]
31                continue
32
33            if elt_name not in node.locals:
34                if not node.package:
35                    self.add_message(
36                        "undefined-all-variable", args=(elt_name,), node=elt
37                    )
38                else:
39                    basename = os.path.splitext(node.file)[0]
40                    if os.path.basename(basename) == "__init__":
41                        name = node.name + "." + elt_name
42                        try:
43                            astroid.modutils.file_from_modpath(name.split("."))
44                        except ImportError:
45                            self.add_message(
46                                "undefined-all-variable", args=(elt_name,), node=elt
47                            )
48                        except SyntaxError:
49                            # don't yield a syntax-error warning,
50                            # because it will be later yielded
51                            # when the file will be checked
52                            pass
            

Path 4: 2 calls (0.14)

Module (2)

dict (2)

None (2)

1def _check_all(
2        self, node: nodes.Module, not_consumed: dict[str, list[nodes.NodeNG]]
3    ) -> None:
4        assigned = next(node.igetattr("__all__"))
5        if assigned is astroid.Uninferable:
6            return
7        if not assigned.pytype() in {"builtins.list", "builtins.tuple"}:
8            line, col = assigned.tolineno, assigned.col_offset
9            self.add_message("invalid-all-format", line=line, col_offset=col, node=node)
10            return
11        for elt in getattr(assigned, "elts", ()):
12            try:
13                elt_name = next(elt.infer())
14            except astroid.InferenceError:
15                continue
16            if elt_name is astroid.Uninferable:
17                continue
18            if not elt_name.parent:
19                continue
20
21            if not isinstance(elt_name, nodes.Const) or not isinstance(
22                elt_name.value, str
23            ):
24                self.add_message("invalid-all-object", args=elt.as_string(), node=elt)
25                continue
26
27            elt_name = elt_name.value
28            # If elt is in not_consumed, remove it from not_consumed
29            if elt_name in not_consumed:
30                del not_consumed[elt_name]
31                continue
32
33            if elt_name not in node.locals:
34                if not node.package:
35                    self.add_message(
36                        "undefined-all-variable", args=(elt_name,), node=elt
37                    )
38                else:
39                    basename = os.path.splitext(node.file)[0]
40                    if os.path.basename(basename) == "__init__":
41                        name = node.name + "." + elt_name
42                        try:
43                            astroid.modutils.file_from_modpath(name.split("."))
44                        except ImportError:
45                            self.add_message(
46                                "undefined-all-variable", args=(elt_name,), node=elt
47                            )
48                        except SyntaxError:
49                            # don't yield a syntax-error warning,
50                            # because it will be later yielded
51                            # when the file will be checked
52                            pass
            

Path 5: 1 calls (0.07)

Module (1)

dict (1)

None (1)

1def _check_all(
2        self, node: nodes.Module, not_consumed: dict[str, list[nodes.NodeNG]]
3    ) -> None:
4        assigned = next(node.igetattr("__all__"))
5        if assigned is astroid.Uninferable:
6            return
7        if not assigned.pytype() in {"builtins.list", "builtins.tuple"}:
8            line, col = assigned.tolineno, assigned.col_offset
9            self.add_message("invalid-all-format", line=line, col_offset=col, node=node)
10            return
11        for elt in getattr(assigned, "elts", ()):
12            try:
13                elt_name = next(elt.infer())
14            except astroid.InferenceError:
15                continue
16            if elt_name is astroid.Uninferable:
17                continue
18            if not elt_name.parent:
19                continue
20
21            if not isinstance(elt_name, nodes.Const) or not isinstance(
22                elt_name.value, str
23            ):
24                self.add_message("invalid-all-object", args=elt.as_string(), node=elt)
25                continue
26
27            elt_name = elt_name.value
28            # If elt is in not_consumed, remove it from not_consumed
29            if elt_name in not_consumed:
30                del not_consumed[elt_name]
31                continue
32
33            if elt_name not in node.locals:
34                if not node.package:
35                    self.add_message(
36                        "undefined-all-variable", args=(elt_name,), node=elt
37                    )
38                else:
39                    basename = os.path.splitext(node.file)[0]
40                    if os.path.basename(basename) == "__init__":
41                        name = node.name + "." + elt_name
42                        try:
43                            astroid.modutils.file_from_modpath(name.split("."))
44                        except ImportError:
45                            self.add_message(
46                                "undefined-all-variable", args=(elt_name,), node=elt
47                            )
48                        except SyntaxError:
49                            # don't yield a syntax-error warning,
50                            # because it will be later yielded
51                            # when the file will be checked
52                            pass
            

Path 6: 1 calls (0.07)

Module (1)

dict (1)

1def _check_all(
2        self, node: nodes.Module, not_consumed: dict[str, list[nodes.NodeNG]]
3    ) -> None:
4        assigned = next(node.igetattr("__all__"))
5        if assigned is astroid.Uninferable:
6            return
7        if not assigned.pytype() in {"builtins.list", "builtins.tuple"}:
8            line, col = assigned.tolineno, assigned.col_offset
9            self.add_message("invalid-all-format", line=line, col_offset=col, node=node)
10            return
11        for elt in getattr(assigned, "elts", ()):
12            try:
13                elt_name = next(elt.infer())
14            except astroid.InferenceError:
15                continue
16            if elt_name is astroid.Uninferable:
17                continue
18            if not elt_name.parent:
19                continue
20
21            if not isinstance(elt_name, nodes.Const) or not isinstance(
22                elt_name.value, str
23            ):
24                self.add_message("invalid-all-object", args=elt.as_string(), node=elt)
25                continue
26
27            elt_name = elt_name.value
28            # If elt is in not_consumed, remove it from not_consumed
29            if elt_name in not_consumed:
30                del not_consumed[elt_name]
31                continue
32
33            if elt_name not in node.locals:
34                if not node.package:
35                    self.add_message(
36                        "undefined-all-variable", args=(elt_name,), node=elt
37                    )
38                else:
39                    basename = os.path.splitext(node.file)[0]
40                    if os.path.basename(basename) == "__init__":
41                        name = node.name + "." + elt_name
42                        try:
43                            astroid.modutils.file_from_modpath(name.split("."))
44                        except ImportError:
45                            self.add_message(
46                                "undefined-all-variable", args=(elt_name,), node=elt
47                            )
48                        except SyntaxError:
49                            # don't yield a syntax-error warning,
50                            # because it will be later yielded
51                            # when the file will be checked
52                            pass
            

Path 7: 1 calls (0.07)

Module (1)

dict (1)

NameInferenceError (1)

1def _check_all(
2        self, node: nodes.Module, not_consumed: dict[str, list[nodes.NodeNG]]
3    ) -> None:
4        assigned = next(node.igetattr("__all__"))
5        if assigned is astroid.Uninferable:
6            return
7        if not assigned.pytype() in {"builtins.list", "builtins.tuple"}:
8            line, col = assigned.tolineno, assigned.col_offset
9            self.add_message("invalid-all-format", line=line, col_offset=col, node=node)
10            return
11        for elt in getattr(assigned, "elts", ()):
12            try:
13                elt_name = next(elt.infer())
14            except astroid.InferenceError:
15                continue
16            if elt_name is astroid.Uninferable:
17                continue
18            if not elt_name.parent:
19                continue
20
21            if not isinstance(elt_name, nodes.Const) or not isinstance(
22                elt_name.value, str
23            ):
24                self.add_message("invalid-all-object", args=elt.as_string(), node=elt)
25                continue
26
27            elt_name = elt_name.value
28            # If elt is in not_consumed, remove it from not_consumed
29            if elt_name in not_consumed:
30                del not_consumed[elt_name]
31                continue
32
33            if elt_name not in node.locals:
34                if not node.package:
35                    self.add_message(
36                        "undefined-all-variable", args=(elt_name,), node=elt
37                    )
38                else:
39                    basename = os.path.splitext(node.file)[0]
40                    if os.path.basename(basename) == "__init__":
41                        name = node.name + "." + elt_name
42                        try:
43                            astroid.modutils.file_from_modpath(name.split("."))
44                        except ImportError:
45                            self.add_message(
46                                "undefined-all-variable", args=(elt_name,), node=elt
47                            )
48                        except SyntaxError:
49                            # don't yield a syntax-error warning,
50                            # because it will be later yielded
51                            # when the file will be checked
52                            pass
            

Path 8: 1 calls (0.07)

Module (1)

dict (1)

1def _check_all(
2        self, node: nodes.Module, not_consumed: dict[str, list[nodes.NodeNG]]
3    ) -> None:
4        assigned = next(node.igetattr("__all__"))
5        if assigned is astroid.Uninferable:
6            return
7        if not assigned.pytype() in {"builtins.list", "builtins.tuple"}:
8            line, col = assigned.tolineno, assigned.col_offset
9            self.add_message("invalid-all-format", line=line, col_offset=col, node=node)
10            return
11        for elt in getattr(assigned, "elts", ()):
12            try:
13                elt_name = next(elt.infer())
14            except astroid.InferenceError:
15                continue
16            if elt_name is astroid.Uninferable:
17                continue
18            if not elt_name.parent:
19                continue
20
21            if not isinstance(elt_name, nodes.Const) or not isinstance(
22                elt_name.value, str
23            ):
24                self.add_message("invalid-all-object", args=elt.as_string(), node=elt)
25                continue
26
27            elt_name = elt_name.value
28            # If elt is in not_consumed, remove it from not_consumed
29            if elt_name in not_consumed:
30                del not_consumed[elt_name]
31                continue
32
33            if elt_name not in node.locals:
34                if not node.package:
35                    self.add_message(
36                        "undefined-all-variable", args=(elt_name,), node=elt
37                    )
38                else:
39                    basename = os.path.splitext(node.file)[0]
40                    if os.path.basename(basename) == "__init__":
41                        name = node.name + "." + elt_name
42                        try:
43                            astroid.modutils.file_from_modpath(name.split("."))
44                        except ImportError:
45                            self.add_message(
46                                "undefined-all-variable", args=(elt_name,), node=elt
47                            )
48                        except SyntaxError:
49                            # don't yield a syntax-error warning,
50                            # because it will be later yielded
51                            # when the file will be checked
52                            pass
            

Path 9: 1 calls (0.07)

Module (1)

dict (1)

ImportError (1)

1def _check_all(
2        self, node: nodes.Module, not_consumed: dict[str, list[nodes.NodeNG]]
3    ) -> None:
4        assigned = next(node.igetattr("__all__"))
5        if assigned is astroid.Uninferable:
6            return
7        if not assigned.pytype() in {"builtins.list", "builtins.tuple"}:
8            line, col = assigned.tolineno, assigned.col_offset
9            self.add_message("invalid-all-format", line=line, col_offset=col, node=node)
10            return
11        for elt in getattr(assigned, "elts", ()):
12            try:
13                elt_name = next(elt.infer())
14            except astroid.InferenceError:
15                continue
16            if elt_name is astroid.Uninferable:
17                continue
18            if not elt_name.parent:
19                continue
20
21            if not isinstance(elt_name, nodes.Const) or not isinstance(
22                elt_name.value, str
23            ):
24                self.add_message("invalid-all-object", args=elt.as_string(), node=elt)
25                continue
26
27            elt_name = elt_name.value
28            # If elt is in not_consumed, remove it from not_consumed
29            if elt_name in not_consumed:
30                del not_consumed[elt_name]
31                continue
32
33            if elt_name not in node.locals:
34                if not node.package:
35                    self.add_message(
36                        "undefined-all-variable", args=(elt_name,), node=elt
37                    )
38                else:
39                    basename = os.path.splitext(node.file)[0]
40                    if os.path.basename(basename) == "__init__":
41                        name = node.name + "." + elt_name
42                        try:
43                            astroid.modutils.file_from_modpath(name.split("."))
44                        except ImportError:
45                            self.add_message(
46                                "undefined-all-variable", args=(elt_name,), node=elt
47                            )
48                        except SyntaxError:
49                            # don't yield a syntax-error warning,
50                            # because it will be later yielded
51                            # when the file will be checked
52                            pass