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

Add back Type hash __slots__ and add test cases. #1245

Merged
merged 7 commits into from
Mar 12, 2024

Conversation

InvincibleRMC
Copy link
Contributor

Following the regression caused by #1232 this adds back the __slots__ Also adds a test case to ensure this gets caught by CI in the future. Should probably wait until the revert in #1243 is completed.

Signed-off-by: Michael Carlstrom <rmc@carlstrom.com>
Signed-off-by: Michael Carlstrom <rmc@carlstrom.com>
Signed-off-by: Michael Carlstrom <rmc@carlstrom.com>
Copy link
Collaborator

@fujitatomoya fujitatomoya left a comment

Choose a reason for hiding this comment

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

@InvincibleRMC as you mentioned, we need to wait for #1243 to be merged, and the we can do the rework on typing except removing __slots__.

rclpy/rclpy/type_hash.py Outdated Show resolved Hide resolved
Copy link
Contributor

@clalancette clalancette left a comment

Choose a reason for hiding this comment

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

This looks reasonable to me. I'll run full CI on it to see what happens.

@clalancette
Copy link
Contributor

This looks reasonable to me. I'll run full CI on it to see what happens.

Oh wait, never mind. It needs to be rebased. Once that is done, I'll run CI on it.

Signed-off-by: Michael Carlstrom <rmc@carlstrom.com>
Signed-off-by: Michael Carlstrom <rmc@carlstrom.com>
@clalancette
Copy link
Contributor

CI:

  • Linux Build Status
  • Linux-aarch64 Build Status
  • Windows Build Status

@clalancette clalancette merged commit 9c3f398 into ros2:rolling Mar 12, 2024
2 of 3 checks passed
@InvincibleRMC InvincibleRMC deleted the type-hash branch March 14, 2024 23:45
InvincibleRMC added a commit to InvincibleRMC/rclpy that referenced this pull request Mar 24, 2024
* Add types to TypeHash and add test cases

Signed-off-by: Michael Carlstrom <rmc@carlstrom.com>
InvincibleRMC added a commit to InvincibleRMC/rclpy that referenced this pull request Mar 27, 2024
* Add types to TypeHash and add test cases

Signed-off-by: Michael Carlstrom <rmc@carlstrom.com>
sloretz added a commit that referenced this pull request May 3, 2024
* First draft of generics

Signed-off-by: Michael Carlstrom <rmc@carlstrom.com>

* Fix Generic

Signed-off-by: Michael Carlstrom <rmc@carlstrom.com>

* Add legacy

Signed-off-by: Michael Carlstrom <rmc@carlstrom.com>

* Fix import order

Signed-off-by: Michael Carlstrom <rmc@carlstrom.com>

* fix import order

Signed-off-by: Michael Carlstrom <rmc@carlstrom.com>

* Add Docstrings

Signed-off-by: Michael Carlstrom <rmc@carlstrom.com>

* Add Docstrings

Signed-off-by: Michael Carlstrom <rmc@carlstrom.com>

* Add generics support to Node

Signed-off-by: Michael Carlstrom <rmc@carlstrom.com>

* Update type_support.py

Signed-off-by: Michael Carlstrom <36806982+InvincibleRMC@users.noreply.github.com>
Signed-off-by: Michael Carlstrom <rmc@carlstrom.com>

