Type match with collections.abc.Collection and some exclusions#152
Merged
mjohanse-emr merged 6 commits intomainfrom Sep 4, 2025
Merged
Type match with collections.abc.Collection and some exclusions#152mjohanse-emr merged 6 commits intomainfrom
mjohanse-emr merged 6 commits intomainfrom
Conversation
added 2 commits
September 3, 2025 09:01
… of concrete collection types Signed-off-by: Michael Johansen <michael.johansen@ni.com>
Signed-off-by: Michael Johansen <michael.johansen@ni.com>
Signed-off-by: Michael Johansen <michael.johansen@ni.com>
Contributor
Signed-off-by: Michael Johansen <michael.johansen@ni.com>
added 2 commits
September 4, 2025 14:57
Signed-off-by: Michael Johansen <michael.johansen@ni.com>
Signed-off-by: Michael Johansen <michael.johansen@ni.com>
csjall
approved these changes
Sep 4, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this Pull Request accomplish?
Updates the gRPC conversion logic to determine if something is a "collection" by checking if it's an instance of
collections.abc.Collection, but not an instance of several other types that are technically collections but are handled with a custom converter.Exclusions:
str: Has a separate converterbytes: Has a separate converterenum.Enum: Converted as intsdict: Not a valid type to convertni.protobuf.types.Vector: Has a separate converterWhy should this Pull Request be merged?
AB#3175632
What testing has been done?
Unit tests, mypy, pyright, styleguide
Previous RFC Comments
This is a Request for Comment (at least for now) PR addressing this research item about using
collections.abcinstead oflist, set, frozen_set, etc.to determine collections for conversion.AB#3175632
The question to answer here is whether the implementation in this PR is better and/or more maintainable than keeping a "inclusion" list of the types of collections we support. Note that I do not know if the exclusion list is complete, but it does satisfy the unit tests that were already written. We'll have to maintain the exclusion list, so we'll have to decide whether that's easier than maintaining the inclusion list.