-
Notifications
You must be signed in to change notification settings - Fork 44
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
Make import_message_from_namespaced_type operate on NamespacedType #74
Make import_message_from_namespaced_type operate on NamespacedType #74
Conversation
For backward compatibility it would be nice to keep the previous usage pattern working. We don't want to add a new function with a different name (the current name is just "right"). So how about the function checks if the passed |
I thought about this originally, the uncertainty I had was: "what would be the type of the argument in the signature?"
-def import_message_from_namespaced_type(message_type: NamespacedType) -> Any:
+def import_message_from_namespaced_type(
+ message_type: Union[NamespacedType, AbstractNestedType]) -> Any:
+ if isinstance(message_type, AbstractNestedType):
+ message_type = message_type.value_type
|
I would choose:
I would consider the special case to keep current usage working as deprecated. Maybe add a deprecation in the case where accessing |
Sounds good, done in 0002388 |
Please rebase against the latest state on the target branch in order to run CI. |
Signed-off-by: Mikael Arguedas <mikael.arguedas@gmail.com>
Signed-off-by: Mikael Arguedas <mikael.arguedas@gmail.com>
added a deprecation warning and updated the test Signed-off-by: Mikael Arguedas <mikael.arguedas@gmail.com>
0002388
to
32688d8
Compare
…os2/rosidl_python#74) * make import_message_from_namespaced_type operate on NamespacedTypes Signed-off-by: Mikael Arguedas <mikael.arguedas@gmail.com> * basic test for import_messages_from_namespaced_type Signed-off-by: Mikael Arguedas <mikael.arguedas@gmail.com> * restore support for types with attribute value_type added a deprecation warning and updated the test Signed-off-by: Mikael Arguedas <mikael.arguedas@gmail.com>
Fixes #70
Instead of changing the type specification, which would either require changing the function name (breaking API) or have the name and the behavior mismatch (current state), this modifies the function to operate on
NamespacedType
instead.This will change behavior for consumers of the function.
If this is not desired, the less disruptive alternative is to change the function specification without changing the function name or the behavior.
Added a simple test to cover the uses of the function used in this package.