Skip to content

Commit

Permalink
do something with no errors
Browse files Browse the repository at this point in the history
  • Loading branch information
jpivarski committed Dec 26, 2023
1 parent 651e781 commit c1dea84
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 9 deletions.
6 changes: 4 additions & 2 deletions src/ragged/api_2022_12/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,7 @@
from ..common import array as common_array


class array(common_array):
pass
class array(common_array): # pylint: disable=C0103
"""
Ragged array class and constructor for data-apis.org/array-api/2022.12.
"""
10 changes: 8 additions & 2 deletions src/ragged/common/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@
from ._typing import Device, Dtype, NestedSequence, SupportsDLPack


class array:
class array: # pylint: disable=C0103
"""
Ragged array class and constructor.
"""

def __init__(
self,
array_like: (
Expand All @@ -22,4 +26,6 @@ def __init__(
dtype: None | Dtype = None,
device: None | Device = None,
):
...
assert array_like is not None
assert dtype is None
assert device is None
12 changes: 10 additions & 2 deletions src/ragged/common/_typing.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@


class NestedSequence(Protocol[T_co]):
"""
Python list of list of ... some type.
"""

def __getitem__(self, key: int, /) -> T_co | NestedSequence[T_co]:
...

Expand All @@ -25,14 +29,18 @@ def __len__(self, /) -> int:


class SupportsDLPack(Protocol):
"""
Array type that supports DLPack.
"""

def __dlpack__(self, /, *, stream: None = ...) -> PyCapsule:
...


Device = Union[Literal["cpu"], Literal["cuda"]]

Dtype = np.dtype[
(
Union[
np.int8,
np.int16,
np.int32,
Expand All @@ -43,5 +51,5 @@ def __dlpack__(self, /, *, stream: None = ...) -> PyCapsule:
np.uint64,
np.float32,
np.float64,
)
]
]
7 changes: 4 additions & 3 deletions tests/test_0001_initial_array_object.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@

from __future__ import annotations

# import ragged
import ragged


# def test():
# a = ragged.array([1, 2, 3])
def test():
a = ragged.array([1, 2, "hello", 3])
assert a is not None

0 comments on commit c1dea84

Please sign in to comment.