Skip to content

Commit

Permalink
Some command names need to written always
Browse files Browse the repository at this point in the history
  • Loading branch information
edenhaus committed Dec 24, 2023
1 parent cf5a843 commit 1e9e5ae
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion deebot_client/map.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,11 @@ def _attributes_as_str(self) -> str: # type: ignore[no-untyped-def] # noqa: ANN

svg.PathData.attributes_as_str = _attributes_as_str # type: ignore[attr-defined]

_ALWAYS_WRITE_COMMAND_NAME: tuple[str, ...] = (
svg.MoveTo.command,
svg.MoveToRel.command,
)


@dataclasses.dataclass
class Path(svg.Path): # noqa: TID251
Expand All @@ -70,7 +75,10 @@ def _as_str(cls, val: Any) -> str:
if hasattr(elem, "attributes_as_str"):
attributes = elem.attributes_as_str()

Check warning on line 76 in deebot_client/map.py

View check run for this annotation

Codecov / codecov/patch

deebot_client/map.py#L76

Added line #L76 was not covered by tests
# if the command is the same as the previous one, we can omit it
if current != elem.command:
if (
current != elem.command
or elem.command in _ALWAYS_WRITE_COMMAND_NAME
):
current = elem.command
result += elem.command

Check warning on line 83 in deebot_client/map.py

View check run for this annotation

Codecov / codecov/patch

deebot_client/map.py#L82-L83

Added lines #L82 - L83 were not covered by tests
elif attributes[0] != "-":
Expand Down

0 comments on commit 1e9e5ae

Please sign in to comment.