* Add types to expand_topic_name (#1238)

Signed-off-by: Michael Carlstrom <rmc@carlstrom.com>

* Creates Enum wrapper for ClockType and ClockChange (#1235)

* Testing out Enum wrapper for ClockType

* convert to rcl_clock_type_t

* Update create_time_point

Signed-off-by: Michael Carlstrom <rmc@carlstrom.com>

* Add types (#1231)

Signed-off-by: Michael Carlstrom <rmc@carlstrom.com>

* Add types to exceptions.py (#1241)

* Add types to exception

* Add type checking guard

* Fix NotInitializedException

* Add missing defualt

Signed-off-by: Michael Carlstrom <rmc@carlstrom.com>

* added python3-yaml (#1242)

Signed-off-by: SnIcK <ido.samuelson@gmail.com>
Signed-off-by: Michael Carlstrom <rmc@carlstrom.com>

* Add types to duration.py (#1233)

* Add types to logging_service.py (#1227)

* add types to logging_service

* Add types to duration.py

* Add newlines for class definintions

* update type alias name

* Update to use Protocols

Signed-off-by: Michael Carlstrom <rmc@carlstrom.com>

* Add Static Typing to Validate files (#1230)

* Add types to validate files

Signed-off-by: Michael Carlstrom <rmc@carlstrom.com>

* remove type annotations from docstrings

Signed-off-by: Michael Carlstrom <rmc@carlstrom.com>

* removed other type annotated docstrings

Signed-off-by: Michael Carlstrom <rmc@carlstrom.com>

---------

Signed-off-by: Michael Carlstrom <rmc@carlstrom.com>

* Add types to TypeHash and moved away from __slots__ usage (#1232)

* Add types to TypeHash and moved away from __slots__ usage

Signed-off-by: Michael Carlstrom <rmc@carlstrom.com>

* remove docstring types

Signed-off-by: Michael Carlstrom <rmc@carlstrom.com>

---------

Signed-off-by: Michael Carlstrom <rmc@carlstrom.com>

* Time.py Types (#1237)

* Start typing time.py

Signed-off-by: Michael Carlstrom <rmc@carlstrom.com>

* Testing out Enum wrapper for ClockType

Signed-off-by: Michael Carlstrom <rmc@carlstrom.com>

* convert to rcl_clock_type_t

Signed-off-by: Michael Carlstrom <rmc@carlstrom.com>

* Undo Change to time_point.cpp

Signed-off-by: Michael Carlstrom <rmc@carlstrom.com>

* Update create_time_point

Signed-off-by: Michael Carlstrom <rmc@carlstrom.com>

* Lint fixes

Signed-off-by: Michael Carlstrom <rmc@carlstrom.com>

* Add debug message

Signed-off-by: Michael Carlstrom <rmc@carlstrom.com>

* Remove test file

Signed-off-by: Michael Carlstrom <rmc@carlstrom.com>

* Try extending the type assert

Signed-off-by: Michael Carlstrom <rmc@carlstrom.com>

* Add types to logging_service.py (#1227)

* add types to logging_service

Signed-off-by: Michael Carlstrom <rmc@carlstrom.com>

* Add types to duration.py

Signed-off-by: Michael Carlstrom <rmc@carlstrom.com>

* Add newlines for class definintions

Signed-off-by: Michael Carlstrom <rmc@carlstrom.com>

* update type alias name

Signed-off-by: Michael Carlstrom <rmc@carlstrom.com>

* Remove newline

Signed-off-by: Michael Carlstrom <rmc@carlstrom.com>

* Merge?

Signed-off-by: Michael Carlstrom <rmc@carlstrom.com>

* Fix failed merge

Signed-off-by: Michael Carlstrom <rmc@carlstrom.com>

* Update to use Protocols

Signed-off-by: Michael Carlstrom <rmc@carlstrom.com>

* Fix import error

Signed-off-by: Michael Carlstrom <rmc@carlstrom.com>

* Add types to time.py

Signed-off-by: Michael Carlstrom <rmc@carlstrom.com>

* Linty

Signed-off-by: Michael Carlstrom <rmc@carlstrom.com>

---------

Signed-off-by: Michael Carlstrom <rmc@carlstrom.com>

* Revert "Add types to TypeHash and moved away from __slots__ usage (#1232)" (#1243)

This reverts commit b06baef.

Signed-off-by: Michael Carlstrom <rmc@carlstrom.com>

* Add back Type hash __slots__ and add test cases. (#1245)

* Add types to TypeHash and add test cases

Signed-off-by: Michael Carlstrom <rmc@carlstrom.com>

* Add types to context.py (#1240)

Signed-off-by: Michael Carlstrom <rmc@carlstrom.com>

* fix pub and sub

Signed-off-by: Michael Carlstrom <rmc@carlstrom.com>

* Update LifecyclePublisher

Signed-off-by: Michael Carlstrom <rmc@carlstrom.com>

* Fix docstring

Signed-off-by: Michael Carlstrom <rmc@carlstrom.com>

* serialization generic

Signed-off-by: Michael Carlstrom <rmc@carlstrom.com>

* serialization generic

Signed-off-by: Michael Carlstrom <rmc@carlstrom.com>

* Update type_support.py

Signed-off-by: Michael Carlstrom <36806982+InvincibleRMC@users.noreply.github.com>

---------

Signed-off-by: Michael Carlstrom <rmc@carlstrom.com>
Signed-off-by: Michael Carlstrom <36806982+InvincibleRMC@users.noreply.github.com>
Signed-off-by: SnIcK <ido.samuelson@gmail.com>
Signed-off-by: Shane Loretz <sloretz@intrinsic.ai>
Co-authored-by: SnIcK <ido.samuelson@gmail.com>
Co-authored-by: Chris Lalancette <clalancette@gmail.com>
Co-authored-by: Shane Loretz <sloretz@intrinsic.ai>
sloretz added a commit that referenced this pull request Aug 2, 2024
* Add types to parameter.py

Signed-off-by: Michael Carlstrom <rmc@carlstrom.com>

* Revert "Add types to TypeHash and moved away from __slots__ usage (#1232)" (#1243)

This reverts commit b06baef.

Signed-off-by: Michael Carlstrom <rmc@carlstrom.com>

* Add back Type hash __slots__ and add test cases. (#1245)

* Add types to TypeHash and add test cases

Signed-off-by: Michael Carlstrom <rmc@carlstrom.com>

* Add types to context.py (#1240)

Signed-off-by: Michael Carlstrom <rmc@carlstrom.com>

* Add types to qos_overriding_options.py (#1248)

Signed-off-by: Michael Carlstrom <rmc170@case.edu>
Signed-off-by: Michael Carlstrom <rmc@carlstrom.com>

* Small fixes for modern flake8. (#1264)

It doesn't like to compare types with ==, so switch to
isinstance as appropriate.

Signed-off-by: Chris Lalancette <clalancette@gmail.com>
Signed-off-by: Michael Carlstrom <rmc@carlstrom.com>

* Add types to time_source.py (#1259)

* Add types to time_source.py

Signed-off-by: Michael Carlstrom <rmc@carlstrom.com>

* fix small bug

Signed-off-by: Michael Carlstrom <rmc@carlstrom.com>

* Switch to overloads to avoid mypy3737

Signed-off-by: Michael Carlstrom <rmc@carlstrom.com>

* Update parameter declaration from Node

Signed-off-by: Michael Carlstrom <rmc@carlstrom.com>

* add back rclpy.

Signed-off-by: Michael Carlstrom <rmc@carlstrom.com>

* Fix flake8 imports

Signed-off-by: Michael Carlstrom <rmc@carlstrom.com>

* Add proper array.array[]

Signed-off-by: Michael Carlstrom <rmc@carlstrom.com>

* Update types of declare_parameter, declare_parameters api

Signed-off-by: Michael Carlstrom <rmc@carlstrom.com>

* Add non conflicting types back to constructor

Signed-off-by: Michael Carlstrom <rmc@carlstrom.com>

* Move sys import

Signed-off-by: Michael Carlstrom <rmc@carlstrom.com>

* Update error message

Signed-off-by: Michael Carlstrom <rmc@carlstrom.com>

* Add default value for generic Parameter

Signed-off-by: Michael Carlstrom <rmc@carlstrom.com>

* Add explanation comment

Signed-off-by: Michael Carlstrom <rmc@carlstrom.com>

* Add TypeVar import inside else case

Signed-off-by: Michael Carlstrom <rmc@carlstrom.com>

* push to rerun ci

Signed-off-by: Michael Carlstrom <rmc@carlstrom.com>

* push to rerun ci

Signed-off-by: Michael Carlstrom <rmc@carlstrom.com>

* Switch back to union

Signed-off-by: Michael Carlstrom <rmc@carlstrom.com>

---------

Signed-off-by: Michael Carlstrom <rmc@carlstrom.com>
Signed-off-by: Michael Carlstrom <rmc170@case.edu>
Signed-off-by: Chris Lalancette <clalancette@gmail.com>
Co-authored-by: Chris Lalancette <clalancette@gmail.com>
Co-authored-by: Shane Loretz <sloretz@intrinsic.ai>
sloretz added a commit that referenced this pull request Aug 5, 2024
* First draft of generics

Signed-off-by: Michael Carlstrom <rmc@carlstrom.com>

* Fix Generic

Signed-off-by: Michael Carlstrom <rmc@carlstrom.com>

* Add legacy

Signed-off-by: Michael Carlstrom <rmc@carlstrom.com>

* Fix import order

Signed-off-by: Michael Carlstrom <rmc@carlstrom.com>

* fix import order

Signed-off-by: Michael Carlstrom <rmc@carlstrom.com>

* Add Docstrings

Signed-off-by: Michael Carlstrom <rmc@carlstrom.com>

* Add Docstrings

Signed-off-by: Michael Carlstrom <rmc@carlstrom.com>

* Add generics support to Node

Signed-off-by: Michael Carlstrom <rmc@carlstrom.com>

* Update type_support.py

Signed-off-by: Michael Carlstrom <36806982+InvincibleRMC@users.noreply.github.com>
Signed-off-by: Michael Carlstrom <rmc@carlstrom.com>

* Add types to expand_topic_name (#1238)

Signed-off-by: Michael Carlstrom <rmc@carlstrom.com>

* Creates Enum wrapper for ClockType and ClockChange (#1235)

* Testing out Enum wrapper for ClockType

* convert to rcl_clock_type_t

* Update create_time_point

Signed-off-by: Michael Carlstrom <rmc@carlstrom.com>

* Add types (#1231)

Signed-off-by: Michael Carlstrom <rmc@carlstrom.com>

* Add types to exceptions.py (#1241)

* Add types to exception

* Add type checking guard

* Fix NotInitializedException

* Add missing defualt

Signed-off-by: Michael Carlstrom <rmc@carlstrom.com>

* added python3-yaml (#1242)

Signed-off-by: SnIcK <ido.samuelson@gmail.com>
Signed-off-by: Michael Carlstrom <rmc@carlstrom.com>

* Add types to duration.py (#1233)

* Add types to logging_service.py (#1227)

* add types to logging_service

* Add types to duration.py

* Add newlines for class definintions

* update type alias name

* Update to use Protocols

Signed-off-by: Michael Carlstrom <rmc@carlstrom.com>

* Add Static Typing to Validate files (#1230)

* Add types to validate files

Signed-off-by: Michael Carlstrom <rmc@carlstrom.com>

* remove type annotations from docstrings

Signed-off-by: Michael Carlstrom <rmc@carlstrom.com>

* removed other type annotated docstrings

Signed-off-by: Michael Carlstrom <rmc@carlstrom.com>

---------

Signed-off-by: Michael Carlstrom <rmc@carlstrom.com>

* Add types to TypeHash and moved away from __slots__ usage (#1232)

* Add types to TypeHash and moved away from __slots__ usage

Signed-off-by: Michael Carlstrom <rmc@carlstrom.com>

* remove docstring types

Signed-off-by: Michael Carlstrom <rmc@carlstrom.com>

---------

Signed-off-by: Michael Carlstrom <rmc@carlstrom.com>

* Time.py Types (#1237)

* Start typing time.py

Signed-off-by: Michael Carlstrom <rmc@carlstrom.com>

* Testing out Enum wrapper for ClockType

Signed-off-by: Michael Carlstrom <rmc@carlstrom.com>

* convert to rcl_clock_type_t

Signed-off-by: Michael Carlstrom <rmc@carlstrom.com>

* Undo Change to time_point.cpp

Signed-off-by: Michael Carlstrom <rmc@carlstrom.com>

* Update create_time_point

Signed-off-by: Michael Carlstrom <rmc@carlstrom.com>

* Lint fixes

Signed-off-by: Michael Carlstrom <rmc@carlstrom.com>

* Add debug message

Signed-off-by: Michael Carlstrom <rmc@carlstrom.com>

* Remove test file

Signed-off-by: Michael Carlstrom <rmc@carlstrom.com>

* Try extending the type assert

Signed-off-by: Michael Carlstrom <rmc@carlstrom.com>

* Add types to logging_service.py (#1227)

* add types to logging_service

Signed-off-by: Michael Carlstrom <rmc@carlstrom.com>

* Add types to duration.py

Signed-off-by: Michael Carlstrom <rmc@carlstrom.com>

* Add newlines for class definintions

Signed-off-by: Michael Carlstrom <rmc@carlstrom.com>

* update type alias name

Signed-off-by: Michael Carlstrom <rmc@carlstrom.com>

* Remove newline

Signed-off-by: Michael Carlstrom <rmc@carlstrom.com>

* Merge?

Signed-off-by: Michael Carlstrom <rmc@carlstrom.com>

* Fix failed merge

Signed-off-by: Michael Carlstrom <rmc@carlstrom.com>

* Update to use Protocols

Signed-off-by: Michael Carlstrom <rmc@carlstrom.com>

* Fix import error

Signed-off-by: Michael Carlstrom <rmc@carlstrom.com>

* Add types to time.py

Signed-off-by: Michael Carlstrom <rmc@carlstrom.com>

* Linty

Signed-off-by: Michael Carlstrom <rmc@carlstrom.com>

---------

Signed-off-by: Michael Carlstrom <rmc@carlstrom.com>

* Revert "Add types to TypeHash and moved away from __slots__ usage (#1232)" (#1243)

This reverts commit b06baef.

Signed-off-by: Michael Carlstrom <rmc@carlstrom.com>

* Add back Type hash __slots__ and add test cases. (#1245)

* Add types to TypeHash and add test cases

Signed-off-by: Michael Carlstrom <rmc@carlstrom.com>

* Add types to context.py (#1240)

Signed-off-by: Michael Carlstrom <rmc@carlstrom.com>

* fix pub and sub

Signed-off-by: Michael Carlstrom <rmc@carlstrom.com>

* Update LifecyclePublisher

Signed-off-by: Michael Carlstrom <rmc@carlstrom.com>

* Fix docstring

Signed-off-by: Michael Carlstrom <rmc@carlstrom.com>

* Start implementation

Signed-off-by: Michael Carlstrom <rmc@carlstrom.com>

* Ungeneric?

Signed-off-by: Michael Carlstrom <rmc@carlstrom.com>

* Stuff

Signed-off-by: Michael Carlstrom <rmc@carlstrom.com>

* serialization generic

Signed-off-by: Michael Carlstrom <rmc@carlstrom.com>

* serialization generic

Signed-off-by: Michael Carlstrom <rmc@carlstrom.com>

* Update type_support.py

Signed-off-by: Michael Carlstrom <36806982+InvincibleRMC@users.noreply.github.com>

* Client Service Generic Implementation

Signed-off-by: Michael Carlstrom <rmc@carlstrom.com>

* Fix debug relative import

Signed-off-by: Michael Carlstrom <rmc@carlstrom.com>

* Update imports

Signed-off-by: Michael Carlstrom <rmc@carlstrom.com>

* Add generics to node.py

Signed-off-by: Michael Carlstrom <rmc@carlstrom.com>

* Update import order

Signed-off-by: Michael Carlstrom <rmc@carlstrom.com>

* Remove double bracket

Signed-off-by: Michael Carlstrom <rmc@carlstrom.com>

---------

Signed-off-by: Michael Carlstrom <rmc@carlstrom.com>
Signed-off-by: Michael Carlstrom <36806982+InvincibleRMC@users.noreply.github.com>
Signed-off-by: SnIcK <ido.samuelson@gmail.com>
Co-authored-by: SnIcK <ido.samuelson@gmail.com>
Co-authored-by: Chris Lalancette <clalancette@gmail.com>
Co-authored-by: Shane Loretz <sloretz@intrinsic.ai>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants