Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert node to list so that they are processed in order. #507

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/roswire/common/launch/config/launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@

@attr.s(frozen=True, slots=True)
class LaunchConfig:
nodes: Sequence[NodeConfig] = attr.ib(default=())
nodes: Tuple[NodeConfig, ...] = attr.ib(default=())
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why this change? (tuples are sequences)

Copy link
Collaborator Author

@schmerl schmerl Oct 30, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I make it a Sequence, mypy doesn't like the '+' operation.

src/roswire/common/launch/config/launch.py:140: error: Unsupported left operand type for + ("Sequence[NodeConfig]")

Is there a way around this?

executables: Sequence[str] = attr.ib(default=())
roslaunch_files: Sequence[str] = attr.ib(default=())
params: Mapping[str, Any] = attr.ib(factory=dict)
Expand Down Expand Up @@ -138,7 +138,7 @@ def with_node(self, node: NodeConfig) -> "LaunchConfig":
m = m.format(node.full_name)
raise FailedToParseLaunchFile(m)
nodes = self.nodes + (node,)
return attr.evolve(self, nodes=nodes)
return attr.evolve(self, nodes=tuple(nodes))

def to_xml_tree(self) -> ET.ElementTree:
root = ET.Element("launch")
Expand Down