feat: add Camera Work AI package
This commit is contained in:
@@ -0,0 +1,7 @@
|
||||
This directory contains bundled external dependencies that are updated
|
||||
every once in a while.
|
||||
|
||||
Note for distribution packagers: if you want to remove the duplicated
|
||||
code and depend on a packaged version, we suggest that you simply do a
|
||||
symbolic link in this directory.
|
||||
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2022 Consortium for Python Data API Standards
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
+1
@@ -0,0 +1 @@
|
||||
Update this directory using maint_tools/vendor_array_api_compat.sh
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2024 Consortium for Python Data API Standards
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
+1
@@ -0,0 +1 @@
|
||||
Update this directory using maint_tools/vendor_array_api_extra.sh
|
||||
Vendored
+40
@@ -0,0 +1,40 @@
|
||||
"""Static type stubs for `_compat.py`."""
|
||||
|
||||
# https://github.com/scikit-learn/scikit-learn/pull/27910#issuecomment-2568023972
|
||||
from __future__ import annotations
|
||||
|
||||
from types import ModuleType
|
||||
|
||||
# TODO import from typing (requires Python >=3.13)
|
||||
from typing_extensions import TypeIs
|
||||
|
||||
from ._typing import Array, Device
|
||||
|
||||
# pylint: disable=missing-class-docstring,unused-argument
|
||||
|
||||
class Namespace(ModuleType):
|
||||
def device(self, x: Array, /) -> Device: ...
|
||||
|
||||
def array_namespace(
|
||||
*xs: Array | complex | None,
|
||||
api_version: str | None = None,
|
||||
use_compat: bool | None = None,
|
||||
) -> Namespace: ...
|
||||
def device(x: Array, /) -> Device: ...
|
||||
def is_array_api_obj(x: object, /) -> TypeIs[Array]: ...
|
||||
def is_array_api_strict_namespace(xp: ModuleType, /) -> TypeIs[Namespace]: ...
|
||||
def is_cupy_namespace(xp: ModuleType, /) -> TypeIs[Namespace]: ...
|
||||
def is_dask_namespace(xp: ModuleType, /) -> TypeIs[Namespace]: ...
|
||||
def is_jax_namespace(xp: ModuleType, /) -> TypeIs[Namespace]: ...
|
||||
def is_numpy_namespace(xp: ModuleType, /) -> TypeIs[Namespace]: ...
|
||||
def is_pydata_sparse_namespace(xp: ModuleType, /) -> TypeIs[Namespace]: ...
|
||||
def is_torch_namespace(xp: ModuleType, /) -> TypeIs[Namespace]: ...
|
||||
def is_cupy_array(x: object, /) -> TypeIs[Array]: ...
|
||||
def is_dask_array(x: object, /) -> TypeIs[Array]: ...
|
||||
def is_jax_array(x: object, /) -> TypeIs[Array]: ...
|
||||
def is_numpy_array(x: object, /) -> TypeIs[Array]: ...
|
||||
def is_pydata_sparse_array(x: object, /) -> TypeIs[Array]: ...
|
||||
def is_torch_array(x: object, /) -> TypeIs[Array]: ...
|
||||
def is_lazy_array(x: object, /) -> TypeIs[Array]: ...
|
||||
def is_writeable_array(x: object, /) -> TypeIs[Array]: ...
|
||||
def size(x: Array, /) -> int | None: ...
|
||||
Vendored
+105
@@ -0,0 +1,105 @@
|
||||
"""Static typing helpers."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from types import EllipsisType
|
||||
from typing import Protocol, TypeAlias
|
||||
|
||||
# TODO import from typing (requires Python >=3.12)
|
||||
from typing_extensions import override
|
||||
|
||||
# TODO: use array-api-typing once it is available
|
||||
|
||||
class Array(Protocol): # pylint: disable=missing-class-docstring
|
||||
# Unary operations
|
||||
def __abs__(self) -> Array: ...
|
||||
def __pos__(self) -> Array: ...
|
||||
def __neg__(self) -> Array: ...
|
||||
def __invert__(self) -> Array: ...
|
||||
# Binary operations
|
||||
def __add__(self, other: Array | complex, /) -> Array: ...
|
||||
def __sub__(self, other: Array | complex, /) -> Array: ...
|
||||
def __mul__(self, other: Array | complex, /) -> Array: ...
|
||||
def __truediv__(self, other: Array | complex, /) -> Array: ...
|
||||
def __floordiv__(self, other: Array | complex, /) -> Array: ...
|
||||
def __mod__(self, other: Array | complex, /) -> Array: ...
|
||||
def __pow__(self, other: Array | complex, /) -> Array: ...
|
||||
def __matmul__(self, other: Array, /) -> Array: ...
|
||||
def __and__(self, other: Array | int, /) -> Array: ...
|
||||
def __or__(self, other: Array | int, /) -> Array: ...
|
||||
def __xor__(self, other: Array | int, /) -> Array: ...
|
||||
def __lshift__(self, other: Array | int, /) -> Array: ...
|
||||
def __rshift__(self, other: Array | int, /) -> Array: ...
|
||||
def __lt__(self, other: Array | complex, /) -> Array: ...
|
||||
def __le__(self, other: Array | complex, /) -> Array: ...
|
||||
def __gt__(self, other: Array | complex, /) -> Array: ...
|
||||
def __ge__(self, other: Array | complex, /) -> Array: ...
|
||||
@override
|
||||
def __eq__(self, other: Array | complex, /) -> Array: ... # type: ignore[override] # pyright: ignore[reportIncompatibleMethodOverride]
|
||||
@override
|
||||
def __ne__(self, other: Array | complex, /) -> Array: ... # type: ignore[override] # pyright: ignore[reportIncompatibleMethodOverride]
|
||||
# Reflected operations
|
||||
def __radd__(self, other: Array | complex, /) -> Array: ...
|
||||
def __rsub__(self, other: Array | complex, /) -> Array: ...
|
||||
def __rmul__(self, other: Array | complex, /) -> Array: ...
|
||||
def __rtruediv__(self, other: Array | complex, /) -> Array: ...
|
||||
def __rfloordiv__(self, other: Array | complex, /) -> Array: ...
|
||||
def __rmod__(self, other: Array | complex, /) -> Array: ...
|
||||
def __rpow__(self, other: Array | complex, /) -> Array: ...
|
||||
def __rmatmul__(self, other: Array, /) -> Array: ...
|
||||
def __rand__(self, other: Array | int, /) -> Array: ...
|
||||
def __ror__(self, other: Array | int, /) -> Array: ...
|
||||
def __rxor__(self, other: Array | int, /) -> Array: ...
|
||||
def __rlshift__(self, other: Array | int, /) -> Array: ...
|
||||
def __rrshift__(self, other: Array | int, /) -> Array: ...
|
||||
# Attributes
|
||||
@property
|
||||
def dtype(self) -> DType: ...
|
||||
@property
|
||||
def device(self) -> Device: ...
|
||||
@property
|
||||
def mT(self) -> Array: ... # pylint: disable=invalid-name
|
||||
@property
|
||||
def ndim(self) -> int: ...
|
||||
@property
|
||||
def shape(self) -> tuple[int | None, ...]: ...
|
||||
@property
|
||||
def size(self) -> int | None: ...
|
||||
@property
|
||||
def T(self) -> Array: ... # pylint: disable=invalid-name
|
||||
# Collection operations (note: an Array does not have to be Sized or Iterable)
|
||||
def __getitem__(self, key: GetIndex, /) -> Array: ...
|
||||
def __setitem__(self, key: SetIndex, value: Array | complex, /) -> None: ...
|
||||
# Materialization methods (may raise on lazy arrays)
|
||||
def __bool__(self) -> bool: ...
|
||||
def __complex__(self) -> complex: ...
|
||||
def __float__(self) -> float: ...
|
||||
def __index__(self) -> int: ...
|
||||
def __int__(self) -> int: ...
|
||||
|
||||
# Misc methods (frequently not implemented in Arrays wrapped by array-api-compat)
|
||||
# def __array_namespace__(*, api_version: str | None) -> ModuleType: ...
|
||||
# def __dlpack__(
|
||||
# *,
|
||||
# stream: int | Any | None = None,
|
||||
# max_version: tuple[int, int] | None = None,
|
||||
# dl_device: tuple[int, int] | None = None, # tuple[Enum, int]
|
||||
# copy: bool | None = None,
|
||||
# ) -> Any: ...
|
||||
# def __dlpack_device__() -> tuple[int, int]: ... # tuple[Enum, int]
|
||||
# def to_device(device: Device, /, *, stream: int | Any | None = None) -> Array: ...
|
||||
|
||||
class DType(Protocol): # pylint: disable=missing-class-docstring
|
||||
pass
|
||||
|
||||
class Device(Protocol): # pylint: disable=missing-class-docstring
|
||||
pass
|
||||
|
||||
SetIndex: TypeAlias = ( # type: ignore[explicit-any]
|
||||
int | slice | EllipsisType | Array | tuple[int | slice | EllipsisType | Array, ...]
|
||||
)
|
||||
GetIndex: TypeAlias = ( # type: ignore[explicit-any]
|
||||
SetIndex | None | tuple[int | slice | EllipsisType | None | Array, ...]
|
||||
)
|
||||
|
||||
__all__ = ["Array", "DType", "Device", "GetIndex", "SetIndex"]
|
||||
Reference in New Issue
Block a user