PHP 8.2.30
Preview: einsumfunc.pyi Size: 4.75 KB
/opt/cloudlinux/venv/lib/python3.11/site-packages/numpy/core/einsumfunc.pyi

from collections.abc import Sequence
from typing import TypeVar, Any, overload, Union, Literal

from numpy import (
    ndarray,
    dtype,
    bool_,
    number,
    _OrderKACF,
)
from numpy._typing import (
    _ArrayLikeBool_co,
    _ArrayLikeUInt_co,
    _ArrayLikeInt_co,
    _ArrayLikeFloat_co,
    _ArrayLikeComplex_co,
    _ArrayLikeObject_co,
    _DTypeLikeBool,
    _DTypeLikeUInt,
    _DTypeLikeInt,
    _DTypeLikeFloat,
    _DTypeLikeComplex,
    _DTypeLikeComplex_co,
    _DTypeLikeObject,
)

_ArrayType = TypeVar(
    "_ArrayType",
    bound=ndarray[Any, dtype[Union[bool_, number[Any]]]],
)

_OptimizeKind = None | bool | Literal["greedy", "optimal"] | Sequence[Any]
_CastingSafe = Literal["no", "equiv", "safe", "same_kind"]
_CastingUnsafe = Literal["unsafe"]

__all__: list[str]

# TODO: Properly handle the `casting`-based combinatorics
# TODO: We need to evaluate the content `__subscripts` in order
# to identify whether or an array or scalar is returned. At a cursory
# glance this seems like something that can quite easily be done with
# a mypy plugin.
# Something like `is_scalar = bool(__subscripts.partition("->")[-1])`
@overload
def einsum(
    subscripts: str | _ArrayLikeInt_co,
    /,
    *operands: _ArrayLikeBool_co,
    out: None = ...,
    dtype: None | _DTypeLikeBool = ...,
    order: _OrderKACF = ...,
    casting: _CastingSafe = ...,
    optimize: _OptimizeKind = ...,
) -> Any: ...
@overload
def einsum(
    subscripts: str | _ArrayLikeInt_co,
    /,
    *operands: _ArrayLikeUInt_co,
    out: None = ...,
    dtype: None | _DTypeLikeUInt = ...,
    order: _OrderKACF = ...,
    casting: _CastingSafe = ...,
    optimize: _OptimizeKind = ...,
) -> Any: ...
@overload
def einsum(
    subscripts: str | _ArrayLikeInt_co,
    /,
    *operands: _ArrayLikeInt_co,
    out: None = ...,
    dtype: None | _DTypeLikeInt = ...,
    order: _OrderKACF = ...,
    casting: _CastingSafe = ...,
    optimize: _OptimizeKind = ...,
) -> Any: ...
@overload
def einsum(
    subscripts: str | _ArrayLikeInt_co,
    /,
    *operands: _ArrayLikeFloat_co,
    out: None = ...,
    dtype: None | _DTypeLikeFloat = ...,
    order: _OrderKACF = ...,
    casting: _CastingSafe = ...,
    optimize: _OptimizeKind = ...,
) -> Any: ...
@overload
def einsum(
    subscripts: str | _ArrayLikeInt_co,
    /,
    *operands: _ArrayLikeComplex_co,
    out: None = ...,
    dtype: None | _DTypeLikeComplex = ...,
    order: _OrderKACF = ...,
    casting: _CastingSafe = ...,
    optimize: _OptimizeKind = ...,
) -> Any: ...
@overload
def einsum(
    subscripts: str | _ArrayLikeInt_co,
    /,
    *operands: Any,
    casting: _CastingUnsafe,
    dtype: None | _DTypeLikeComplex_co = ...,
    out: None = ...,
    order: _OrderKACF = ...,
    optimize: _OptimizeKind = ...,
) -> Any: ...
@overload
def einsum(
    subscripts: str | _ArrayLikeInt_co,
    /,
    *operands: _ArrayLikeComplex_co,
    out: _ArrayType,
    dtype: None | _DTypeLikeComplex_co = ...,
    order: _OrderKACF = ...,
    casting: _CastingSafe = ...,
    optimize: _OptimizeKind = ...,
) -> _ArrayType: ...
@overload
def einsum(
    subscripts: str | _ArrayLikeInt_co,
    /,
    *operands: Any,
    out: _ArrayType,
    casting: _CastingUnsafe,
    dtype: None | _DTypeLikeComplex_co = ...,
    order: _OrderKACF = ...,
    optimize: _OptimizeKind = ...,
) -> _ArrayType: ...

@overload
def einsum(
    subscripts: str | _ArrayLikeInt_co,
    /,
    *operands: _ArrayLikeObject_co,
    out: None = ...,
    dtype: None | _DTypeLikeObject = ...,
    order: _OrderKACF = ...,
    casting: _CastingSafe = ...,
    optimize: _OptimizeKind = ...,
) -> Any: ...
@overload
def einsum(
    subscripts: str | _ArrayLikeInt_co,
    /,
    *operands: Any,
    casting: _CastingUnsafe,
    dtype: None | _DTypeLikeObject = ...,
    out: None = ...,
    order: _OrderKACF = ...,
    optimize: _OptimizeKind = ...,
) -> Any: ...
@overload
def einsum(
    subscripts: str | _ArrayLikeInt_co,
    /,
    *operands: _ArrayLikeObject_co,
    out: _ArrayType,
    dtype: None | _DTypeLikeObject = ...,
    order: _OrderKACF = ...,
    casting: _CastingSafe = ...,
    optimize: _OptimizeKind = ...,
) -> _ArrayType: ...
@overload
def einsum(
    subscripts: str | _ArrayLikeInt_co,
    /,
    *operands: Any,
    out: _ArrayType,
    casting: _CastingUnsafe,
    dtype: None | _DTypeLikeObject = ...,
    order: _OrderKACF = ...,
    optimize: _OptimizeKind = ...,
) -> _ArrayType: ...

# NOTE: `einsum_call` is a hidden kwarg unavailable for public use.
# It is therefore excluded from the signatures below.
# NOTE: In practice the list consists of a `str` (first element)
# and a variable number of integer tuples.
def einsum_path(
    subscripts: str | _ArrayLikeInt_co,
    /,
    *operands: _ArrayLikeComplex_co | _DTypeLikeObject,
    optimize: _OptimizeKind = ...,
) -> tuple[list[Any], str]: ...

Directory Contents

Dirs: 4 × Files: 56

