-
-
Notifications
You must be signed in to change notification settings - Fork 345
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 typing for _core/_multierror.py
#2742
Conversation
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## master #2742 +/- ##
=======================================
Coverage 98.92% 98.92%
=======================================
Files 113 113
Lines 16708 16713 +5
Branches 3027 3026 -1
=======================================
+ Hits 16528 16533 +5
Misses 124 124
Partials 56 56
|
c944806
to
e520bd8
Compare
Just as a general note, I think typing deprecated features are at the very bottom of the priority list - unless they're still in extensive use. |
trio/_core/_multierror.py
Outdated
def __new__(cls, exceptions, *, _collapse=True): | ||
def __new__( | ||
cls, exceptions: Iterable[BaseException], *, _collapse: bool = True | ||
) -> MultiError | Self: |
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 should probably have an @overload
using Literal[False]
- if collapse=False, it will return MultiError
. Otherwise, it may return any exception.
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.
Kind of did in b21b293 but not exactly
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.
Adding overloads for this ends up failing with type issues from conflicts between overloads. If anyone has any ideas, please share.
_core/_multierror.py
_core/_multierror.py
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.
Noticed a few things, including an assert which I believe isn't correct.
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 don't really have much to say, this seems fine (pending others' approval).
trio/_core/_multierror.py
Outdated
def __reduce__(self): | ||
def __reduce__( | ||
self, | ||
) -> tuple[object, tuple[type[Self], list[BaseException]], dict[str, bool],]: |
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.
why the trailing comma?
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 used black formatting, not sure, I can try removing it.
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.
Nope, still there after removing and re-running black format. Maybe black has a bug?
Add typing for
_core/_multierror.py
I would love feedback and any comments on how this could be improved to be more accurate.