You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Nov 3, 2023. It is now read-only.
classNestedSequence(Protocol[_T_co]):
"""A protocol for representing nested sequences. Warning ------- `NestedSequence` currently does not work in combination with typevars, *e.g.* ``def func(a: _NestedSequnce[T]) -> T: ...``. See Also -------- collections.abc.Sequence ABCs for read-only and mutable :term:`sequences`. Examples -------- .. code-block:: python >>> from __future__ import annotations >>> from typing import TYPE_CHECKING >>> import numpy as np >>> def get_dtype(seq: NestedSequence[float]) -> np.dtype[np.float64]: ... return np.asarray(seq).dtype >>> a = get_dtype([1.0]) >>> b = get_dtype([[1.0]]) >>> c = get_dtype([[[1.0]]]) >>> d = get_dtype([[[[1.0]]]]) >>> if TYPE_CHECKING: ... reveal_locals() ... # note: Revealed local types are: ... # note: a: numpy.dtype[numpy.floating[numpy._typing._64Bit]] ... # note: b: numpy.dtype[numpy.floating[numpy._typing._64Bit]] ... # note: c: numpy.dtype[numpy.floating[numpy._typing._64Bit]] ... # note: d: numpy.dtype[numpy.floating[numpy._typing._64Bit]] """def__len__(self, /) ->int:
"""Implement ``len(self)``."""raiseNotImplementedError@overloaddef__getitem__(self, index: int, /) ->_T_co|NestedSequence[_T_co]:
...
@overloaddef__getitem__(self, index: slice, /) ->NestedSequence[_T_co]:
...
def__getitem__(self, index, /):
"""Implement ``self[x]``."""raiseNotImplementedErrordef__contains__(self, x: object, /) ->bool:
"""Implement ``x in self``."""raiseNotImplementedErrordef__iter__(self, /) ->Iterator[_T_co|NestedSequence[_T_co]]:
"""Implement ``iter(self)``."""raiseNotImplementedErrordef__reversed__(self, /) ->Iterator[_T_co|NestedSequence[_T_co]]:
"""Implement ``reversed(self)``."""raiseNotImplementedErrordefcount(self, value: Any, /) ->int:
"""Return the number of occurrences of `value`."""raiseNotImplementedErrordefindex(self, value: Any, /) ->int:
"""Return the first index of `value`."""raiseNotImplementedError
pydocstyle reports that the two first __getitem__ overloads are missing docstrings:
colour/hints/__init__.py:223 in public method `__getitem__`:
D105: Missing docstring in magic method
colour/hints/__init__.py:227 in public method `__getitem__`:
D105: Missing docstring in magic method
But then if I add docstrings:
colour/hints/__init__.py:224 in public method `__getitem__`:
D418: Function/ Method decorated with @overload shouldn't contain a docstring
colour/hints/__init__.py:229 in public method `__getitem__`:
D418: Function/ Method decorated with @overload shouldn't contain a docstring
The text was updated successfully, but these errors were encountered:
$ pydocstyle --select=D105,D418 test.py
temp.py:11 in public method `__getitem__`:
D418: Function/ Method decorated with @overload shouldn't contain a docstringtemp.py:14 in public method `__getitem__`: D105: Missing docstring in magic method
Given this class:
pydocstyle reports that the two first
__getitem__
overloads are missing docstrings:But then if I add docstrings:
The text was updated successfully, but these errors were encountered: