Skip to content

Commit

Permalink
refactor: organize submodules and tests by spec. (#4)
Browse files Browse the repository at this point in the history
* refactor: organize submodules and tests by spec.

* Rename submodules to match test file names.

* Adjust for new names.
  • Loading branch information
jpivarski authored Dec 28, 2023
1 parent 62594fc commit 09b1df1
Show file tree
Hide file tree
Showing 45 changed files with 372 additions and 136 deletions.
63 changes: 38 additions & 25 deletions src/ragged/common/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,15 @@

from __future__ import annotations

from ._creation import (
from ._spec_array_object import array
from ._spec_constants import (
e,
inf,
nan,
newaxis,
pi,
)
from ._spec_creation_functions import (
arange,
asarray,
empty,
Expand All @@ -27,15 +35,15 @@
zeros,
zeros_like,
)
from ._datatype import (
from ._spec_data_type_functions import (
astype,
can_cast,
finfo,
iinfo,
isdtype,
result_type,
)
from ._elementwise import ( # pylint: disable=W0622
from ._spec_elementwise_functions import ( # pylint: disable=W0622
abs,
acos,
acosh,
Expand Down Expand Up @@ -96,16 +104,16 @@
tanh,
trunc,
)
from ._indexing import (
from ._spec_indexing_functions import (
take,
)
from ._linalg import (
from ._spec_linear_algebra_functions import (
matmul,
matrix_transpose,
tensordot,
vecdot,
)
from ._manipulation import (
from ._spec_manipulation_functions import (
broadcast_arrays,
broadcast_to,
concat,
Expand All @@ -117,24 +125,23 @@
squeeze,
stack,
)
from ._obj import array
from ._search import (
from ._spec_searching_functions import (
argmax,
argmin,
nonzero,
where,
)
from ._set import (
from ._spec_set_functions import (
unique_all,
unique_counts,
unique_inverse,
unique_values,
)
from ._sorting import (
from ._spec_sorting_functions import (
argsort,
sort,
)
from ._statistical import ( # pylint: disable=W0622
from ._spec_statistical_functions import ( # pylint: disable=W0622
max,
mean,
min,
Expand All @@ -143,13 +150,21 @@
sum,
var,
)
from ._utility import ( # pylint: disable=W0622
from ._spec_utility_functions import ( # pylint: disable=W0622
all,
any,
)

__all__ = [
# _creation
# _spec_array_object
"array",
# _spec_constants
"e",
"inf",
"nan",
"newaxis",
"pi",
# _spec_creation_functions
"arange",
"asarray",
"empty",
Expand All @@ -166,14 +181,14 @@
"triu",
"zeros",
"zeros_like",
# _datatype
# _spec_data_type_functions
"astype",
"can_cast",
"finfo",
"iinfo",
"isdtype",
"result_type",
# _elementwise
# _spec_elementwise_functions
"abs",
"acos",
"acosh",
Expand Down Expand Up @@ -233,14 +248,14 @@
"tan",
"tanh",
"trunc",
# _indexing
# _spec_indexing_functions
"take",
# _linalg
# _spec_linear_algebra_functions
"matmul",
"matrix_transpose",
"tensordot",
"vecdot",
# _manipulation
# _spec_manipulation_functions
"broadcast_arrays",
"broadcast_to",
"concat",
Expand All @@ -251,30 +266,28 @@
"roll",
"squeeze",
"stack",
# _obj
"array",
# _search
# _spec_searching_functions
"argmax",
"argmin",
"nonzero",
"where",
# _set
# _spec_set_functions
"unique_all",
"unique_counts",
"unique_inverse",
"unique_values",
# _sorting
# _spec_sorting_functions
"argsort",
"sort",
# _statistical
# _spec_statistical_functions
"max",
"mean",
"min",
"prod",
"std",
"sum",
"var",
# _utility
# _spec_utility_functions
"all",
"any",
]
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import awkward as ak

from ._obj import array
from ._spec_array_object import array
from ._typing import (
Device,
Dtype,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

import numpy as np

from ._obj import array
from ._spec_array_object import array
from ._typing import Dtype


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

from __future__ import annotations

from ._obj import array
from ._spec_array_object import array


def abs(x: array, /) -> array: # pylint: disable=W0622
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

from __future__ import annotations

from ._obj import array
from ._spec_array_object import array


def take(x: array, indices: array, /, *, axis: None | int = None) -> array:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

from collections.abc import Sequence

from ._obj import array
from ._spec_array_object import array


def matmul(x1: array, x2: array, /) -> array:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

from __future__ import annotations

from ._obj import array
from ._spec_array_object import array


def broadcast_arrays(*arrays: array) -> list[array]:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

from __future__ import annotations

from ._obj import array
from ._spec_array_object import array


def argmax(x: array, /, *, axis: None | int = None, keepdims: bool = False) -> array:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

from collections import namedtuple

from ._obj import array
from ._spec_array_object import array

unique_all_result = namedtuple( # pylint: disable=C0103
"unique_all_result", ["values", "indices", "inverse_indices", "counts"]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

from __future__ import annotations

from ._obj import array
from ._spec_array_object import array


def argsort(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

from __future__ import annotations

from ._obj import array
from ._spec_array_object import array
from ._typing import Dtype


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

from __future__ import annotations

from ._obj import array
from ._spec_array_object import array


def all( # pylint: disable=W0622
Expand Down
Loading

0 comments on commit 09b1df1

Please sign in to comment.