Path 1: 1257 calls (0.87)

ClassDef (1257)

{} (1257)

1def _check_accessed_members(
2        self, node: nodes.ClassDef, accessed: dict[str, list[_AccessNodes]]
3    ) -> None:
4        """Check that accessed members are defined."""
5        excs = ("AttributeError", "Exception", "BaseException")
6        for attr, nodes_lst in accessed.items():
7            try:
8                # is it a class attribute ?
9                node.local_attr(attr)
10                # yes, stop here
11                continue
12            except astroid.NotFoundError:
13                pass
14            # is it an instance attribute of a parent class ?
15            try:
16                next(node.instance_attr_ancestors(attr))
17                # yes, stop here
18                continue
19            except StopIteration:
20                pass
21            # is it an instance attribute ?
22            try:
23                defstmts = node.instance_attr(attr)
24            except astroid.NotFoundError:
25                pass
26            else:
27                # filter out augment assignment nodes
28                defstmts = [stmt for stmt in defstmts if stmt not in nodes_lst]
29                if not defstmts:
30                    # only augment assignment for this node, no-member should be
31                    # triggered by the typecheck checker
32                    continue
33                # filter defstmts to only pick the first one when there are
34                # several assignments in the same scope
35                scope = defstmts[0].scope()
36                defstmts = [
37                    stmt
38                    for i, stmt in enumerate(defstmts)
39                    if i == 0 or stmt.scope() is not scope
40                ]
41                # if there are still more than one, don't attempt to be smarter
42                # than we can be
43                if len(defstmts) == 1:
44                    defstmt = defstmts[0]
45                    # check that if the node is accessed in the same method as
46                    # it's defined, it's accessed after the initial assignment
47                    frame = defstmt.frame(future=True)
48                    lno = defstmt.fromlineno
49                    for _node in nodes_lst:
50                        if (
51                            _node.frame(future=True) is frame
52                            and _node.fromlineno < lno
53                            and not astroid.are_exclusive(
54                                _node.statement(future=True), defstmt, excs
55                            )
56                        ):
57                            self.add_message(
58                                "access-member-before-definition",
59                                node=_node,
60                                args=(attr, lno),
61                            )
            

Path 2: 92 calls (0.06)

ClassDef (92)

defaultdict (92)

1def _check_accessed_members(
2        self, node: nodes.ClassDef, accessed: dict[str, list[_AccessNodes]]
3    ) -> None:
4        """Check that accessed members are defined."""
5        excs = ("AttributeError", "Exception", "BaseException")
6        for attr, nodes_lst in accessed.items():
7            try:
8                # is it a class attribute ?
9                node.local_attr(attr)
10                # yes, stop here
11                continue
12            except astroid.NotFoundError:
13                pass
14            # is it an instance attribute of a parent class ?
15            try:
16                next(node.instance_attr_ancestors(attr))
17                # yes, stop here
18                continue
19            except StopIteration:
20                pass
21            # is it an instance attribute ?
22            try:
23                defstmts = node.instance_attr(attr)
24            except astroid.NotFoundError:
25                pass
26            else:
27                # filter out augment assignment nodes
28                defstmts = [stmt for stmt in defstmts if stmt not in nodes_lst]
29                if not defstmts:
30                    # only augment assignment for this node, no-member should be
31                    # triggered by the typecheck checker
32                    continue
33                # filter defstmts to only pick the first one when there are
34                # several assignments in the same scope
35                scope = defstmts[0].scope()
36                defstmts = [
37                    stmt
38                    for i, stmt in enumerate(defstmts)
39                    if i == 0 or stmt.scope() is not scope
40                ]
41                # if there are still more than one, don't attempt to be smarter
42                # than we can be
43                if len(defstmts) == 1:
44                    defstmt = defstmts[0]
45                    # check that if the node is accessed in the same method as
46                    # it's defined, it's accessed after the initial assignment
47                    frame = defstmt.frame(future=True)
48                    lno = defstmt.fromlineno
49                    for _node in nodes_lst:
50                        if (
51                            _node.frame(future=True) is frame
52                            and _node.fromlineno < lno
53                            and not astroid.are_exclusive(
54                                _node.statement(future=True), defstmt, excs
55                            )
56                        ):
57                            self.add_message(
58                                "access-member-before-definition",
59                                node=_node,
60                                args=(attr, lno),
61                            )
            

Path 3: 42 calls (0.03)

ClassDef (42)

defaultdict (42)

StopIteration (42)

