Skip to content
This repository was archived by the owner on Nov 3, 2023. It is now read-only.
This repository was archived by the owner on Nov 3, 2023. It is now read-only.

Wrong "D105: Missing docstring in magic method" for overload function #525

Open
@ITProKyle

Description

@ITProKyle

Similar to #419 but for class magic methods.

The following example results in the the two overloaded __getitem__ methods to be flagged with D105. The expected result is that they are not flagged.

from typing import Iterable, List, MutableSequence, TypeVar, overload

_T = TypeVar("_T")

class MyClass(MutableSequence(_T)):
    """Example class."""

    def __init__(self, iterable: Iterable[_T]) -> None:
        """Instantiate class."""
        self._data = list(iterable)

    @overload
    def __getitem__(self, __index: int) -> _T:
        ...

    @overload
    def __getitem__(self, __index: slice) -> List[_T]:
        ...

    def __getitem__(self, __index):
        """Get item by index."""
        return self._data[__index]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions