-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Fix tqdm.asyncio type inconsistency #13259
Conversation
This comment has been minimized.
This comment has been minimized.
stubs/tqdm/tqdm/asyncio.pyi
Outdated
@@ -84,7 +84,7 @@ class tqdm_asyncio(std_tqdm[_T]): | |||
@overload | |||
def __init__( | |||
self, | |||
iterable: Iterable[_T], | |||
iterable: Iterable[_T] | Iterator[_T] | AsyncIterator[_T], |
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.
Iterable
is redundant, as each Iterator
is an Iterable
.
iterable: Iterable[_T] | Iterator[_T] | AsyncIterator[_T], | |
iterable: Iterator[_T] | AsyncIterator[_T], |
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.
Iterable[_T]
is still a valid type, so Iterator[_T]
should probably be removed instead.
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.
Looks to me that @mattmess1221 is correct, just because this code fallsback to iter(iterable), so they will create an Iterator themselves from Iterable.
The code in question: https://github.com/tqdm/tqdm/blob/0ed5d7f18fa3153834cbac0aa57e8092b217cc16/tqdm/asyncio.py#L26-L34
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.
You are correct, of course. Iterator
is redundant.
According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉 |
Fixes #13227