1def _check_accessed_members(
2        self, node: nodes.ClassDef, accessed: dict[str, list[_AccessNodes]]
3    ) -> None:
4        """Check that accessed members are defined."""
5        excs = ("AttributeError", "Exception", "BaseException")
6        for attr, nodes_lst in accessed.items():
7            try:
8                # is it a class attribute ?
9                node.local_attr(attr)
10                # yes, stop here
11                continue
12            except astroid.NotFoundError:
13                pass
14            # is it an instance attribute of a parent class ?
15            try:
16                next(node.instance_attr_ancestors(attr))
17                # yes, stop here
18                continue
19            except StopIteration:
20                pass
21            # is it an instance attribute ?
22            try:
23                defstmts = node.instance_attr(attr)
24            except astroid.NotFoundError:
25                pass
26            else:
27                # filter out augment assignment nodes
28                defstmts = [stmt for stmt in defstmts if stmt not in nodes_lst]
29                if not defstmts:
30                    # only augment assignment for this node, no-member should be
31                    # triggered by the typecheck checker
32                    continue
33                # filter defstmts to only pick the first one when there are
34                # several assignments in the same scope
35                scope = defstmts[0].scope()
36                defstmts = [
37                    stmt
38                    for i, stmt in enumerate(defstmts)
39                    if i == 0 or stmt.scope() is not scope
40                ]
41                # if there are still more than one, don't attempt to be smarter
42                # than we can be
43                if len(defstmts) == 1:
44                    defstmt = defstmts[0]
45                    # check that if the node is accessed in the same method as
46                    # it's defined, it's accessed after the initial assignment
47                    frame = defstmt.frame(future=True)
48                    lno = defstmt.fromlineno
49                    for _node in nodes_lst:
50                        if (
51                            _node.frame(future=True) is frame
52                            and _node.fromlineno < lno
53                            and not astroid.are_exclusive(
54                                _node.statement(future=True), defstmt, excs
55                            )
56                        ):
57                            self.add_message(
58                                "access-member-before-definition",
59                                node=_node,
60                                args=(attr, lno),
61                            )
            

Path 4: 15 calls (0.01)

ClassDef (15)

defaultdict (15)

StopIteration (15)

1def _check_accessed_members(
2        self, node: nodes.ClassDef, accessed: dict[str, list[_AccessNodes]]
3    ) -> None:
4        """Check that accessed members are defined."""
5        excs = ("AttributeError", "Exception", "BaseException")
6        for attr, nodes_lst in accessed.items():
7            try:
8                # is it a class attribute ?
9                node.local_attr(attr)
10                # yes, stop here
11                continue
12            except astroid.NotFoundError:
13                pass
14            # is it an instance attribute of a parent class ?
15            try:
16                next(node.instance_attr_ancestors(attr))
17                # yes, stop here
18                continue
19            except StopIteration:
20                pass
21            # is it an instance attribute ?
22            try:
23                defstmts = node.instance_attr(attr)
24            except astroid.NotFoundError:
25                pass
26            else:
27                # filter out augment assignment nodes
28                defstmts = [stmt for stmt in defstmts if stmt not in nodes_lst]
29                if not defstmts:
30                    # only augment assignment for this node, no-member should be
31                    # triggered by the typecheck checker
32                    continue
33                # filter defstmts to only pick the first one when there are
34                # several assignments in the same scope
35                scope = defstmts[0].scope()
36                defstmts = [
37                    stmt
38                    for i, stmt in enumerate(defstmts)
39                    if i == 0 or stmt.scope() is not scope
40                ]
41                # if there are still more than one, don't attempt to be smarter
42                # than we can be
43                if len(defstmts) == 1:
44                    defstmt = defstmts[0]
45                    # check that if the node is accessed in the same method as
46                    # it's defined, it's accessed after the initial assignment
47                    frame = defstmt.frame(future=True)
48                    lno = defstmt.fromlineno
49                    for _node in nodes_lst:
50                        if (
51                            _node.frame(future=True) is frame
52                            and _node.fromlineno < lno
53                            and not astroid.are_exclusive(
54                                _node.statement(future=True), defstmt, excs
55                            )
56                        ):
57                            self.add_message(
58                                "access-member-before-definition",
59                                node=_node,
60                                args=(attr, lno),
61                            )
            

Path 5: 13 calls (0.01)

ClassDef (13)

defaultdict (13)

AttributeInferenceError (13)

