Skip to content

Commit

Permalink
feat: add function stubs (no implementations yet). (#3)
Browse files Browse the repository at this point in the history
* feat: add function stubs (no implementations yet).

* empty

* empty_like, eye, from_dlpack, full, full_like, linspace, meshgrid

* ones, ones_like, tril, triu, zeros, zeros_like

* Data type functions: astype.

* can_cast, finfo, iinfo, isdtype, result_type

* All the elementwise functions.

* Made stub files for the rest; not done yet.

* Stubbed all remaining functions in ragged.common.

* Done with all function stubs.
  • Loading branch information
jpivarski authored Dec 28, 2023
1 parent 4bfc829 commit 62594fc
Show file tree
Hide file tree
Showing 31 changed files with 4,476 additions and 102 deletions.
5 changes: 5 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,9 @@ ignore = [
"ISC001", # Conflicts with formatter
"RET505", # I like my if (return) elif (return) else (return) pattern
"PLR5501", # I like my if (return) elif (return) else (return) pattern

"PT015", # I'm using `assert False` for not-implemented FIXMEs
"B011", # (can't use NotImplementedError because it's used to incidate abstract methods)
]
isort.required-imports = ["from __future__ import annotations"]
# Uncomment if using a _compat.typing backport
Expand All @@ -170,4 +173,6 @@ messages_control.disable = [
"missing-class-docstring",
"missing-function-docstring",
"R1705", # I like my if (return) elif (return) else (return) pattern
"R0801", # Different files can have similar lines; that's okay
"C0302", # I can have as many lines as I want; what's it with you?
]
2 changes: 1 addition & 1 deletion src/ragged/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@

from __future__ import annotations

from .v202212 import * # noqa: F403
from .v202212 import * # noqa: F403 # pylint: disable=W0622
268 changes: 267 additions & 1 deletion src/ragged/common/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,272 @@

from __future__ import annotations

from ._creation import (
arange,
asarray,
empty,
empty_like,
eye,
from_dlpack,
full,
full_like,
linspace,
meshgrid,
ones,
ones_like,
tril,
triu,
zeros,
zeros_like,
)
from ._datatype import (
astype,
can_cast,
finfo,
iinfo,
isdtype,
result_type,
)
from ._elementwise import ( # pylint: disable=W0622
abs,
acos,
acosh,
add,
asin,
asinh,
atan,
atan2,
atanh,
bitwise_and,
bitwise_invert,
bitwise_left_shift,
bitwise_or,
bitwise_right_shift,
bitwise_xor,
ceil,
conj,
cos,
cosh,
divide,
equal,
exp,
expm1,
floor,
floor_divide,
greater,
greater_equal,
imag,
isfinite,
isinf,
isnan,
less,
less_equal,
log,
log1p,
log2,
log10,
logaddexp,
logical_and,
logical_not,
logical_or,
logical_xor,
multiply,
negative,
not_equal,
positive,
pow,
real,
remainder,
round,
sign,
sin,
sinh,
sqrt,
square,
subtract,
tan,
tanh,
trunc,
)
from ._indexing import (
take,
)
from ._linalg import (
matmul,
matrix_transpose,
tensordot,
vecdot,
)
from ._manipulation import (
broadcast_arrays,
broadcast_to,
concat,
expand_dims,
flip,
permute_dims,
reshape,
roll,
squeeze,
stack,
)
from ._obj import array
from ._search import (
argmax,
argmin,
nonzero,
where,
)
from ._set import (
unique_all,
unique_counts,
unique_inverse,
unique_values,
)
from ._sorting import (
argsort,
sort,
)
from ._statistical import ( # pylint: disable=W0622
max,
mean,
min,
prod,
std,
sum,
var,
)
from ._utility import ( # pylint: disable=W0622
all,
any,
)

__all__ = ["array"]
__all__ = [
# _creation
"arange",
"asarray",
"empty",
"empty_like",
"eye",
"from_dlpack",
"full",
"full_like",
"linspace",
"meshgrid",
"ones",
"ones_like",
"tril",
"triu",
"zeros",
"zeros_like",
# _datatype
"astype",
"can_cast",
"finfo",
"iinfo",
"isdtype",
"result_type",
# _elementwise
"abs",
"acos",
"acosh",
"add",
"asin",
"asinh",
"atan",
"atan2",
"atanh",
"bitwise_and",
"bitwise_left_shift",
"bitwise_invert",
"bitwise_or",
"bitwise_right_shift",
"bitwise_xor",
"ceil",
"conj",
"cos",
"cosh",
"divide",
"equal",
"exp",
"expm1",
"floor",
"floor_divide",
"greater",
"greater_equal",
"imag",
"isfinite",
"isinf",
"isnan",
"less",
"less_equal",
"log",
"log1p",
"log2",
"log10",
"logaddexp",
"logical_and",
"logical_not",
"logical_or",
"logical_xor",
"multiply",
"negative",
"not_equal",
"positive",
"pow",
"real",
"remainder",
"round",
"sign",
"sin",
"sinh",
"square",
"sqrt",
"subtract",
"tan",
"tanh",
"trunc",
# _indexing
"take",
# _linalg
"matmul",
"matrix_transpose",
"tensordot",
"vecdot",
# _manipulation
"broadcast_arrays",
"broadcast_to",
"concat",
"expand_dims",
"flip",
"permute_dims",
"reshape",
"roll",
"squeeze",
"stack",
# _obj
"array",
# _search
"argmax",
"argmin",
"nonzero",
"where",
# _set
"unique_all",
"unique_counts",
"unique_inverse",
"unique_values",
# _sorting
"argsort",
"sort",
# _statistical
"max",
"mean",
"min",
"prod",
"std",
"sum",
"var",
# _utility
"all",
"any",
]
2 changes: 1 addition & 1 deletion src/ragged/common/_const.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# BSD 3-Clause License; see https://github.com/scikit-hep/ragged/blob/main/LICENSE

"""
https://data-apis.org/array-api/latest/API_specification/constants.html
https://data-apis.org/array-api/latest/API_specification/creation_functions.html
"""

from __future__ import annotations
Expand Down
Loading

0 comments on commit 62594fc

Please sign in to comment.