-
Notifications
You must be signed in to change notification settings - Fork 948
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
mypy: Use "|" operator instead of Union/Optional #1345
Conversation
Codecov Report
@@ Coverage Diff @@
## main #1345 +/- ##
==========================================
+ Coverage 90.97% 91.13% +0.16%
==========================================
Files 19 19
Lines 1329 1342 +13
Branches 256 257 +1
==========================================
+ Hits 1209 1223 +14
+ Misses 85 84 -1
Partials 35 35
Continue to review full report at Codecov.
|
@wang-boyu CI failed here. How did you make it work? |
I'm guessing it's due to the type aliases From here it mentions
A similar issue was reported: python/mypy#9610 |
|
I tried this in the 2nd commit. For Python < 3.10, failed with the following error message:
|
1 similar comment
I tried this in the 2nd commit. For Python < 3.10, failed with the following error message:
|
I think I will use Union for the type aliases for now. Only 4 lines of code need them. The rest can be safely set to use |
PR is ready for review. |
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.
LGTM
Partially addresses #1341. To completely remove
Union
, sadly, we need to wait until 3.10 is the oldest supported version.See https://peps.python.org/pep-0604/.