-
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.
feat: initial array object implementation
- Loading branch information
Showing
7 changed files
with
103 additions
and
17 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,8 @@ | ||
""" | ||
Copyright (c) 2023 Jim Pivarski. All rights reserved. | ||
ragged: Ragged array library, complying with Python API specification. | ||
""" | ||
|
||
# BSD 3-Clause License; see https://github.com/scikit-hep/ragged/blob/main/LICENSE | ||
|
||
from __future__ import annotations | ||
|
||
from ._version import version as __version__ | ||
from .api_2022_12 import array | ||
|
||
__all__ = ["__version__"] | ||
__all__ = ["array", "__version__"] |
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 |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# BSD 3-Clause License; see https://github.com/scikit-hep/ragged/blob/main/LICENSE | ||
|
||
from __future__ import annotations | ||
|
||
from ..common import array as common_array | ||
|
||
|
||
class array(common_array): | ||
pass |
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 |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# BSD 3-Clause License; see https://github.com/scikit-hep/ragged/blob/main/LICENSE | ||
|
||
from __future__ import annotations | ||
|
||
import awkward as ak | ||
|
||
from ._typing import Device, Dtype, NestedSequence, SupportsDLPack | ||
|
||
|
||
class array: | ||
def __init__( | ||
self, | ||
array_like: ( | ||
array | ||
| ak.Array | ||
| SupportsDLPack | ||
| bool | ||
| int | ||
| float | ||
| NestedSequence[bool | int | float] | ||
), | ||
dtype: None | Dtype = None, | ||
device: None | Device = None, | ||
): | ||
... |
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 |
---|---|---|
@@ -0,0 +1,47 @@ | ||
# BSD 3-Clause License; see https://github.com/scikit-hep/ragged/blob/main/LICENSE | ||
|
||
from __future__ import annotations | ||
|
||
import warnings | ||
from typing import Any, Literal, Protocol, TypeVar, Union | ||
|
||
import numpy as np | ||
|
||
with warnings.catch_warnings(): | ||
warnings.simplefilter("ignore") | ||
|
||
T_co = TypeVar("T_co", covariant=True) | ||
|
||
|
||
class NestedSequence(Protocol[T_co]): | ||
def __getitem__(self, key: int, /) -> T_co | NestedSequence[T_co]: | ||
... | ||
|
||
def __len__(self, /) -> int: | ||
... | ||
|
||
|
||
PyCapsule = Any | ||
|
||
|
||
class SupportsDLPack(Protocol): | ||
def __dlpack__(self, /, *, stream: None = ...) -> PyCapsule: | ||
... | ||
|
||
|
||
Device = Union[Literal["cpu"], Literal["cuda"]] | ||
|
||
Dtype = np.dtype[ | ||
( | ||
np.int8, | ||
np.int16, | ||
np.int32, | ||
np.int64, | ||
np.uint8, | ||
np.uint16, | ||
np.uint32, | ||
np.uint64, | ||
np.float32, | ||
np.float64, | ||
) | ||
] |
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 |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# BSD 3-Clause License; see https://github.com/scikit-hep/ragged/blob/main/LICENSE | ||
|
||
from __future__ import annotations | ||
|
||
# import ragged | ||
|
||
|
||
# def test(): | ||
# a = ragged.array([1, 2, 3]) |
This file was deleted.
Oops, something went wrong.