-
-
Notifications
You must be signed in to change notification settings - Fork 290
Add support for binary union types - Python 3.10 #1977
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
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #1977 +/- ##
==========================================
+ Coverage 92.68% 92.70% +0.01%
==========================================
Files 94 94
Lines 10891 10920 +29
==========================================
+ Hits 10094 10123 +29
Misses 797 797
Flags with carried forward coverage won't be shown. Click here to find out more.
|
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 think this can go in 2.16.
But shouldn't it be in astroid 2.14 ? |
It certainly could. Moved the changelog entry. |
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.
One minor nit. Rest LGTM!
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.
We should probably cover callable
, pytype
, display_type
, bool_value
and __str__
if only to prevent regression later, right ?
Added some more asserts. Although it might be that we need to go back and change some of them later. I don't know every detail of how the new class will be used by astroid and pylint. |
The isort issue will be fixed by #1989 |
👍 |
@Pierre-Sassoulas Think you actually need to approve it since you requested changes earlier. Or I could just bypass the branch protection in this case 😄 |
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.
My bad 😄
Description
Add basic inference support for runtime binary or unions added in Python 3.10.
Not completely sure this is 100% the right approach for it, but it works. We can always iterate on it later if we want / need to.
At runtime
int | None
is represented as an instance oftypes.UnionType
.Refs pylint-dev/pylint#8119
--
After this is merged, I think it would make sense to do a new release so we can include it in pylint
2.16.0
.