Method: pylint.pyreverse.dot_printer.DotPrinter._build_label_for_node
Calls: 52, Exceptions: 0, Paths: 4Back
Path 1: 20 calls (0.38)
NodeProperties (20)
'{CustomException|
|}' (4) '{DoNothing|
|}' (4) '{DoNothing2|
|}' (4) '{PropertyPatterns|prop1
1def _build_label_for_node(self, properties: NodeProperties) -> str:
2 if not properties.label:
3 return ""
4
5 label: str = properties.label
6 if properties.attrs is None and properties.methods is None:
7 # return a "compact" form which only displays the class name in a box
8 return label
9
10 # Add class attributes
11 attrs: list[str] = properties.attrs or []
12 attrs_string = rf"{HTMLLabels.LINEBREAK_LEFT.value}".join(
13 attr.replace("|", r"\|") for attr in attrs
14 )
15 label = rf"{{{label}|{attrs_string}{HTMLLabels.LINEBREAK_LEFT.value}|"
16
17 # Add class methods
18 methods: list[nodes.FunctionDef] = properties.methods or []
19 for func in methods:
20 args = self._get_method_arguments(func)
21 method_name = (
22 f"<I>{func.name}</I>" if func.is_abstract() else f"{func.name}"
23 )
24 label += rf"{method_name}({', '.join(args)})"
25 if func.returns:
26 label += ": " + get_annotation_label(func.returns)
27 label += rf"{HTMLLabels.LINEBREAK_LEFT.value}"
28 label += "}"
29 return label
Path 2: 16 calls (0.31)
NodeProperties (16)
'data' (4) 'data.clientmodule_test' (4) 'data.property_pattern' (4) 'data.suppliermodule_test' (4)
1def _build_label_for_node(self, properties: NodeProperties) -> str:
2 if not properties.label:
3 return ""
4
5 label: str = properties.label
6 if properties.attrs is None and properties.methods is None:
7 # return a "compact" form which only displays the class name in a box
8 return label
9
10 # Add class attributes
11 attrs: list[str] = properties.attrs or []
12 attrs_string = rf"{HTMLLabels.LINEBREAK_LEFT.value}".join(
13 attr.replace("|", r"\|") for attr in attrs
14 )
15 label = rf"{{{label}|{attrs_string}{HTMLLabels.LINEBREAK_LEFT.value}|"
16
17 # Add class methods
18 methods: list[nodes.FunctionDef] = properties.methods or []
19 for func in methods:
20 args = self._get_method_arguments(func)
21 method_name = (
22 f"<I>{func.name}</I>" if func.is_abstract() else f"{func.name}"
23 )
24 label += rf"{method_name}({', '.join(args)})"
25 if func.returns:
26 label += ": " + get_annotation_label(func.returns)
27 label += rf"{HTMLLabels.LINEBREAK_LEFT.value}"
28 label += "}"
29 return label
Path 3: 8 calls (0.15)
NodeProperties (8)
'{Ancestor|attr : str
cls_member
|get_value()
set_value(value)
}' (4) '{Interface|...
1def _build_label_for_node(self, properties: NodeProperties) -> str:
2 if not properties.label:
3 return ""
4
5 label: str = properties.label
6 if properties.attrs is None and properties.methods is None:
7 # return a "compact" form which only displays the class name in a box
8 return label
9
10 # Add class attributes
11 attrs: list[str] = properties.attrs or []
12 attrs_string = rf"{HTMLLabels.LINEBREAK_LEFT.value}".join(
13 attr.replace("|", r"\|") for attr in attrs
14 )
15 label = rf"{{{label}|{attrs_string}{HTMLLabels.LINEBREAK_LEFT.value}|"
16
17 # Add class methods
18 methods: list[nodes.FunctionDef] = properties.methods or []
19 for func in methods:
20 args = self._get_method_arguments(func)
21 method_name = (
22 f"<I>{func.name}</I>" if func.is_abstract() else f"{func.name}"
23 )
24 label += rf"{method_name}({', '.join(args)})"
25 if func.returns:
26 label += ": " + get_annotation_label(func.returns)
27 label += rf"{HTMLLabels.LINEBREAK_LEFT.value}"
28 label += "}"
29 return label
Path 4: 8 calls (0.15)
NodeProperties (8)
'{DoSomething|my_int : Optional[int]
my_int_2 : Optional[int]
my_string : str
|do_it(new_int: int):...
1def _build_label_for_node(self, properties: NodeProperties) -> str:
2 if not properties.label:
3 return ""
4
5 label: str = properties.label
6 if properties.attrs is None and properties.methods is None:
7 # return a "compact" form which only displays the class name in a box
8 return label
9
10 # Add class attributes
11 attrs: list[str] = properties.attrs or []
12 attrs_string = rf"{HTMLLabels.LINEBREAK_LEFT.value}".join(
13 attr.replace("|", r"\|") for attr in attrs
14 )
15 label = rf"{{{label}|{attrs_string}{HTMLLabels.LINEBREAK_LEFT.value}|"
16
17 # Add class methods
18 methods: list[nodes.FunctionDef] = properties.methods or []
19 for func in methods:
20 args = self._get_method_arguments(func)
21 method_name = (
22 f"<I>{func.name}</I>" if func.is_abstract() else f"{func.name}"
23 )
24 label += rf"{method_name}({', '.join(args)})"
25 if func.returns:
26 label += ": " + get_annotation_label(func.returns)
27 label += rf"{HTMLLabels.LINEBREAK_LEFT.value}"
28 label += "}"
29 return label