def scope():
    from collections.abc import Generator

    class IteratorReturningSimpleGenerator1:
        def __iter__(self) -> Generator:
            ...  # PYI058 (use `Iterator`)


def scope():
    import typing

    class IteratorReturningSimpleGenerator2:
        def __iter__(self) -> typing.Generator:
            ...  # PYI058 (use `Iterator`)


def scope():
    import collections.abc

    class IteratorReturningSimpleGenerator3:
        def __iter__(self) -> collections.abc.Generator:
            ...  # PYI058 (use `Iterator`)


def scope():
    import collections.abc
    from typing import Any

    class IteratorReturningSimpleGenerator4:
        def __iter__(self, /) -> collections.abc.Generator[str, Any, None]:
            ...  # PYI058 (use `Iterator`)


def scope():
    import collections.abc
    import typing

    class IteratorReturningSimpleGenerator5:
        def __iter__(self, /) -> collections.abc.Generator[str, None, typing.Any]:
            ...  # PYI058 (use `Iterator`)


def scope():
    from collections.abc import Generator

    class IteratorReturningSimpleGenerator6:
        def __iter__(self, /) -> Generator[str, None, None]:
            ...  # PYI058 (use `Iterator`)


def scope():
    import typing_extensions

    class AsyncIteratorReturningSimpleAsyncGenerator1:
        def __aiter__(
            self,
        ) -> typing_extensions.AsyncGenerator:
            ...  # PYI058 (Use `AsyncIterator`)


def scope():
    import collections.abc

    class AsyncIteratorReturningSimpleAsyncGenerator2:
        def __aiter__(self, /) -> collections.abc.AsyncGenerator[str, Any]:
            ...  # PYI058 (Use `AsyncIterator`)


def scope():
    import collections.abc

    class AsyncIteratorReturningSimpleAsyncGenerator3:
        def __aiter__(self, /) -> collections.abc.AsyncGenerator[str, None]:
            ...  # PYI058 (Use `AsyncIterator`)


def scope():
    from typing import Iterator

    class CorrectIterator:
        def __iter__(self) -> Iterator[str]:
            ...  # OK


def scope():
    import collections.abc

    class CorrectAsyncIterator:
        def __aiter__(self) -> collections.abc.AsyncIterator[int]:
            ...  # OK


def scope():
    import typing

    class Fine:
        def __iter__(self) -> typing.Self:
            ...  # OK


def scope():
    class StrangeButWeWontComplainHere:
        def __aiter__(self) -> list[bytes]:
            ...  # OK


def scope():
    from collections.abc import Generator

    def __iter__(self) -> Generator:
        ...  # OK (not in class scope)


def scope():
    from collections.abc import AsyncGenerator

    def __aiter__(self) -> AsyncGenerator:
        ...  # OK (not in class scope)


def scope():
    from collections.abc import Generator

    class IteratorReturningComplexGenerator:
        def __iter__(self) -> Generator[str, int, bytes]:
            ...  # OK


def scope():
    from collections.abc import AsyncGenerator

    class AsyncIteratorReturningComplexAsyncGenerator:
        def __aiter__(self) -> AsyncGenerator[str, int]:
            ...  # OK


def scope():
    from collections.abc import AsyncGenerator

    class ClassWithInvalidAsyncAiterMethod:
        async def __aiter__(self) -> AsyncGenerator:
            ...  # OK


def scope():
    from collections.abc import Generator

    class IteratorWithUnusualParameters1:
        def __iter__(self, foo) -> Generator:
            ...  # OK


def scope():
    from collections.abc import Generator

    class IteratorWithUnusualParameters2:
        def __iter__(self, *, bar) -> Generator:
            ...  # OK


def scope():
    from collections.abc import Generator

    class IteratorWithUnusualParameters3:
        def __iter__(self, *args) -> Generator:
            ...  # OK


def scope():
    from collections.abc import Generator

    class IteratorWithUnusualParameters4:
        def __iter__(self, **kwargs) -> Generator:
            ...  # OK
