Add typing for _core/_multierror.py#2742
Conversation
Codecov Report
Additional details and impacted files
|
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.
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.
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
TeamSpen210
left a comment
There was a problem hiding this comment.
Noticed a few things, including an assert which I believe isn't correct.
A5rocks
left a comment
There was a problem hiding this comment.
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.
I used black formatting, not sure, I can try removing it.
There was a problem hiding this comment.
Nope, still there after removing and re-running black format. Maybe black has a bug?
Add typing for
_core/_multierror.pyI would love feedback and any comments on how this could be improved to be more accurate.