-
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #76 from jorenham/stubtest/scipy._lib
`scipy._lib`
- Loading branch information
Showing
25 changed files
with
473 additions
and
418 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,38 @@ | ||
from types import ModuleType | ||
from typing import Any, Literal | ||
from typing import Literal, Protocol, TypeAlias, TypeVar, type_check_only | ||
|
||
from scipy._lib.array_api_compat import device, size | ||
from scipy._typing import Untyped | ||
import numpy.typing as npt | ||
|
||
__all__ = ["_asarray", "array_namespace", "device", "size"] | ||
|
||
_DeviceT_co = TypeVar("_DeviceT_co", covariant=True) | ||
|
||
# TODO: To be changed to a `Protocol` (once they learn about Python typing, so don't get your hopes up) | ||
# https://github.com/data-apis/array-api/pull/589 | ||
Array: TypeAlias = object | ||
ArrayLike: TypeAlias = Array | npt.ArrayLike | ||
_DType: TypeAlias = object | npt.DTypeLike | ||
|
||
@type_check_only | ||
class _HasDevice(Protocol[_DeviceT_co]): | ||
@property | ||
def device(self, /) -> _DeviceT_co: ... | ||
|
||
@type_check_only | ||
class _HasShape(Protocol): | ||
@property | ||
def shape(self, /) -> tuple[int, ...]: ... | ||
|
||
def _asarray( | ||
array: Untyped, | ||
dtype: Any = None, | ||
array: ArrayLike, | ||
dtype: _DType = None, | ||
order: Literal["K", "A", "C", "F"] | None = None, | ||
copy: bool | None = None, | ||
*, | ||
xp: ModuleType | None = None, | ||
check_finite: bool = False, | ||
subok: bool = False, | ||
) -> Untyped: ... | ||
def array_namespace(*arrays: Untyped) -> ModuleType: ... | ||
) -> Array: ... | ||
def array_namespace(*arrays: Array) -> ModuleType: ... | ||
def device(x: _HasDevice[_DeviceT_co], /) -> _DeviceT_co: ... | ||
def size(x: _HasShape) -> int: ... |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,22 @@ | ||
from scipy._typing import Untyped | ||
from collections.abc import Iterator | ||
from typing import Generic | ||
from typing_extensions import TypeVar | ||
|
||
class DisjointSet: | ||
import optype as op | ||
|
||
_T = TypeVar("_T", bound=op.CanHash, default=object) | ||
|
||
class DisjointSet(Generic[_T]): | ||
n_subsets: int | ||
def __init__(self, elements: Untyped | None = None): ... | ||
def __iter__(self) -> Untyped: ... | ||
def __len__(self) -> int: ... | ||
def __contains__(self, x) -> bool: ... | ||
def __getitem__(self, x) -> Untyped: ... | ||
def add(self, x): ... | ||
def merge(self, x, y) -> Untyped: ... | ||
def connected(self, x, y) -> Untyped: ... | ||
def subset(self, x) -> Untyped: ... | ||
def subset_size(self, x) -> Untyped: ... | ||
def subsets(self) -> Untyped: ... | ||
|
||
def __init__(self, /, elements: _T | None = None) -> None: ... | ||
def __iter__(self, /) -> Iterator[_T]: ... | ||
def __len__(self, /) -> int: ... | ||
def __contains__(self, x: object, /) -> bool: ... | ||
def __getitem__(self, x: _T, /) -> int: ... | ||
def add(self, /, x: _T) -> None: ... | ||
def merge(self, /, x: _T, y: _T) -> bool: ... | ||
def connected(self, /, x: _T, y: _T) -> bool: ... | ||
def subset(self, /, x: _T) -> set[_T]: ... | ||
def subset_size(self, /, x: _T) -> int: ... | ||
def subsets(self, /) -> list[set[_T]]: ... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,14 @@ | ||
from collections.abc import Generator | ||
from contextlib import _GeneratorContextManager | ||
from collections.abc import Callable | ||
from typing import Final, ParamSpec, TypeVar | ||
|
||
from scipy._typing import Untyped | ||
_T = TypeVar("_T") | ||
_Tss = ParamSpec("_Tss") | ||
|
||
IS_PYPY: Untyped | ||
IS_PYPY: Final[bool] = ... | ||
|
||
class ReferenceError(AssertionError): ... | ||
|
||
def set_gc_state(state): ... | ||
def gc_state(state) -> Generator[None, None, None]: ... | ||
def assert_deallocated(func, *args, **kwargs) -> Generator[Untyped, None, None]: ... | ||
def set_gc_state(state: bool) -> None: ... | ||
def gc_state(state: bool) -> _GeneratorContextManager[None]: ... | ||
def assert_deallocated(func: Callable[_Tss, _T], *args: _Tss.args, **kwargs: _Tss.kwargs) -> _GeneratorContextManager[_T]: ... |
Empty file.
Oops, something went wrong.