-
Couldn't load subscription status.
- Fork 0
Include module name in python type name strings to disambiguate types when converting. #129
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
Conversation
Signed-off-by: Michael Johansen <[email protected]>
Test Results 10 files ± 0 10 suites ±0 24s ⏱️ -1s Results for commit 1a61b7e. ± Comparison against base commit b5f258f. This pull request removes 52 and adds 53 tests. Note that renamed tests count towards both.♻️ This comment has been updated with latest results. |
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.
This PR has a logical conflict with #128. Whichever PR gets in second will have to update the timedelta converter to return the type string datetime.timedelta.
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.
I would like us to strongly consider changing python_typename to always use '{module}.{class}' for every converter.
Signed-off-by: Michael Johansen <[email protected]>
Signed-off-by: Michael Johansen <[email protected]>
…or Collection. Type name logic moved into base class. Signed-off-by: Michael Johansen <[email protected]>
What does this Pull Request accomplish?
This change adds the module name to the python type name string that is used when determining what converter to use based on the python type.
This makes it so that the grpc conversion code can tell the difference between the different
datetimeandtimedeltatypes:bintime.DateTime,hightime.datetime,datetime.datetimebintime.TimeDelta,hightime.timedelta,datetime.timedeltaTo do this, I created a new method called
get_candidate_stringswhich takes the list of "underlying parents" and returns the disambiguated type strings for those types. Meaning that they contain the module name as well as the type name.I've updated all converters to specify their type string as
module.type. Example:builtins.intI've updated all collection converters to specify their type string to be like
collections.abc.Collection[builtins.int]I refactored the
Converterclass into three separate classes to handle the type naming in the base classes:ConverterCollectionConverterCollectionConverter2DWhy should this Pull Request be merged?
So that the conversion code can tell the difference between different timing types and convert them appropriately.
Implements part of:
What testing has been done?
I updated the converter unit tests, which are passing. The rest of the unit tests pass as well. Also mypy, pyright, styleguide.