1def _check_accessed_members(
2        self, node: nodes.ClassDef, accessed: dict[str, list[_AccessNodes]]
3    ) -> None:
4        """Check that accessed members are defined."""
5        excs = ("AttributeError", "Exception", "BaseException")
6        for attr, nodes_lst in accessed.items():
7            try:
8                # is it a class attribute ?
9                node.local_attr(attr)
10                # yes, stop here
11                continue
12            except astroid.NotFoundError:
13                pass
14            # is it an instance attribute of a parent class ?
15            try:
16                next(node.instance_attr_ancestors(attr))
17                # yes, stop here
18                continue
19            except StopIteration:
20                pass
21            # is it an instance attribute ?
22            try:
23                defstmts = node.instance_attr(attr)
24            except astroid.NotFoundError:
25                pass
26            else:
27                # filter out augment assignment nodes
28                defstmts = [stmt for stmt in defstmts if stmt not in nodes_lst]
29                if not defstmts:
30                    # only augment assignment for this node, no-member should be
31                    # triggered by the typecheck checker
32                    continue
33                # filter defstmts to only pick the first one when there are
34                # several assignments in the same scope
35                scope = defstmts[0].scope()
36                defstmts = [
37                    stmt
38                    for i, stmt in enumerate(defstmts)
39                    if i == 0 or stmt.scope() is not scope
40                ]
41                # if there are still more than one, don't attempt to be smarter
42                # than we can be
43                if len(defstmts) == 1:
44                    defstmt = defstmts[0]
45                    # check that if the node is accessed in the same method as
46                    # it's defined, it's accessed after the initial assignment
47                    frame = defstmt.frame(future=True)
48                    lno = defstmt.fromlineno
49                    for _node in nodes_lst:
50                        if (
51                            _node.frame(future=True) is frame
52                            and _node.fromlineno < lno
53                            and not astroid.are_exclusive(
54                                _node.statement(future=True), defstmt, excs
55                            )
56                        ):
57                            self.add_message(
58                                "access-member-before-definition",
59                                node=_node,
60                                args=(attr, lno),
61                            )
            

Path 6: 9 calls (0.01)

ClassDef (9)

defaultdict (9)

StopIteration (9)

1def _check_accessed_members(
2        self, node: nodes.ClassDef, accessed: dict[str, list[_AccessNodes]]
3    ) -> None:
4        """Check that accessed members are defined."""
5        excs = ("AttributeError", "Exception", "BaseException")
6        for attr, nodes_lst in accessed.items():
7            try:
8                # is it a class attribute ?
9                node.local_attr(attr)
10                # yes, stop here
11                continue
12            except astroid.NotFoundError:
13                pass
14            # is it an instance attribute of a parent class ?
15            try:
16                next(node.instance_attr_ancestors(attr))
17                # yes, stop here
18                continue
19            except StopIteration:
20                pass
21            # is it an instance attribute ?
22            try:
23                defstmts = node.instance_attr(attr)
24            except astroid.NotFoundError:
25                pass
26            else:
27                # filter out augment assignment nodes
28                defstmts = [stmt for stmt in defstmts if stmt not in nodes_lst]
29                if not defstmts:
30                    # only augment assignment for this node, no-member should be
31                    # triggered by the typecheck checker
32                    continue
33                # filter defstmts to only pick the first one when there are
34                # several assignments in the same scope
35                scope = defstmts[0].scope()
36                defstmts = [
37                    stmt
38                    for i, stmt in enumerate(defstmts)
39                    if i == 0 or stmt.scope() is not scope
40                ]
41                # if there are still more than one, don't attempt to be smarter
42                # than we can be
43                if len(defstmts) == 1:
44                    defstmt = defstmts[0]
45                    # check that if the node is accessed in the same method as
46                    # it's defined, it's accessed after the initial assignment
47                    frame = defstmt.frame(future=True)
48                    lno = defstmt.fromlineno
49                    for _node in nodes_lst:
50                        if (
51                            _node.frame(future=True) is frame
52                            and _node.fromlineno < lno
53                            and not astroid.are_exclusive(
54                                _node.statement(future=True), defstmt, excs
55                            )
56                        ):
57                            self.add_message(
58                                "access-member-before-definition",
59                                node=_node,
60                                args=(attr, lno),
61                            )
            

Path 7: 6 calls (0.0)

ClassDef (6)

defaultdict (6)

StopIteration (6)

1def _check_accessed_members(
2        self, node: nodes.ClassDef, accessed: dict[str, list[_AccessNodes]]
3    ) -> None:
4        """Check that accessed members are defined."""
5        excs = ("AttributeError", "Exception", "BaseException")
6        for attr, nodes_lst in accessed.items():
7            try:
8                # is it a class attribute ?
9                node.local_attr(attr)
10                # yes, stop here
11                continue
12            except astroid.NotFoundError:
13                pass
14            # is it an instance attribute of a parent class ?
15            try:
16                next(node.instance_attr_ancestors(attr))
17                # yes, stop here
18                continue
19            except StopIteration:
20                pass
21            # is it an instance attribute ?
22            try:
23                defstmts = node.instance_attr(attr)
24            except astroid.NotFoundError:
25                pass
26            else:
27                # filter out augment assignment nodes
28                defstmts = [stmt for stmt in defstmts if stmt not in nodes_lst]
29                if not defstmts:
30                    # only augment assignment for this node, no-member should be
31                    # triggered by the typecheck checker
32                    continue
33                # filter defstmts to only pick the first one when there are
34                # several assignments in the same scope
35                scope = defstmts[0].scope()
36                defstmts = [
37                    stmt
38                    for i, stmt in enumerate(defstmts)
39                    if i == 0 or stmt.scope() is not scope
40                ]
41                # if there are still more than one, don't attempt to be smarter
42                # than we can be
43                if len(defstmts) == 1:
44                    defstmt = defstmts[0]
45                    # check that if the node is accessed in the same method as
46                    # it's defined, it's accessed after the initial assignment
47                    frame = defstmt.frame(future=True)
48                    lno = defstmt.fromlineno
49                    for _node in nodes_lst:
50                        if (
51                            _node.frame(future=True) is frame
52                            and _node.fromlineno < lno
53                            and not astroid.are_exclusive(
54                                _node.statement(future=True), defstmt, excs
55                            )
56                        ):
57                            self.add_message(
58                                "access-member-before-definition",
59                                node=_node,
60                                args=(attr, lno),
61                            )
            

Path 8: 5 calls (0.0)

ClassDef (5)

defaultdict (5)

AttributeInferenceError (5)

1def _check_accessed_members(
2        self, node: nodes.ClassDef, accessed: dict[str, list[_AccessNodes]]
3    ) -> None:
4        """Check that accessed members are defined."""
5        excs = ("AttributeError", "Exception", "BaseException")
6        for attr, nodes_lst in accessed.items():
7            try:
8                # is it a class attribute ?
9                node.local_attr(attr)
10                # yes, stop here
11                continue
12            except astroid.NotFoundError:
13                pass
14            # is it an instance attribute of a parent class ?
15            try:
16                next(node.instance_attr_ancestors(attr))
17                # yes, stop here
18                continue
19            except StopIteration:
20                pass
21            # is it an instance attribute ?
22            try:
23                defstmts = node.instance_attr(attr)
24            except astroid.NotFoundError:
25                pass
26            else:
27                # filter out augment assignment nodes
28                defstmts = [stmt for stmt in defstmts if stmt not in nodes_lst]
29                if not defstmts:
30                    # only augment assignment for this node, no-member should be
31                    # triggered by the typecheck checker
32                    continue
33                # filter defstmts to only pick the first one when there are
34                # several assignments in the same scope
35                scope = defstmts[0].scope()
36                defstmts = [
37                    stmt
38                    for i, stmt in enumerate(defstmts)
39                    if i == 0 or stmt.scope() is not scope
40                ]
41                # if there are still more than one, don't attempt to be smarter
42                # than we can be
43                if len(defstmts) == 1:
44                    defstmt = defstmts[0]
45                    # check that if the node is accessed in the same method as
46                    # it's defined, it's accessed after the initial assignment
47                    frame = defstmt.frame(future=True)
48                    lno = defstmt.fromlineno
49                    for _node in nodes_lst:
50                        if (
51                            _node.frame(future=True) is frame
52                            and _node.fromlineno < lno
53                            and not astroid.are_exclusive(
54                                _node.statement(future=True), defstmt, excs
55                            )
56                        ):
57                            self.add_message(
58                                "access-member-before-definition",
59                                node=_node,
60                                args=(attr, lno),
61                            )
            

Path 9: 3 calls (0.0)

ClassDef (3)

defaultdict (3)

StopIteration (3)

1def _check_accessed_members(
2        self, node: nodes.ClassDef, accessed: dict[str, list[_AccessNodes]]
3    ) -> None:
4        """Check that accessed members are defined."""
5        excs = ("AttributeError", "Exception", "BaseException")
6        for attr, nodes_lst in accessed.items():
7            try:
8                # is it a class attribute ?
9                node.local_attr(attr)
10                # yes, stop here
11                continue
12            except astroid.NotFoundError:
13                pass
14            # is it an instance attribute of a parent class ?
15            try:
16                next(node.instance_attr_ancestors(attr))
17                # yes, stop here
18                continue
19            except StopIteration:
20                pass
21            # is it an instance attribute ?
22            try:
23                defstmts = node.instance_attr(attr)
24            except astroid.NotFoundError:
25                pass
26            else:
27                # filter out augment assignment nodes
28                defstmts = [stmt for stmt in defstmts if stmt not in nodes_lst]
29                if not defstmts:
30                    # only augment assignment for this node, no-member should be
31                    # triggered by the typecheck checker
32                    continue
33                # filter defstmts to only pick the first one when there are
34                # several assignments in the same scope
35                scope = defstmts[0].scope()
36                defstmts = [
37                    stmt
38                    for i, stmt in enumerate(defstmts)
39                    if i == 0 or stmt.scope() is not scope
40                ]
41                # if there are still more than one, don't attempt to be smarter
42                # than we can be
43                if len(defstmts) == 1:
44                    defstmt = defstmts[0]
45                    # check that if the node is accessed in the same method as
46                    # it's defined, it's accessed after the initial assignment
47                    frame = defstmt.frame(future=True)
48                    lno = defstmt.fromlineno
49                    for _node in nodes_lst:
50                        if (
51                            _node.frame(future=True) is frame
52                            and _node.fromlineno < lno
53                            and not astroid.are_exclusive(
54                                _node.statement(future=True), defstmt, excs
55                            )
56                        ):
57                            self.add_message(
58                                "access-member-before-definition",
59                                node=_node,
60                                args=(attr, lno),
61                            )
            

Path 10: 2 calls (0.0)

ClassDef (2)

defaultdict (2)

StopIteration (2)

1def _check_accessed_members(
2        self, node: nodes.ClassDef, accessed: dict[str, list[_AccessNodes]]
3    ) -> None:
4        """Check that accessed members are defined."""
5        excs = ("AttributeError", "Exception", "BaseException")
6        for attr, nodes_lst in accessed.items():
7            try:
8                # is it a class attribute ?
9                node.local_attr(attr)
10                # yes, stop here
11                continue
12            except astroid.NotFoundError:
13                pass
14            # is it an instance attribute of a parent class ?
15            try:
16                next(node.instance_attr_ancestors(attr))
17                # yes, stop here
18                continue
19            except StopIteration:
20                pass
21            # is it an instance attribute ?
22            try:
23                defstmts = node.instance_attr(attr)
24            except astroid.NotFoundError:
25                pass
26            else:
27                # filter out augment assignment nodes
28                defstmts = [stmt for stmt in defstmts if stmt not in nodes_lst]
29                if not defstmts:
30                    # only augment assignment for this node, no-member should be
31                    # triggered by the typecheck checker
32                    continue
33                # filter defstmts to only pick the first one when there are
34                # several assignments in the same scope
35                scope = defstmts[0].scope()
36                defstmts = [
37                    stmt
38                    for i, stmt in enumerate(defstmts)
39                    if i == 0 or stmt.scope() is not scope
40                ]
41                # if there are still more than one, don't attempt to be smarter
42                # than we can be
43                if len(defstmts) == 1:
44                    defstmt = defstmts[0]
45                    # check that if the node is accessed in the same method as
46                    # it's defined, it's accessed after the initial assignment
47                    frame = defstmt.frame(future=True)
48                    lno = defstmt.fromlineno
49                    for _node in nodes_lst:
50                        if (
51                            _node.frame(future=True) is frame
52                            and _node.fromlineno < lno
53                            and not astroid.are_exclusive(
54                                _node.statement(future=True), defstmt, excs
55                            )
56                        ):
57                            self.add_message(
58                                "access-member-before-definition",
59                                node=_node,
60                                args=(attr, lno),
61                            )
            

Path 11: 2 calls (0.0)

ClassDef (2)

defaultdict (2)

StopIteration (2)

1def _check_accessed_members(
2        self, node: nodes.ClassDef, accessed: dict[str, list[_AccessNodes]]
3    ) -> None:
4        """Check that accessed members are defined."""
5        excs = ("AttributeError", "Exception", "BaseException")
6        for attr, nodes_lst in accessed.items():
7            try:
8                # is it a class attribute ?
9                node.local_attr(attr)
10                # yes, stop here
11                continue
12            except astroid.NotFoundError:
13                pass
14            # is it an instance attribute of a parent class ?
15            try:
16                next(node.instance_attr_ancestors(attr))
17                # yes, stop here
18                continue
19            except StopIteration:
20                pass
21            # is it an instance attribute ?
22            try:
23                defstmts = node.instance_attr(attr)
24            except astroid.NotFoundError:
25                pass
26            else:
27                # filter out augment assignment nodes
28                defstmts = [stmt for stmt in defstmts if stmt not in nodes_lst]
29                if not defstmts:
30                    # only augment assignment for this node, no-member should be
31                    # triggered by the typecheck checker
32                    continue
33                # filter defstmts to only pick the first one when there are
34                # several assignments in the same scope
35                scope = defstmts[0].scope()
36                defstmts = [
37                    stmt
38                    for i, stmt in enumerate(defstmts)
39                    if i == 0 or stmt.scope() is not scope
40                ]
41                # if there are still more than one, don't attempt to be smarter
42                # than we can be
43                if len(defstmts) == 1:
44                    defstmt = defstmts[0]
45                    # check that if the node is accessed in the same method as
46                    # it's defined, it's accessed after the initial assignment
47                    frame = defstmt.frame(future=True)
48                    lno = defstmt.fromlineno
49                    for _node in nodes_lst:
50                        if (
51                            _node.frame(future=True) is frame
52                            and _node.fromlineno < lno
53                            and not astroid.are_exclusive(
54                                _node.statement(future=True), defstmt, excs
55                            )
56                        ):
57                            self.add_message(
58                                "access-member-before-definition",
59                                node=_node,
60                                args=(attr, lno),
61                            )
            

Path 12: 1 calls (0.0)

ClassDef (1)

defaultdict (1)

AttributeInferenceError (1)

1def _check_accessed_members(
2        self, node: nodes.ClassDef, accessed: dict[str, list[_AccessNodes]]
3    ) -> None:
4        """Check that accessed members are defined."""
5        excs = ("AttributeError", "Exception", "BaseException")
6        for attr, nodes_lst in accessed.items():
7            try:
8                # is it a class attribute ?
9                node.local_attr(attr)
10                # yes, stop here
11                continue
12            except astroid.NotFoundError:
13                pass
14            # is it an instance attribute of a parent class ?
15            try:
16                next(node.instance_attr_ancestors(attr))
17                # yes, stop here
18                continue
19            except StopIteration:
20                pass
21            # is it an instance attribute ?
22            try:
23                defstmts = node.instance_attr(attr)
24            except astroid.NotFoundError:
25                pass
26            else:
27                # filter out augment assignment nodes
28                defstmts = [stmt for stmt in defstmts if stmt not in nodes_lst]
29                if not defstmts:
30                    # only augment assignment for this node, no-member should be
31                    # triggered by the typecheck checker
32                    continue
33                # filter defstmts to only pick the first one when there are
34                # several assignments in the same scope
35                scope = defstmts[0].scope()
36                defstmts = [
37                    stmt
38                    for i, stmt in enumerate(defstmts)
39                    if i == 0 or stmt.scope() is not scope
40                ]
41                # if there are still more than one, don't attempt to be smarter
42                # than we can be
43                if len(defstmts) == 1:
44                    defstmt = defstmts[0]
45                    # check that if the node is accessed in the same method as
46                    # it's defined, it's accessed after the initial assignment
47                    frame = defstmt.frame(future=True)
48                    lno = defstmt.fromlineno
49                    for _node in nodes_lst:
50                        if (
51                            _node.frame(future=True) is frame
52                            and _node.fromlineno < lno
53                            and not astroid.are_exclusive(
54                                _node.statement(future=True), defstmt, excs
55                            )
56                        ):
57                            self.add_message(
58                                "access-member-before-definition",
59                                node=_node,
60                                args=(attr, lno),
61                            )
            

Path 13: 1 calls (0.0)

ClassDef (1)

defaultdict (1)

AttributeInferenceError (1)

1def _check_accessed_members(
2        self, node: nodes.ClassDef, accessed: dict[str, list[_AccessNodes]]
3    ) -> None:
4        """Check that accessed members are defined."""
5        excs = ("AttributeError", "Exception", "BaseException")
6        for attr, nodes_lst in accessed.items():
7            try:
8                # is it a class attribute ?
9                node.local_attr(attr)
10                # yes, stop here
11                continue
12            except astroid.NotFoundError:
13                pass
14            # is it an instance attribute of a parent class ?
15            try:
16                next(node.instance_attr_ancestors(attr))
17                # yes, stop here
18                continue
19            except StopIteration:
20                pass
21            # is it an instance attribute ?
22            try:
23                defstmts = node.instance_attr(attr)
24            except astroid.NotFoundError:
25                pass
26            else:
27                # filter out augment assignment nodes
28                defstmts = [stmt for stmt in defstmts if stmt not in nodes_lst]
29                if not defstmts:
30                    # only augment assignment for this node, no-member should be
31                    # triggered by the typecheck checker
32                    continue
33                # filter defstmts to only pick the first one when there are
34                # several assignments in the same scope
35                scope = defstmts[0].scope()
36                defstmts = [
37                    stmt
38                    for i, stmt in enumerate(defstmts)
39                    if i == 0 or stmt.scope() is not scope
40                ]
41                # if there are still more than one, don't attempt to be smarter
42                # than we can be
43                if len(defstmts) == 1:
44                    defstmt = defstmts[0]
45                    # check that if the node is accessed in the same method as
46                    # it's defined, it's accessed after the initial assignment
47                    frame = defstmt.frame(future=True)
48                    lno = defstmt.fromlineno
49                    for _node in nodes_lst:
50                        if (
51                            _node.frame(future=True) is frame
52                            and _node.fromlineno < lno
53                            and not astroid.are_exclusive(
54                                _node.statement(future=True), defstmt, excs
55                            )
56                        ):
57                            self.add_message(
58                                "access-member-before-definition",
59                                node=_node,
60                                args=(attr, lno),
61                            )
            

Path 14: 1 calls (0.0)

ClassDef (1)

defaultdict (1)

AttributeInferenceError (1)

1def _check_accessed_members(
2        self, node: nodes.ClassDef, accessed: dict[str, list[_AccessNodes]]
3    ) -> None:
4        """Check that accessed members are defined."""
5        excs = ("AttributeError", "Exception", "BaseException")
6        for attr, nodes_lst in accessed.items():
7            try:
8                # is it a class attribute ?
9                node.local_attr(attr)
10                # yes, stop here
11                continue
12            except astroid.NotFoundError:
13                pass
14            # is it an instance attribute of a parent class ?
15            try:
16                next(node.instance_attr_ancestors(attr))
17                # yes, stop here
18                continue
19            except StopIteration:
20                pass
21            # is it an instance attribute ?
22            try:
23                defstmts = node.instance_attr(attr)
24            except astroid.NotFoundError:
25                pass
26            else:
27                # filter out augment assignment nodes
28                defstmts = [stmt for stmt in defstmts if stmt not in nodes_lst]
29                if not defstmts:
30                    # only augment assignment for this node, no-member should be
31                    # triggered by the typecheck checker
32                    continue
33                # filter defstmts to only pick the first one when there are
34                # several assignments in the same scope
35                scope = defstmts[0].scope()
36                defstmts = [
37                    stmt
38                    for i, stmt in enumerate(defstmts)
39                    if i == 0 or stmt.scope() is not scope
40                ]
41                # if there are still more than one, don't attempt to be smarter
42                # than we can be
43                if len(defstmts) == 1:
44                    defstmt = defstmts[0]
45                    # check that if the node is accessed in the same method as
46                    # it's defined, it's accessed after the initial assignment
47                    frame = defstmt.frame(future=True)
48                    lno = defstmt.fromlineno
49                    for _node in nodes_lst:
50                        if (
51                            _node.frame(future=True) is frame
52                            and _node.fromlineno < lno
53                            and not astroid.are_exclusive(
54                                _node.statement(future=True), defstmt, excs
55                            )
56                        ):
57                            self.add_message(
58                                "access-member-before-definition",
59                                node=_node,
60                                args=(attr, lno),
61                            )
            

Path 15: 1 calls (0.0)

ClassDef (1)

defaultdict (1)

AttributeInferenceError (1)

1def _check_accessed_members(
2        self, node: nodes.ClassDef, accessed: dict[str, list[_AccessNodes]]
3    ) -> None:
4        """Check that accessed members are defined."""
5        excs = ("AttributeError", "Exception", "BaseException")
6        for attr, nodes_lst in accessed.items():
7            try:
8                # is it a class attribute ?
9                node.local_attr(attr)
10                # yes, stop here
11                continue
12            except astroid.NotFoundError:
13                pass
14            # is it an instance attribute of a parent class ?
15            try:
16                next(node.instance_attr_ancestors(attr))
17                # yes, stop here
18                continue
19            except StopIteration:
20                pass
21            # is it an instance attribute ?
22            try:
23                defstmts = node.instance_attr(attr)
24            except astroid.NotFoundError:
25                pass
26            else:
27                # filter out augment assignment nodes
28                defstmts = [stmt for stmt in defstmts if stmt not in nodes_lst]
29                if not defstmts:
30                    # only augment assignment for this node, no-member should be
31                    # triggered by the typecheck checker
32                    continue
33                # filter defstmts to only pick the first one when there are
34                # several assignments in the same scope
35                scope = defstmts[0].scope()
36                defstmts = [
37                    stmt
38                    for i, stmt in enumerate(defstmts)
39                    if i == 0 or stmt.scope() is not scope
40                ]
41                # if there are still more than one, don't attempt to be smarter
42                # than we can be
43                if len(defstmts) == 1:
44                    defstmt = defstmts[0]
45                    # check that if the node is accessed in the same method as
46                    # it's defined, it's accessed after the initial assignment
47                    frame = defstmt.frame(future=True)
48                    lno = defstmt.fromlineno
49                    for _node in nodes_lst:
50                        if (
51                            _node.frame(future=True) is frame
52                            and _node.fromlineno < lno
53                            and not astroid.are_exclusive(
54                                _node.statement(future=True), defstmt, excs
55                            )
56                        ):
57                            self.add_message(
58                                "access-member-before-definition",
59                                node=_node,
60                                args=(attr, lno),
61                            )
            

Path 16: 1 calls (0.0)

ClassDef (1)

defaultdict (1)

AttributeInferenceError (1)

1def _check_accessed_members(
2        self, node: nodes.ClassDef, accessed: dict[str, list[_AccessNodes]]
3    ) -> None:
4        """Check that accessed members are defined."""
5        excs = ("AttributeError", "Exception", "BaseException")
6        for attr, nodes_lst in accessed.items():
7            try:
8                # is it a class attribute ?
9                node.local_attr(attr)
10                # yes, stop here
11                continue
12            except astroid.NotFoundError:
13                pass
14            # is it an instance attribute of a parent class ?
15            try:
16                next(node.instance_attr_ancestors(attr))
17                # yes, stop here
18                continue
19            except StopIteration:
20                pass
21            # is it an instance attribute ?
22            try:
23                defstmts = node.instance_attr(attr)
24            except astroid.NotFoundError:
25                pass
26            else:
27                # filter out augment assignment nodes
28                defstmts = [stmt for stmt in defstmts if stmt not in nodes_lst]
29                if not defstmts:
30                    # only augment assignment for this node, no-member should be
31                    # triggered by the typecheck checker
32                    continue
33                # filter defstmts to only pick the first one when there are
34                # several assignments in the same scope
35                scope = defstmts[0].scope()
36                defstmts = [
37                    stmt
38                    for i, stmt in enumerate(defstmts)
39                    if i == 0 or stmt.scope() is not scope
40                ]
41                # if there are still more than one, don't attempt to be smarter
42                # than we can be
43                if len(defstmts) == 1:
44                    defstmt = defstmts[0]
45                    # check that if the node is accessed in the same method as
46                    # it's defined, it's accessed after the initial assignment
47                    frame = defstmt.frame(future=True)
48                    lno = defstmt.fromlineno
49                    for _node in nodes_lst:
50                        if (
51                            _node.frame(future=True) is frame
52                            and _node.fromlineno < lno
53                            and not astroid.are_exclusive(
54                                _node.statement(future=True), defstmt, excs
55                            )
56                        ):
57                            self.add_message(
58                                "access-member-before-definition",
59                                node=_node,
60                                args=(attr, lno),
61                            )
            

Path 17: 1 calls (0.0)

ClassDef (1)

defaultdict (1)

AttributeInferenceError (1)

1def _check_accessed_members(
2        self, node: nodes.ClassDef, accessed: dict[str, list[_AccessNodes]]
3    ) -> None:
4        """Check that accessed members are defined."""
5        excs = ("AttributeError", "Exception", "BaseException")
6        for attr, nodes_lst in accessed.items():
7            try:
8                # is it a class attribute ?
9                node.local_attr(attr)
10                # yes, stop here
11                continue
12            except astroid.NotFoundError:
13                pass
14            # is it an instance attribute of a parent class ?
15            try:
16                next(node.instance_attr_ancestors(attr))
17                # yes, stop here
18                continue
19            except StopIteration:
20                pass
21            # is it an instance attribute ?
22            try:
23                defstmts = node.instance_attr(attr)
24            except astroid.NotFoundError:
25                pass
26            else:
27                # filter out augment assignment nodes
28                defstmts = [stmt for stmt in defstmts if stmt not in nodes_lst]
29                if not defstmts:
30                    # only augment assignment for this node, no-member should be
31                    # triggered by the typecheck checker
32                    continue
33                # filter defstmts to only pick the first one when there are
34                # several assignments in the same scope
35                scope = defstmts[0].scope()
36                defstmts = [
37                    stmt
38                    for i, stmt in enumerate(defstmts)
39                    if i == 0 or stmt.scope() is not scope
40                ]
41                # if there are still more than one, don't attempt to be smarter
42                # than we can be
43                if len(defstmts) == 1:
44                    defstmt = defstmts[0]
45                    # check that if the node is accessed in the same method as
46                    # it's defined, it's accessed after the initial assignment
47                    frame = defstmt.frame(future=True)
48                    lno = defstmt.fromlineno
49                    for _node in nodes_lst:
50                        if (
51                            _node.frame(future=True) is frame
52                            and _node.fromlineno < lno
53                            and not astroid.are_exclusive(
54                                _node.statement(future=True), defstmt, excs
55                            )
56                        ):
57                            self.add_message(
58                                "access-member-before-definition",
59                                node=_node,
60                                args=(attr, lno),
61                            )
            

Path 18: 1 calls (0.0)

ClassDef (1)

defaultdict (1)

AttributeInferenceError (1)

1def _check_accessed_members(
2        self, node: nodes.ClassDef, accessed: dict[str, list[_AccessNodes]]
3    ) -> None:
4        """Check that accessed members are defined."""
5        excs = ("AttributeError", "Exception", "BaseException")
6        for attr, nodes_lst in accessed.items():
7            try:
8                # is it a class attribute ?
9                node.local_attr(attr)
10                # yes, stop here
11                continue
12            except astroid.NotFoundError:
13                pass
14            # is it an instance attribute of a parent class ?
15            try:
16                next(node.instance_attr_ancestors(attr))
17                # yes, stop here
18                continue
19            except StopIteration:
20                pass
21            # is it an instance attribute ?
22            try:
23                defstmts = node.instance_attr(attr)
24            except astroid.NotFoundError:
25                pass
26            else:
27                # filter out augment assignment nodes
28                defstmts = [stmt for stmt in defstmts if stmt not in nodes_lst]
29                if not defstmts:
30                    # only augment assignment for this node, no-member should be
31                    # triggered by the typecheck checker
32                    continue
33                # filter defstmts to only pick the first one when there are
34                # several assignments in the same scope
35                scope = defstmts[0].scope()
36                defstmts = [
37                    stmt
38                    for i, stmt in enumerate(defstmts)
39                    if i == 0 or stmt.scope() is not scope
40                ]
41                # if there are still more than one, don't attempt to be smarter
42                # than we can be
43                if len(defstmts) == 1:
44                    defstmt = defstmts[0]
45                    # check that if the node is accessed in the same method as
46                    # it's defined, it's accessed after the initial assignment
47                    frame = defstmt.frame(future=True)
48                    lno = defstmt.fromlineno
49                    for _node in nodes_lst:
50                        if (
51                            _node.frame(future=True) is frame
52                            and _node.fromlineno < lno
53                            and not astroid.are_exclusive(
54                                _node.statement(future=True), defstmt, excs
55                            )
56                        ):
57                            self.add_message(
58                                "access-member-before-definition",
59                                node=_node,
60                                args=(attr, lno),
61                            )