Name Size Perms Modified Actions
include DIR
- drwxr-xr-x 2026-01-20 13:01:48
Edit Download
lib DIR
- drwxr-xr-x 2026-02-06 08:01:08
Edit Download
tests DIR
- drwxr-xr-x 2026-02-06 08:01:08
Edit Download
- drwxr-xr-x 2026-02-06 08:07:28
Edit Download
62.12 KB lrw-r--r-- 2026-01-20 13:01:47
Edit Download
4.32 KB lrw-r--r-- 2026-01-20 13:01:47
Edit Download
347 B lrw-r--r-- 2026-01-20 13:01:47
Edit Download
71.89 KB lrw-r--r-- 2026-01-20 13:01:47
Edit Download
9.00 KB lrw-r--r-- 2026-01-20 13:01:47
Edit Download
50.65 KB lrw-r--r-- 2026-01-20 13:01:47
Edit Download
4.75 KB lrw-r--r-- 2026-01-20 13:01:47
Edit Download
125.80 KB lrw-r--r-- 2026-01-20 13:01:47
Edit Download
22.96 KB lrw-r--r-- 2026-01-20 13:01:47
Edit Download
19.37 KB lrw-r--r-- 2026-01-20 13:01:47
Edit Download
4.61 KB lrw-r--r-- 2026-01-20 13:01:47
Edit Download
7.47 KB lrw-r--r-- 2026-01-20 13:01:47
Edit Download
25.26 KB lrw-r--r-- 2026-01-20 13:01:47
Edit Download
82 B lrw-r--r-- 2026-01-20 13:01:47
Edit Download
11.50 KB lrw-r--r-- 2026-01-20 13:01:47
Edit Download
55 B lrw-r--r-- 2026-01-20 13:01:47
Edit Download
54.78 KB lrw-r--r-- 2026-01-20 13:01:47
Edit Download
24.19 KB lrw-r--r-- 2026-01-20 13:01:47
Edit Download
75.21 KB lrw-r--r-- 2026-01-20 13:01:47
Edit Download
13.90 KB lrw-r--r-- 2026-01-20 13:01:47
Edit Download
17.67 KB lrw-r--r-- 2026-01-20 13:01:47
Edit Download
3.19 KB lrw-r--r-- 2026-01-20 13:01:47
Edit Download
6.93 KB lrw-r--r-- 2026-01-20 13:01:47
Edit Download
36.65 KB lrw-r--r-- 2026-01-20 13:01:47
Edit Download
5.56 KB lrw-r--r-- 2026-01-20 13:01:47
Edit Download
47.05 KB lrw-r--r-- 2026-01-20 13:01:47
Edit Download
16.68 KB lrw-r--r-- 2026-01-20 13:01:47
Edit Download
29.05 KB lrw-r--r-- 2026-01-20 13:01:47
Edit Download
2.71 KB lrw-r--r-- 2026-01-20 13:01:47
Edit Download
1.99 KB lrw-r--r-- 2026-01-20 13:01:47
Edit Download
389 B lrw-r--r-- 2026-01-20 13:01:47
Edit Download
204.07 KB lrw-r--r-- 2026-01-20 13:01:47
Edit Download
11.82 KB lrw-r--r-- 2026-01-20 13:01:47
Edit Download
3.79 KB lrw-r--r-- 2026-01-20 13:01:47
Edit Download
1.06 KB lrw-r--r-- 2026-01-20 13:01:47
Edit Download
10.36 KB lrw-r--r-- 2026-01-20 13:01:47
Edit Download
3.59 KB lrw-r--r-- 2026-01-20 13:01:47
Edit Download
5.25 KB lrw-r--r-- 2026-01-20 13:01:47
Edit Download
27.68 KB lrw-r--r-- 2026-01-20 13:01:47
Edit Download
1.01 KB lrw-r--r-- 2026-01-20 13:01:47
Edit Download
11.29 KB lrw-r--r-- 2026-01-20 13:01:47
Edit Download
8.41 KB lrw-r--r-- 2026-01-20 13:01:47
Edit Download
171.40 KB lrwxr-xr-x 2026-01-20 13:18:47
Edit Download
6.64 MB lrwxr-xr-x 2026-01-20 13:18:47
Edit Download
16.55 KB lrwxr-xr-x 2026-01-20 13:18:47
Edit Download
58.29 KB lrwxr-xr-x 2026-01-20 13:18:47
Edit Download
2.47 MB lrwxr-xr-x 2026-01-20 13:18:47
Edit Download
2.79 KB lrw-r--r-- 2026-01-20 13:01:47
Edit Download
16.65 KB lrwxr-xr-x 2026-01-20 13:18:47
Edit Download
7.36 KB lrw-r--r-- 2026-01-20 13:01:47
Edit Download
404 B lrw-r--r-- 2026-01-20 13:01:47
Edit Download
13.62 KB lrw-r--r-- 2026-01-20 13:01:47
Edit Download
1.04 KB lrw-r--r-- 2026-01-20 13:01:47
Edit Download
41.01 KB lrwxr-xr-x 2026-01-20 13:18:47
Edit Download
5.64 KB lrw-r--r-- 2026-01-20 13:01:47
Edit Download
126 B lrw-r--r-- 2026-01-20 13:01:47
Edit Download

If ZipArchive is unavailable, a .tar will be created (no compression).