-
Notifications
You must be signed in to change notification settings - Fork 158
Expose StringJoinSubstitution to frontend #857
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
base: rolling
Are you sure you want to change the base?
Conversation
Signed-off-by: Christian Ruf <[email protected]>
Signed-off-by: Christian Ruf <[email protected]>
Signed-off-by: Christian Ruf <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Other than some minor comments, this looks good.
Would you mind adding tests for frontends, i.e., YAML and XML? See the tests I added to launch_xml
and launch_yaml
in #802. Also, it would be good to add XML and YAML examples to the Python class docstring.
Co-authored-by: Christophe Bedard <[email protected]> Signed-off-by: Christian Ruf <[email protected]>
Signed-off-by: Christian Ruf <[email protected]>
Signed-off-by: Christian Ruf <[email protected]>
Signed-off-by: Christian Ruf <[email protected]>
bc7bb1e
to
669c430
Compare
Signed-off-by: Christian Ruf <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for adding the tests!
Other than some minor suggestions, this looks great!
assert isinstance(ld.describe_sub_entities()[0], DeclareLaunchArgument) | ||
assert isinstance(ld.describe_sub_entities()[1], SetLaunchConfiguration) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a thought, but given that we have a LaunchDescription
here, I think it would be more appropriate to call ld.entities[n]
. Same below and for the other tests.
return self.__delimiter | ||
|
||
@classmethod | ||
def parse(cls, data: Sequence[SomeSubstitutionsType]): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Type annotation in launch
has progressed a lot lately. Could you rebase on rolling
and annotate the return type? I think this should do it:
def parse(cls, data: Sequence[SomeSubstitutionsType]): | |
def parse( | |
cls, data: Sequence[SomeSubstitutionsType], | |
) -> Tuple[Type['StringJoinSubstitution'], Dict[str, Any]]: |
kwargs: Dict[str, SomeSubstitutionsType | Iterable[SomeSubstitutionsType]] = {} | ||
kwargs['delimiter'] = data[0] | ||
kwargs['substitutions'] = data[1:] | ||
return cls, kwargs |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After the change to the return type annotation, can you try to remove the type annotation for kwargs
here and see if mypy
is fine with it? Otherwise, you can try to just directly return a dict:
kwargs: Dict[str, SomeSubstitutionsType | Iterable[SomeSubstitutionsType]] = {} | |
kwargs['delimiter'] = data[0] | |
kwargs['substitutions'] = data[1:] | |
return cls, kwargs | |
return cls, {'delimiter': data[0], 'substitutions': data[1:]} |
Co-authored-by: Christophe Bedard <[email protected]> Signed-off-by: Christian Ruf <[email protected]>
This PR exposes StringJoinSubstitution from #843 to the frontend, as suggested by @christophebedard in #843.
Usage
(i.e. with
delimiter=.
andstring components=[https://$(var subdomain), ros, org]
):results in terminal output