Skip to content

Simplify stub for iter() - #6297

Closed
AlexWaygood wants to merge 1 commit into
python:masterfrom
AlexWaygood:patch-1
Closed

AlexWaygood wants to merge 1 commit into
python:masterfrom
AlexWaygood:patch-1

Conversation

@AlexWaygood

Copy link
Copy Markdown
Member

As discussed here (cc: @JelleZijlstra)

@github-actions

Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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