Method: pylint.pyreverse.inspector.Linker.visit_classdef
Calls: 486, Exceptions: 0, Paths: 10Back
Path 1: 451 calls (0.93)
ClassDef (451)
None (451)
1def visit_classdef(self, node: nodes.ClassDef) -> None:
2 """Visit an astroid.Class node.
3
4 * set the locals_type and instance_attrs_type mappings
5 * set the implements list and build it
6 * optionally tag the node with a unique id
7 """
8 if hasattr(node, "locals_type"):
9 return
10 node.locals_type = collections.defaultdict(list)
11 if self.tag:
12 node.uid = self.generate_id()
13 # resolve ancestors
14 for baseobj in node.ancestors(recurs=False):
15 specializations = getattr(baseobj, "specializations", [])
16 specializations.append(node)
17 baseobj.specializations = specializations
18 # resolve instance attributes
19 node.instance_attrs_type = collections.defaultdict(list)
20 node.aggregations_type = collections.defaultdict(list)
21 node.associations_type = collections.defaultdict(list)
22 for assignattrs in tuple(node.instance_attrs.values()):
23 for assignattr in assignattrs:
24 if not isinstance(assignattr, nodes.Unknown):
25 self.associations_handler.handle(assignattr, node)
26 self.handle_assignattr_type(assignattr, node)
27 # resolve implemented interface
28 try:
29 ifaces = interfaces(node)
30 if ifaces is not None:
31 node.implements = list(ifaces)
32 if node.implements:
33 # TODO: 3.0: Remove support for __implements__
34 warnings.warn(
35 "pyreverse will drop support for resolving and displaying "
36 "implemented interfaces in pylint 3.0. The implementation "
37 "relies on the '__implements__' attribute proposed in PEP 245"
38 ", which was rejected in 2006.",
39 DeprecationWarning,
40 )
41 else:
42 node.implements = []
43 except astroid.InferenceError:
44 node.implements = []
Path 2: 9 calls (0.02)
ClassDef (9)
1def visit_classdef(self, node: nodes.ClassDef) -> None:
2 """Visit an astroid.Class node.
3
4 * set the locals_type and instance_attrs_type mappings
5 * set the implements list and build it
6 * optionally tag the node with a unique id
7 """
8 if hasattr(node, "locals_type"):
9 return
10 node.locals_type = collections.defaultdict(list)
11 if self.tag:
12 node.uid = self.generate_id()
13 # resolve ancestors
14 for baseobj in node.ancestors(recurs=False):
15 specializations = getattr(baseobj, "specializations", [])
16 specializations.append(node)
17 baseobj.specializations = specializations
18 # resolve instance attributes
19 node.instance_attrs_type = collections.defaultdict(list)
20 node.aggregations_type = collections.defaultdict(list)
21 node.associations_type = collections.defaultdict(list)
22 for assignattrs in tuple(node.instance_attrs.values()):
23 for assignattr in assignattrs:
24 if not isinstance(assignattr, nodes.Unknown):
25 self.associations_handler.handle(assignattr, node)
26 self.handle_assignattr_type(assignattr, node)
27 # resolve implemented interface
28 try:
29 ifaces = interfaces(node)
30 if ifaces is not None:
31 node.implements = list(ifaces)
32 if node.implements:
33 # TODO: 3.0: Remove support for __implements__
34 warnings.warn(
35 "pyreverse will drop support for resolving and displaying "
36 "implemented interfaces in pylint 3.0. The implementation "
37 "relies on the '__implements__' attribute proposed in PEP 245"
38 ", which was rejected in 2006.",
39 DeprecationWarning,
40 )
41 else:
42 node.implements = []
43 except astroid.InferenceError:
44 node.implements = []
Path 3: 9 calls (0.02)
ClassDef (9)
1def visit_classdef(self, node: nodes.ClassDef) -> None:
2 """Visit an astroid.Class node.
3
4 * set the locals_type and instance_attrs_type mappings
5 * set the implements list and build it
6 * optionally tag the node with a unique id
7 """
8 if hasattr(node, "locals_type"):
9 return
10 node.locals_type = collections.defaultdict(list)
11 if self.tag:
12 node.uid = self.generate_id()
13 # resolve ancestors
14 for baseobj in node.ancestors(recurs=False):
15 specializations = getattr(baseobj, "specializations", [])
16 specializations.append(node)
17 baseobj.specializations = specializations
18 # resolve instance attributes
19 node.instance_attrs_type = collections.defaultdict(list)
20 node.aggregations_type = collections.defaultdict(list)
21 node.associations_type = collections.defaultdict(list)
22 for assignattrs in tuple(node.instance_attrs.values()):
23 for assignattr in assignattrs:
24 if not isinstance(assignattr, nodes.Unknown):
25 self.associations_handler.handle(assignattr, node)
26 self.handle_assignattr_type(assignattr, node)
27 # resolve implemented interface
28 try:
29 ifaces = interfaces(node)
30 if ifaces is not None:
31 node.implements = list(ifaces)
32 if node.implements:
33 # TODO: 3.0: Remove support for __implements__
34 warnings.warn(
35 "pyreverse will drop support for resolving and displaying "
36 "implemented interfaces in pylint 3.0. The implementation "
37 "relies on the '__implements__' attribute proposed in PEP 245"
38 ", which was rejected in 2006.",
39 DeprecationWarning,
40 )
41 else:
42 node.implements = []
43 except astroid.InferenceError:
44 node.implements = []
Path 4: 8 calls (0.02)
ClassDef (8)
1def visit_classdef(self, node: nodes.ClassDef) -> None:
2 """Visit an astroid.Class node.
3
4 * set the locals_type and instance_attrs_type mappings
5 * set the implements list and build it
6 * optionally tag the node with a unique id
7 """
8 if hasattr(node, "locals_type"):
9 return
10 node.locals_type = collections.defaultdict(list)
11 if self.tag:
12 node.uid = self.generate_id()
13 # resolve ancestors
14 for baseobj in node.ancestors(recurs=False):
15 specializations = getattr(baseobj, "specializations", [])
16 specializations.append(node)
17 baseobj.specializations = specializations
18 # resolve instance attributes
19 node.instance_attrs_type = collections.defaultdict(list)
20 node.aggregations_type = collections.defaultdict(list)
21 node.associations_type = collections.defaultdict(list)
22 for assignattrs in tuple(node.instance_attrs.values()):
23 for assignattr in assignattrs:
24 if not isinstance(assignattr, nodes.Unknown):
25 self.associations_handler.handle(assignattr, node)
26 self.handle_assignattr_type(assignattr, node)
27 # resolve implemented interface
28 try:
29 ifaces = interfaces(node)
30 if ifaces is not None:
31 node.implements = list(ifaces)
32 if node.implements:
33 # TODO: 3.0: Remove support for __implements__
34 warnings.warn(
35 "pyreverse will drop support for resolving and displaying "
36 "implemented interfaces in pylint 3.0. The implementation "
37 "relies on the '__implements__' attribute proposed in PEP 245"
38 ", which was rejected in 2006.",
39 DeprecationWarning,
40 )
41 else:
42 node.implements = []
43 except astroid.InferenceError:
44 node.implements = []
Path 5: 4 calls (0.01)
ClassDef (4)
1def visit_classdef(self, node: nodes.ClassDef) -> None:
2 """Visit an astroid.Class node.
3
4 * set the locals_type and instance_attrs_type mappings
5 * set the implements list and build it
6 * optionally tag the node with a unique id
7 """
8 if hasattr(node, "locals_type"):
9 return
10 node.locals_type = collections.defaultdict(list)
11 if self.tag:
12 node.uid = self.generate_id()
13 # resolve ancestors
14 for baseobj in node.ancestors(recurs=False):
15 specializations = getattr(baseobj, "specializations", [])
16 specializations.append(node)
17 baseobj.specializations = specializations
18 # resolve instance attributes
19 node.instance_attrs_type = collections.defaultdict(list)
20 node.aggregations_type = collections.defaultdict(list)
21 node.associations_type = collections.defaultdict(list)
22 for assignattrs in tuple(node.instance_attrs.values()):
23 for assignattr in assignattrs:
24 if not isinstance(assignattr, nodes.Unknown):
25 self.associations_handler.handle(assignattr, node)
26 self.handle_assignattr_type(assignattr, node)
27 # resolve implemented interface
28 try:
29 ifaces = interfaces(node)
30 if ifaces is not None:
31 node.implements = list(ifaces)
32 if node.implements:
33 # TODO: 3.0: Remove support for __implements__
34 warnings.warn(
35 "pyreverse will drop support for resolving and displaying "
36 "implemented interfaces in pylint 3.0. The implementation "
37 "relies on the '__implements__' attribute proposed in PEP 245"
38 ", which was rejected in 2006.",
39 DeprecationWarning,
40 )
41 else:
42 node.implements = []
43 except astroid.InferenceError:
44 node.implements = []
Path 6: 1 calls (0.0)
ClassDef (1)
1def visit_classdef(self, node: nodes.ClassDef) -> None:
2 """Visit an astroid.Class node.
3
4 * set the locals_type and instance_attrs_type mappings
5 * set the implements list and build it
6 * optionally tag the node with a unique id
7 """
8 if hasattr(node, "locals_type"):
9 return
10 node.locals_type = collections.defaultdict(list)
11 if self.tag:
12 node.uid = self.generate_id()
13 # resolve ancestors
14 for baseobj in node.ancestors(recurs=False):
15 specializations = getattr(baseobj, "specializations", [])
16 specializations.append(node)
17 baseobj.specializations = specializations
18 # resolve instance attributes
19 node.instance_attrs_type = collections.defaultdict(list)
20 node.aggregations_type = collections.defaultdict(list)
21 node.associations_type = collections.defaultdict(list)
22 for assignattrs in tuple(node.instance_attrs.values()):
23 for assignattr in assignattrs:
24 if not isinstance(assignattr, nodes.Unknown):
25 self.associations_handler.handle(assignattr, node)
26 self.handle_assignattr_type(assignattr, node)
27 # resolve implemented interface
28 try:
29 ifaces = interfaces(node)
30 if ifaces is not None:
31 node.implements = list(ifaces)
32 if node.implements:
33 # TODO: 3.0: Remove support for __implements__
34 warnings.warn(
35 "pyreverse will drop support for resolving and displaying "
36 "implemented interfaces in pylint 3.0. The implementation "
37 "relies on the '__implements__' attribute proposed in PEP 245"
38 ", which was rejected in 2006.",
39 DeprecationWarning,
40 )
41 else:
42 node.implements = []
43 except astroid.InferenceError:
44 node.implements = []
Path 7: 1 calls (0.0)
ClassDef (1)
1def visit_classdef(self, node: nodes.ClassDef) -> None:
2 """Visit an astroid.Class node.
3
4 * set the locals_type and instance_attrs_type mappings
5 * set the implements list and build it
6 * optionally tag the node with a unique id
7 """
8 if hasattr(node, "locals_type"):
9 return
10 node.locals_type = collections.defaultdict(list)
11 if self.tag:
12 node.uid = self.generate_id()
13 # resolve ancestors
14 for baseobj in node.ancestors(recurs=False):
15 specializations = getattr(baseobj, "specializations", [])
16 specializations.append(node)
17 baseobj.specializations = specializations
18 # resolve instance attributes
19 node.instance_attrs_type = collections.defaultdict(list)
20 node.aggregations_type = collections.defaultdict(list)
21 node.associations_type = collections.defaultdict(list)
22 for assignattrs in tuple(node.instance_attrs.values()):
23 for assignattr in assignattrs:
24 if not isinstance(assignattr, nodes.Unknown):
25 self.associations_handler.handle(assignattr, node)
26 self.handle_assignattr_type(assignattr, node)
27 # resolve implemented interface
28 try:
29 ifaces = interfaces(node)
30 if ifaces is not None:
31 node.implements = list(ifaces)
32 if node.implements:
33 # TODO: 3.0: Remove support for __implements__
34 warnings.warn(
35 "pyreverse will drop support for resolving and displaying "
36 "implemented interfaces in pylint 3.0. The implementation "
37 "relies on the '__implements__' attribute proposed in PEP 245"
38 ", which was rejected in 2006.",
39 DeprecationWarning,
40 )
41 else:
42 node.implements = []
43 except astroid.InferenceError:
44 node.implements = []
Path 8: 1 calls (0.0)
ClassDef (1)
1def visit_classdef(self, node: nodes.ClassDef) -> None:
2 """Visit an astroid.Class node.
3
4 * set the locals_type and instance_attrs_type mappings
5 * set the implements list and build it
6 * optionally tag the node with a unique id
7 """
8 if hasattr(node, "locals_type"):
9 return
10 node.locals_type = collections.defaultdict(list)
11 if self.tag:
12 node.uid = self.generate_id()
13 # resolve ancestors
14 for baseobj in node.ancestors(recurs=False):
15 specializations = getattr(baseobj, "specializations", [])
16 specializations.append(node)
17 baseobj.specializations = specializations
18 # resolve instance attributes
19 node.instance_attrs_type = collections.defaultdict(list)
20 node.aggregations_type = collections.defaultdict(list)
21 node.associations_type = collections.defaultdict(list)
22 for assignattrs in tuple(node.instance_attrs.values()):
23 for assignattr in assignattrs:
24 if not isinstance(assignattr, nodes.Unknown):
25 self.associations_handler.handle(assignattr, node)
26 self.handle_assignattr_type(assignattr, node)
27 # resolve implemented interface
28 try:
29 ifaces = interfaces(node)
30 if ifaces is not None:
31 node.implements = list(ifaces)
32 if node.implements:
33 # TODO: 3.0: Remove support for __implements__
34 warnings.warn(
35 "pyreverse will drop support for resolving and displaying "
36 "implemented interfaces in pylint 3.0. The implementation "
37 "relies on the '__implements__' attribute proposed in PEP 245"
38 ", which was rejected in 2006.",
39 DeprecationWarning,
40 )
41 else:
42 node.implements = []
43 except astroid.InferenceError:
44 node.implements = []
Path 9: 1 calls (0.0)
ClassDef (1)
1def visit_classdef(self, node: nodes.ClassDef) -> None:
2 """Visit an astroid.Class node.
3
4 * set the locals_type and instance_attrs_type mappings
5 * set the implements list and build it
6 * optionally tag the node with a unique id
7 """
8 if hasattr(node, "locals_type"):
9 return
10 node.locals_type = collections.defaultdict(list)
11 if self.tag:
12 node.uid = self.generate_id()
13 # resolve ancestors
14 for baseobj in node.ancestors(recurs=False):
15 specializations = getattr(baseobj, "specializations", [])
16 specializations.append(node)
17 baseobj.specializations = specializations
18 # resolve instance attributes
19 node.instance_attrs_type = collections.defaultdict(list)
20 node.aggregations_type = collections.defaultdict(list)
21 node.associations_type = collections.defaultdict(list)
22 for assignattrs in tuple(node.instance_attrs.values()):
23 for assignattr in assignattrs:
24 if not isinstance(assignattr, nodes.Unknown):
25 self.associations_handler.handle(assignattr, node)
26 self.handle_assignattr_type(assignattr, node)
27 # resolve implemented interface
28 try:
29 ifaces = interfaces(node)
30 if ifaces is not None:
31 node.implements = list(ifaces)
32 if node.implements:
33 # TODO: 3.0: Remove support for __implements__
34 warnings.warn(
35 "pyreverse will drop support for resolving and displaying "
36 "implemented interfaces in pylint 3.0. The implementation "
37 "relies on the '__implements__' attribute proposed in PEP 245"
38 ", which was rejected in 2006.",
39 DeprecationWarning,
40 )
41 else:
42 node.implements = []
43 except astroid.InferenceError:
44 node.implements = []
Path 10: 1 calls (0.0)
ClassDef (1)
1def visit_classdef(self, node: nodes.ClassDef) -> None:
2 """Visit an astroid.Class node.
3
4 * set the locals_type and instance_attrs_type mappings
5 * set the implements list and build it
6 * optionally tag the node with a unique id
7 """
8 if hasattr(node, "locals_type"):
9 return
10 node.locals_type = collections.defaultdict(list)
11 if self.tag:
12 node.uid = self.generate_id()
13 # resolve ancestors
14 for baseobj in node.ancestors(recurs=False):
15 specializations = getattr(baseobj, "specializations", [])
16 specializations.append(node)
17 baseobj.specializations = specializations
18 # resolve instance attributes
19 node.instance_attrs_type = collections.defaultdict(list)
20 node.aggregations_type = collections.defaultdict(list)
21 node.associations_type = collections.defaultdict(list)
22 for assignattrs in tuple(node.instance_attrs.values()):
23 for assignattr in assignattrs:
24 if not isinstance(assignattr, nodes.Unknown):
25 self.associations_handler.handle(assignattr, node)
26 self.handle_assignattr_type(assignattr, node)
27 # resolve implemented interface
28 try:
29 ifaces = interfaces(node)
30 if ifaces is not None:
31 node.implements = list(ifaces)
32 if node.implements:
33 # TODO: 3.0: Remove support for __implements__
34 warnings.warn(
35 "pyreverse will drop support for resolving and displaying "
36 "implemented interfaces in pylint 3.0. The implementation "
37 "relies on the '__implements__' attribute proposed in PEP 245"
38 ", which was rejected in 2006.",
39 DeprecationWarning,
40 )
41 else:
42 node.implements = []
43 except astroid.InferenceError:
44 node.implements = []