Skip to content

Commit

Permalink
ci(class-tree): Please Pylint
Browse files Browse the repository at this point in the history
  • Loading branch information
ewuerger committed Oct 31, 2023
1 parent 4702458 commit 0e6c7cc
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 14 deletions.
1 change: 0 additions & 1 deletion capellambse_context_diagrams/collectors/makers.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
from __future__ import annotations

import collections.abc as cabc
import typing as t

import typing_extensions as te
from capellambse import helpers
Expand Down
28 changes: 15 additions & 13 deletions capellambse_context_diagrams/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ class type that stores all previously named classes.
size = (child["size"]["width"], child["size"]["height"]) # type: ignore
features = []
if styleclass in decorations.needs_feature_line:
features = self._handle_features(child) # type: ignore[arg-type]
features = handle_features(child) # type: ignore[arg-type]

element = diagram.Box(
ref,
Expand Down Expand Up @@ -203,18 +203,6 @@ class type that stores all previously named classes.
for i in child.get("children", []): # type: ignore
self.deserialize_child(i, ref, element)

def _handle_features(self, child: _elkjs.ELKOutputNode) -> list[str]:
features: list[str] = []
if len(child["children"]) <= 1:
return features

for c in child["children"][1:]:
if not c["type"] == "label":
continue
features.append(c["text"])
child["children"] = child["children"][:1]
return features

def _is_hierarchical(self, uuid: str) -> bool:
def is_contained(obj: diagram.Box) -> bool:
if obj.port and obj.parent and obj.parent.parent:
Expand Down Expand Up @@ -274,3 +262,17 @@ def order_children(self) -> None:
new_diagram.add_element(element)

self.diagram = new_diagram


def handle_features(child: _elkjs.ELKOutputNode) -> list[str]:
"""Return all consecutive labels (without first) from the ``child``."""
features: list[str] = []
if len(child["children"]) <= 1:
return features

for c in child["children"][1:]:
if not c["type"] == "label":
continue
features.append(c["text"])
child["children"] = child["children"][:1]
return features

0 comments on commit 0e6c7cc

Please sign in to comment.