Skip to content
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

Introduce Y058: Use (Async)Iterator, not (Async)Generator, for simple __(a)iter__ methods #428

Merged
merged 2 commits into from
Oct 20, 2023

Conversation

AlexWaygood
Copy link
Collaborator

@AlexWaygood AlexWaygood commented Oct 18, 2023

Closes #423

@github-actions
Copy link

⚠ Flake8 diff showing the effect of this PR on typeshed:

> ./stubs/fpdf2/fpdf/structure_tree.pyi:48:5: Y058 Use "Iterator" as the return value for simple "__iter__" methods, e.g. "def __iter__(self) -> Iterator[Incomplete]: ..."
> ./stubs/setuptools/pkg_resources/__init__.pyi:35:5: Y058 Use "Iterator" as the return value for simple "__iter__" methods, e.g. "def __iter__(self) -> Iterator[Distribution]: ..."
> ./stubs/setuptools/pkg_resources/__init__.pyi:64:5: Y058 Use "Iterator" as the return value for simple "__iter__" methods, e.g. "def __iter__(self) -> Iterator[str]: ..."

@JelleZijlstra JelleZijlstra self-requested a review October 18, 2023 18:27
@JelleZijlstra JelleZijlstra merged commit 858c091 into main Oct 20, 2023
20 checks passed
@JelleZijlstra JelleZijlstra deleted the iter-method-generators branch October 20, 2023 03:07
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.

Rule: Prefer Iterator over simple Generator for __iter__ return type
2 participants