Skip to content

Simplify stub for iter() #6297

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

Closed
wants to merge 1 commit into from
Closed

Conversation

AlexWaygood
Copy link
Member

As discussed here (cc: @JelleZijlstra)

@github-actions
Copy link
Contributor

Diff from mypy_primer, showing the effect of this PR on open source code:

vision (https://github.com/pytorch/vision.git)
+ torchvision/datasets/utils.py:34: error: Need type annotation for "chunk"  [var-annotated]
+ torchvision/datasets/utils.py:56: error: Need type annotation for "chunk"  [var-annotated]

poetry (https://github.com/python-poetry/poetry.git)
+ poetry/publishing/uploader.py:145: error: Need type annotation for "content"

paasta (https://github.com/yelp/paasta.git)
+ paasta_tools/utils.py:2673: error: Need type annotation for "linebytes"

twine (https://github.com/pypa/twine.git)
+ twine/package.py:290: error: Need type annotation for "content"

ignite (https://github.com/pytorch/ignite)
+ ignite/utils.py:318: error: Need type annotation for "byte_block"  [var-annotated]

sockeye (https://github.com/awslabs/sockeye.git)
+ sockeye/data_io.py:425: error: Need type annotation for "random_shard_iter"
+ sockeye/data_io.py:425: error: Argument 1 to "iter" has incompatible type "Callable[[], int]"; expected "Callable[[], <nothing>]"
+ sockeye/data_io.py:425: error: Return statement in function which does not return

@AlexWaygood
Copy link
Member Author

Yeah, this doesn't really seem to work. I can think of a few ways round it, but I'm not sure any of them would actually be an improvement over the current stub. So I think I'll just close this, unless anyone disagrees?

@AlexWaygood AlexWaygood marked this pull request as draft November 15, 2021 00:00
@AlexWaygood AlexWaygood deleted the patch-1 branch November 15, 2021 00:21
@JelleZijlstra
Copy link
Member

Too bad, thanks for trying! I'm honestly surprised there are enough uses of two-argument iter() that mypy-primer was helpful here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants