Skip to content

Commit

Permalink
signal.windows: Allow ndarrays for a param in general_cosine.
Browse files Browse the repository at this point in the history
In `_windows.pyi`. This is because `ndarray` is not a `Sequence`.
  • Loading branch information
pavyamsiri committed Nov 3, 2024
1 parent 69cc2ea commit de9b247
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions scipy-stubs/signal/windows/_windows.pyi
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
from collections.abc import Sequence
from typing import Literal, TypeAlias, overload
from typing import Any, Literal, TypeAlias, overload
from typing_extensions import Unpack

import numpy as np
import optype as op
import optype.numpy as onpt

Check failure on line 7 in scipy-stubs/signal/windows/_windows.pyi

View workflow job for this annotation

GitHub Actions / lint-and-typecheck

Import "onpt" is not accessed (reportUnusedImport)
from scipy._typing import AnyInt, AnyReal

__all__ = [
Expand Down Expand Up @@ -37,6 +38,12 @@ __all__ = [

_Array_f8_1d: TypeAlias = np.ndarray[tuple[int], np.dtype[np.float64]]
_Array_f8_2d: TypeAlias = np.ndarray[tuple[int, int], np.dtype[np.float64]]
_Weights: TypeAlias = (
Sequence[AnyReal]
| np.ndarray[tuple[int], np.dtype[np.floating[Any]]]
| np.ndarray[tuple[int], np.dtype[np.integer[Any]]]
| np.ndarray[tuple[int], np.dtype[np.bool_]]
)

_Norm: TypeAlias = Literal[2, "approximate", "subsample"]
_WindowLength: TypeAlias = int | np.int16 | np.int32 | np.int64
Expand Down Expand Up @@ -111,7 +118,7 @@ _WindowNeedsParams: TypeAlias = Literal[
"kbd",
]

def general_cosine(M: _WindowLength, a: Sequence[AnyReal], sym: op.CanBool = True) -> _Array_f8_1d: ...
def general_cosine(M: _WindowLength, a: _Weights, sym: op.CanBool = True) -> _Array_f8_1d: ...
def boxcar(M: _WindowLength, sym: op.CanBool = True) -> _Array_f8_1d: ...
def triang(M: _WindowLength, sym: op.CanBool = True) -> _Array_f8_1d: ...
def parzen(M: _WindowLength, sym: op.CanBool = True) -> _Array_f8_1d: ...
Expand Down

0 comments on commit de9b247

Please sign in to comment.