diff --git a/README.md b/README.md index 47d18f2a..b2b0ddc3 100644 --- a/README.md +++ b/README.md @@ -95,7 +95,7 @@ pip install scipy-stubs | `scipy.io.arff` | 2: partial | | `scipy.io.matlab` | 2: partial | | `scipy.linalg` | **4: done** | -| `scipy.misc` | 0: missing | +| ~`scipy.misc`~ | **4: done** | | `scipy.ndimage` | 2: partial | | `scipy.odr` | 1: skeleton | | `scipy.optimize` | 2: partial | diff --git a/scipy-stubs/_lib/doccer.pyi b/scipy-stubs/_lib/doccer.pyi index 05e2e541..4009199e 100644 --- a/scipy-stubs/_lib/doccer.pyi +++ b/scipy-stubs/_lib/doccer.pyi @@ -1,11 +1,28 @@ -from scipy._typing import Untyped - -def docformat(docstring, docdict: Untyped | None = None) -> Untyped: ... -def inherit_docstring_from(cls) -> Untyped: ... -def extend_notes_in_docstring(cls, notes) -> Untyped: ... -def replace_notes_in_docstring(cls, notes) -> Untyped: ... -def indentcount_lines(lines) -> Untyped: ... -def filldoc(docdict, unindent_params: bool = True) -> Untyped: ... -def unindent_dict(docdict) -> Untyped: ... -def unindent_string(docstring) -> Untyped: ... -def doc_replace(obj, oldval, newval) -> Untyped: ... +from collections.abc import Callable +from typing_extensions import TypeVar + +import optype as op + +__all__ = [ + "doc_replace", + "docformat", + "extend_notes_in_docstring", + "filldoc", + "indentcount_lines", + "inherit_docstring_from", + "replace_notes_in_docstring", + "unindent_dict", + "unindent_string", +] + +_F = TypeVar("_F", bound=Callable[..., object]) + +def docformat(docstring: str, docdict: dict[str, str] | None = None) -> str: ... +def inherit_docstring_from(cls: type | object) -> Callable[[_F], _F]: ... +def extend_notes_in_docstring(cls: type | object, notes: str) -> Callable[[_F], _F]: ... +def replace_notes_in_docstring(cls: type | object, notes: str) -> Callable[[_F], _F]: ... +def indentcount_lines(lines: op.CanIter[op.CanNext[str]]) -> int: ... +def filldoc(docdict: dict[str, str], unindent_params: bool = True) -> Callable[[_F], _F]: ... +def unindent_dict(docdict: dict[str, str]) -> dict[str, str]: ... +def unindent_string(docstring: str) -> str: ... +def doc_replace(obj: object, oldval: str, newval: str) -> Callable[[_F], _F]: ... diff --git a/scipy-stubs/misc/__init__.pyi b/scipy-stubs/misc/__init__.pyi index 157378c8..c067b150 100644 --- a/scipy-stubs/misc/__init__.pyi +++ b/scipy-stubs/misc/__init__.pyi @@ -1,8 +1,7 @@ -from scipy._typing import Untyped -from . import common as common, doccer as doccer -from ._common import * +from typing import Literal -dataset_methods: Untyped +from . import common, doccer # pyright: ignore[reportUnusedImport] +from ._common import * -def __dir__() -> Untyped: ... -def __getattr__(name) -> Untyped: ... +__all__ = ["ascent", "central_diff_weights", "derivative", "electrocardiogram", "face"] +dataset_methods: list[Literal["ascent", "face", "electrocardiogram"]] diff --git a/scipy-stubs/misc/_common.pyi b/scipy-stubs/misc/_common.pyi index 387ae86f..e3b47d6c 100644 --- a/scipy-stubs/misc/_common.pyi +++ b/scipy-stubs/misc/_common.pyi @@ -1,7 +1,30 @@ -from scipy._typing import Untyped +from collections.abc import Callable +from typing import Concatenate, Literal +from typing_extensions import deprecated -def central_diff_weights(Np, ndiv: int = 1) -> Untyped: ... -def derivative(func, x0, dx: float = 1.0, n: int = 1, args=(), order: int = 3) -> Untyped: ... -def ascent() -> Untyped: ... -def face(gray: bool = False) -> Untyped: ... -def electrocardiogram() -> Untyped: ... +import numpy as np +import optype.numpy as onpt + +__all__ = ["ascent", "central_diff_weights", "derivative", "electrocardiogram", "face"] + +# this module proofs the existance of an afterlife, because we're currently on scipy 1.14.1 -_- + +@deprecated("will be completely removed in SciPy 1.12.0") +def central_diff_weights(Np: int, ndiv: int = 1) -> onpt.Array[tuple[int], np.float64]: ... +@deprecated("will be completely removed in SciPy 1.12.0") +def derivative( + func: Callable[Concatenate[float, ...], float], + x0: float, + dx: float = 1.0, + n: int = 1, + args: tuple[object, ...] = (), + order: int = 3, +) -> float: ... +@deprecated("will be completely removed in SciPy 1.12.0") +def ascent() -> onpt.Array[tuple[Literal[512], Literal[512]], np.uint8]: ... +@deprecated("will be completely removed in SciPy 1.12.0") +def face( + gray: bool = False, +) -> onpt.Array[tuple[Literal[768], Literal[1024]] | tuple[Literal[768], Literal[1024], Literal[3]], np.uint8]: ... +@deprecated("will be completely removed in SciPy 1.12.0") +def electrocardiogram() -> onpt.Array[tuple[Literal[108_000]], np.float64]: ... diff --git a/scipy-stubs/misc/common.pyi b/scipy-stubs/misc/common.pyi index bc0eb39c..42c63db6 100644 --- a/scipy-stubs/misc/common.pyi +++ b/scipy-stubs/misc/common.pyi @@ -1,4 +1,11 @@ -from scipy._typing import Untyped +# This file is not meant for public use and will be removed in SciPy v2.0.0. -def __dir__() -> Untyped: ... -def __getattr__(name) -> Untyped: ... +from ._common import * + +__all__ = [ + "ascent", + "central_diff_weights", + "derivative", + "electrocardiogram", + "face", +] diff --git a/scipy-stubs/misc/doccer.pyi b/scipy-stubs/misc/doccer.pyi index bc0eb39c..0df4397e 100644 --- a/scipy-stubs/misc/doccer.pyi +++ b/scipy-stubs/misc/doccer.pyi @@ -1,4 +1,23 @@ -from scipy._typing import Untyped +# This file is not meant for public use and will be removed in SciPy v2.0.0. -def __dir__() -> Untyped: ... -def __getattr__(name) -> Untyped: ... +from scipy._lib.doccer import ( + docformat, + extend_notes_in_docstring, + filldoc, + indentcount_lines, + inherit_docstring_from, + replace_notes_in_docstring, + unindent_dict, + unindent_string, +) + +__all__ = [ + "docformat", + "extend_notes_in_docstring", + "filldoc", + "indentcount_lines", + "inherit_docstring_from", + "replace_notes_in_docstring", + "unindent_dict", + "unindent_string", +]