Skip to content

Commit

Permalink
TYP: positional-only binop parameters in numpy.dtype
Browse files Browse the repository at this point in the history
  • Loading branch information
jorenham committed Jul 13, 2024
1 parent 6abbf5a commit a6f4968
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions numpy/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -818,36 +818,36 @@ class dtype(Generic[_DTypeScalar_co]):
def __class_getitem__(self, item: Any) -> GenericAlias: ...

@overload
def __getitem__(self: dtype[void], key: list[builtins.str]) -> dtype[void]: ...
def __getitem__(self: dtype[void], key: list[builtins.str], /) -> dtype[void]: ...
@overload
def __getitem__(self: dtype[void], key: builtins.str | SupportsIndex) -> dtype[Any]: ...
def __getitem__(self: dtype[void], key: builtins.str | SupportsIndex, /) -> dtype[Any]: ...

# NOTE: In the future 1-based multiplications will also yield `flexible` dtypes
@overload
def __mul__(self: _DType, value: L[1]) -> _DType: ...
def __mul__(self: _DType, value: L[1], /) -> _DType: ...
@overload
def __mul__(self: _FlexDType, value: SupportsIndex) -> _FlexDType: ...
def __mul__(self: _FlexDType, value: SupportsIndex, /) -> _FlexDType: ...
@overload
def __mul__(self, value: SupportsIndex) -> dtype[void]: ...
def __mul__(self, value: SupportsIndex, /) -> dtype[void]: ...

# NOTE: `__rmul__` seems to be broken when used in combination with
# literals as of mypy 0.902. Set the return-type to `dtype[Any]` for
# now for non-flexible dtypes.
@overload
def __rmul__(self: _FlexDType, value: SupportsIndex) -> _FlexDType: ...
def __rmul__(self: _FlexDType, value: SupportsIndex, /) -> _FlexDType: ...
@overload
def __rmul__(self, value: SupportsIndex) -> dtype[Any]: ...
def __rmul__(self, value: SupportsIndex, /) -> dtype[Any]: ...

def __gt__(self, other: DTypeLike) -> builtins.bool: ...
def __ge__(self, other: DTypeLike) -> builtins.bool: ...
def __lt__(self, other: DTypeLike) -> builtins.bool: ...
def __le__(self, other: DTypeLike) -> builtins.bool: ...
def __gt__(self, other: DTypeLike, /) -> builtins.bool: ...
def __ge__(self, other: DTypeLike, /) -> builtins.bool: ...
def __lt__(self, other: DTypeLike, /) -> builtins.bool: ...
def __le__(self, other: DTypeLike, /) -> builtins.bool: ...

# Explicitly defined `__eq__` and `__ne__` to get around mypy's
# `strict_equality` option; even though their signatures are
# identical to their `object`-based counterpart
def __eq__(self, other: Any) -> builtins.bool: ...
def __ne__(self, other: Any) -> builtins.bool: ...
def __eq__(self, other: Any, /) -> builtins.bool: ...
def __ne__(self, other: Any, /) -> builtins.bool: ...

@property
def alignment(self) -> int: ...
Expand Down

0 comments on commit a6f4968

Please sign in to comment.