From 5450963b47001d00c35c10afbe97d3b423c71f4b Mon Sep 17 00:00:00 2001 From: ajpotts Date: Wed, 21 Aug 2024 14:50:48 -0400 Subject: [PATCH] Closes #3353 reference numpy functions without alias (#3662) Co-authored-by: Amanda Potts --- arkouda/__init__.py | 2 +- arkouda/alignment.py | 8 +- arkouda/array_api/creation_functions.py | 4 +- arkouda/array_api/statistical_functions.py | 2 +- arkouda/array_view.py | 2 +- arkouda/categorical.py | 8 +- arkouda/client_dtypes.py | 4 +- arkouda/dataframe.py | 10 +- arkouda/dtypes/__init__.py | 3 + arkouda/groupbyclass.py | 14 +-- arkouda/index.py | 10 +- arkouda/io.py | 2 +- arkouda/join.py | 6 +- arkouda/matcher.py | 2 +- arkouda/message.py | 2 +- arkouda/numeric.py | 10 +- arkouda/numpy/__init__.py | 119 +-------------------- arkouda/numpy/_numeric.py | 2 +- arkouda/numpy/dtypes/__init__.py | 38 +++++++ arkouda/{ => numpy/dtypes}/dtypes.py | 88 ++++++++------- arkouda/pdarrayclass.py | 20 ++-- arkouda/pdarraycreation.py | 12 +-- arkouda/pdarraysetops.py | 10 +- arkouda/random/_generator.py | 14 +-- arkouda/random/_legacy.py | 8 +- arkouda/scipy/_stats_py.py | 2 +- arkouda/segarray.py | 8 +- arkouda/series.py | 2 +- arkouda/sorting.py | 2 +- arkouda/strings.py | 14 +-- arkouda/timeclass.py | 2 +- arkouda/util.py | 2 +- benchmarks/stream.py | 2 +- pydoc/preprocess/generate_import_stubs.py | 3 +- pytest.ini | 2 +- tests/index_test.py | 4 +- tests/{ => numpy}/dtypes_test.py | 4 +- 37 files changed, 197 insertions(+), 250 deletions(-) create mode 100644 arkouda/dtypes/__init__.py rename arkouda/{ => numpy/dtypes}/dtypes.py (94%) rename tests/{ => numpy}/dtypes_test.py (98%) diff --git a/arkouda/__init__.py b/arkouda/__init__.py index bd6a44ead3..c639950b7c 100644 --- a/arkouda/__init__.py +++ b/arkouda/__init__.py @@ -5,10 +5,10 @@ __version__ = get_versions()["version"] del get_versions +from arkouda.numpy import * from arkouda.array_view import * from arkouda.client import * from arkouda.client_dtypes import * -from arkouda.dtypes import * from arkouda.pdarrayclass import * from arkouda.sorting import * from arkouda.pdarraysetops import * diff --git a/arkouda/alignment.py b/arkouda/alignment.py index 546a42dfa1..bb8acf1129 100644 --- a/arkouda/alignment.py +++ b/arkouda/alignment.py @@ -6,10 +6,10 @@ from arkouda.categorical import Categorical from arkouda.client import generic_msg -from arkouda.dtypes import bigint -from arkouda.dtypes import float64 as akfloat64 -from arkouda.dtypes import int64 as akint64 -from arkouda.dtypes import uint64 as akuint64 +from arkouda.numpy.dtypes import bigint +from arkouda.numpy.dtypes import float64 as akfloat64 +from arkouda.numpy.dtypes import int64 as akint64 +from arkouda.numpy.dtypes import uint64 as akuint64 from arkouda.groupbyclass import GroupBy, broadcast, unique from arkouda.numeric import cumsum, where from arkouda.pdarrayclass import create_pdarray, pdarray diff --git a/arkouda/array_api/creation_functions.py b/arkouda/array_api/creation_functions.py index 1b89330b4f..27063716cd 100644 --- a/arkouda/array_api/creation_functions.py +++ b/arkouda/array_api/creation_functions.py @@ -6,8 +6,8 @@ import numpy as np from arkouda.pdarrayclass import create_pdarray, pdarray, _to_pdarray from arkouda.pdarraycreation import scalar_array -from arkouda.dtypes import dtype as akdtype -from arkouda.dtypes import resolve_scalar_dtype +from arkouda.numpy.dtypes import dtype as akdtype +from arkouda.numpy.dtypes import resolve_scalar_dtype if TYPE_CHECKING: from ._typing import ( diff --git a/arkouda/array_api/statistical_functions.py b/arkouda/array_api/statistical_functions.py index 888186a5ec..af559c31b4 100644 --- a/arkouda/array_api/statistical_functions.py +++ b/arkouda/array_api/statistical_functions.py @@ -20,7 +20,7 @@ import numpy as np from arkouda.client import generic_msg -from arkouda.dtypes import dtype as akdtype +from arkouda.numpy.dtypes import dtype as akdtype from arkouda.numeric import cast as akcast from arkouda.pdarrayclass import create_pdarray, parse_single_value from arkouda.pdarraycreation import scalar_array diff --git a/arkouda/array_view.py b/arkouda/array_view.py index 0f6bb8d3de..49e103cfec 100644 --- a/arkouda/array_view.py +++ b/arkouda/array_view.py @@ -6,7 +6,7 @@ import numpy as np from arkouda.client import generic_msg -from arkouda.dtypes import resolve_scalar_dtype +from arkouda.numpy.dtypes import resolve_scalar_dtype from arkouda.numeric import cast as akcast from arkouda.numeric import cumprod, where from arkouda.pdarrayclass import create_pdarray, parse_single_value, pdarray diff --git a/arkouda/categorical.py b/arkouda/categorical.py index e6d62fdbee..a081fcc5e1 100644 --- a/arkouda/categorical.py +++ b/arkouda/categorical.py @@ -20,10 +20,10 @@ from typeguard import typechecked from arkouda.client import generic_msg -from arkouda.dtypes import bool_ as akbool -from arkouda.dtypes import dtype as akdtype -from arkouda.dtypes import int64 as akint64 -from arkouda.dtypes import int_scalars, resolve_scalar_dtype, str_, str_scalars +from arkouda.numpy.dtypes import bool_ as akbool +from arkouda.numpy.dtypes import dtype as akdtype +from arkouda.numpy.dtypes import int64 as akint64 +from arkouda.numpy.dtypes import int_scalars, resolve_scalar_dtype, str_, str_scalars from arkouda.groupbyclass import GroupBy, unique from arkouda.infoclass import information from arkouda.logger import getArkoudaLogger diff --git a/arkouda/client_dtypes.py b/arkouda/client_dtypes.py index a0aaa35236..3d926a48e4 100644 --- a/arkouda/client_dtypes.py +++ b/arkouda/client_dtypes.py @@ -5,8 +5,8 @@ import numpy as np from typeguard import typechecked -from arkouda.dtypes import bitType, intTypes, isSupportedInt -from arkouda.dtypes import uint64 as akuint64 +from arkouda.numpy.dtypes import bitType, intTypes, isSupportedInt +from arkouda.numpy.dtypes import uint64 as akuint64 from arkouda.groupbyclass import GroupBy, broadcast from arkouda.numeric import cast as akcast from arkouda.numeric import where diff --git a/arkouda/dataframe.py b/arkouda/dataframe.py index 13256d46d4..785711f005 100644 --- a/arkouda/dataframe.py +++ b/arkouda/dataframe.py @@ -17,11 +17,11 @@ from arkouda.categorical import Categorical from arkouda.client import generic_msg, maxTransferBytes from arkouda.client_dtypes import BitVector, Fields, IPv4 -from arkouda.dtypes import bigint -from arkouda.dtypes import bool_ as akbool -from arkouda.dtypes import float64 as akfloat64 -from arkouda.dtypes import int64 as akint64 -from arkouda.dtypes import uint64 as akuint64 +from arkouda.numpy.dtypes import bigint +from arkouda.numpy.dtypes import bool_ as akbool +from arkouda.numpy.dtypes import float64 as akfloat64 +from arkouda.numpy.dtypes import int64 as akint64 +from arkouda.numpy.dtypes import uint64 as akuint64 from arkouda.groupbyclass import GROUPBY_REDUCTION_TYPES from arkouda.groupbyclass import GroupBy as akGroupBy from arkouda.groupbyclass import unique diff --git a/arkouda/dtypes/__init__.py b/arkouda/dtypes/__init__.py new file mode 100644 index 0000000000..a00c5996f8 --- /dev/null +++ b/arkouda/dtypes/__init__.py @@ -0,0 +1,3 @@ +# flake8: noqa + +from arkouda.numpy.dtypes import * diff --git a/arkouda/groupbyclass.py b/arkouda/groupbyclass.py index 501e71d1da..d330e22de4 100644 --- a/arkouda/groupbyclass.py +++ b/arkouda/groupbyclass.py @@ -14,7 +14,7 @@ no_type_check, ) -from arkouda.dtypes import dtype as akdtype +from arkouda.numpy.dtypes import dtype as akdtype if TYPE_CHECKING: from arkouda.categorical import Categorical @@ -23,12 +23,12 @@ from typeguard import typechecked from arkouda.client import generic_msg -from arkouda.dtypes import _val_isinstance_of_union, bigint -from arkouda.dtypes import float64 as akfloat64 -from arkouda.dtypes import float_scalars -from arkouda.dtypes import int64 as akint64 -from arkouda.dtypes import int_scalars -from arkouda.dtypes import uint64 as akuint64 +from arkouda.numpy.dtypes import _val_isinstance_of_union, bigint +from arkouda.numpy.dtypes import float64 as akfloat64 +from arkouda.numpy.dtypes import float_scalars +from arkouda.numpy.dtypes import int64 as akint64 +from arkouda.numpy.dtypes import int_scalars +from arkouda.numpy.dtypes import uint64 as akuint64 from arkouda.logger import getArkoudaLogger from arkouda.pdarrayclass import RegistrationError, create_pdarray, is_sorted, pdarray from arkouda.pdarraycreation import arange, full diff --git a/arkouda/index.py b/arkouda/index.py index 411e36c69c..72d0cbc91d 100644 --- a/arkouda/index.py +++ b/arkouda/index.py @@ -10,9 +10,9 @@ from typeguard import typechecked from arkouda import Categorical, Strings -from arkouda.dtypes import bool_ as akbool -from arkouda.dtypes import float64 as akfloat64 -from arkouda.dtypes import int64 as akint64 +from arkouda.numpy.dtypes import bool_ as akbool +from arkouda.numpy.dtypes import float64 as akfloat64 +from arkouda.numpy.dtypes import int64 as akint64 from arkouda.groupbyclass import GroupBy, unique from arkouda.numeric import cast as akcast from arkouda.pdarrayclass import RegistrationError, pdarray @@ -179,7 +179,7 @@ def __ne__(self, other): return values != other_values def _dtype_of_list_values(self, lst): - from arkouda.dtypes import dtype + from arkouda.numpy.dtypes import dtype if isinstance(lst, list): d = dtype(type(lst[0])) @@ -220,7 +220,7 @@ def inferred_type(self) -> str: Return a string of the type inferred from the values. """ if isinstance(self.values, list): - from arkouda.dtypes import float_scalars, int_scalars + from arkouda.numpy.dtypes import float_scalars, int_scalars from arkouda.util import _is_dtype_in_union if _is_dtype_in_union(self.dtype, int_scalars): diff --git a/arkouda/io.py b/arkouda/io.py index 283caa652a..a350f28d84 100644 --- a/arkouda/io.py +++ b/arkouda/io.py @@ -19,7 +19,7 @@ from arkouda.segarray import SegArray from arkouda.strings import Strings from arkouda.timeclass import Datetime, Timedelta -from arkouda.dtypes import float32, float64, int32, int64 +from arkouda.numpy.dtypes import float32, float64, int32, int64 __all__ = [ "get_filetype", diff --git a/arkouda/join.py b/arkouda/join.py index 36a0ff978d..6d78de03dc 100644 --- a/arkouda/join.py +++ b/arkouda/join.py @@ -6,9 +6,9 @@ from arkouda.alignment import right_align from arkouda.categorical import Categorical from arkouda.client import generic_msg -from arkouda.dtypes import NUMBER_FORMAT_STRINGS -from arkouda.dtypes import int64 as akint64 -from arkouda.dtypes import resolve_scalar_dtype +from arkouda.numpy.dtypes import NUMBER_FORMAT_STRINGS +from arkouda.numpy.dtypes import int64 as akint64 +from arkouda.numpy.dtypes import resolve_scalar_dtype from arkouda.groupbyclass import GroupBy, broadcast from arkouda.numeric import cumsum from arkouda.pdarrayclass import create_pdarray, pdarray diff --git a/arkouda/matcher.py b/arkouda/matcher.py index 2933d99ea9..67ad0b9bf8 100644 --- a/arkouda/matcher.py +++ b/arkouda/matcher.py @@ -3,7 +3,7 @@ from typing import cast from arkouda.client import generic_msg -from arkouda.dtypes import str_scalars +from arkouda.numpy.dtypes import str_scalars from arkouda.infoclass import list_symbol_table from arkouda.logger import getArkoudaLogger from arkouda.match import Match, MatchType diff --git a/arkouda/message.py b/arkouda/message.py index 292dfb071f..16bd422288 100644 --- a/arkouda/message.py +++ b/arkouda/message.py @@ -7,7 +7,7 @@ from typeguard import typechecked -from arkouda.dtypes import isSupportedNumber, resolve_scalar_dtype +from arkouda.numpy.dtypes import isSupportedNumber, resolve_scalar_dtype class ParameterObject: diff --git a/arkouda/numeric.py b/arkouda/numeric.py index 20d99dbbd5..b948fa0022 100644 --- a/arkouda/numeric.py +++ b/arkouda/numeric.py @@ -8,17 +8,17 @@ from typeguard import typechecked from arkouda.client import generic_msg -from arkouda.dtypes import DTypes, bigint -from arkouda.dtypes import dtype as akdtype -from arkouda.dtypes import int64 as akint64 -from arkouda.dtypes import ( +from arkouda.groupbyclass import GroupBy +from arkouda.numpy.dtypes import DTypes, bigint +from arkouda.numpy.dtypes import dtype as akdtype +from arkouda.numpy.dtypes import int64 as akint64 +from arkouda.numpy.dtypes import ( int_scalars, isSupportedNumber, numeric_scalars, resolve_scalar_dtype, str_, ) -from arkouda.groupbyclass import GroupBy from arkouda.pdarrayclass import all as ak_all from arkouda.pdarrayclass import any as ak_any from arkouda.pdarrayclass import argmax, create_pdarray, pdarray, sum diff --git a/arkouda/numpy/__init__.py b/arkouda/numpy/__init__.py index 20a3a0bcf1..5ac1ce3d6d 100644 --- a/arkouda/numpy/__init__.py +++ b/arkouda/numpy/__init__.py @@ -15,19 +15,19 @@ base_repr, binary_repr, byte, + bytes_, cdouble, cfloat, clongdouble, clongfloat, compat, csingle, + datetime64, double, e, euler_gamma, finfo, flexible, - float32, - float64, float_, floating, format_float_positional, @@ -37,10 +37,6 @@ inexact, inf, infty, - int8, - int16, - int32, - int64, intc, intp, isscalar, @@ -59,17 +55,15 @@ short, signedinteger, single, + timedelta64, ubyte, uint, - uint8, - uint16, - uint32, - uint64, uintc, uintp, ulonglong, unsignedinteger, ushort, + void, ) from arkouda.numpy import ( @@ -102,108 +96,3 @@ from arkouda.numpy.rec import * from ._numeric import floor - -__all__ = [ - "DataSource", - "False_", - "Inf", - "Infinity", - "NAN", - "NINF", - "NZERO", - "NaN", - "PINF", - "PZERO", - "RankWarning", - "ScalarType", - "TooHardError", - "True_", - "_builtins", - "_mat", - "_numeric", - "_typing", - "add_docstring", - "add_newdoc", - "base_repr", - "binary_repr", - "bool_", - "byte", - "cdouble", - "cfloat", - "char", - "character", - "clongdouble", - "clongfloat", - "compat", - "csingle", - "ctypeslib", - "deprecate", - "deprecate_with_doc", - "disp", - "double", - "dtypes", - "e", - "emath", - "euler_gamma", - "exceptions", - "fft", - "finfo", - "flexible", - "float32", - "float64", - "float_", - "floating", - "floor", - "format_float_positional", - "format_float_scientific", - "format_parser", - "half", - "iinfo", - "inexact", - "inf", - "infty", - "int16", - "int32", - "int64", - "int8", - "int_", - "intc", - "integer", - "intp", - "isscalar", - "issctype", - "issubclass_", - "issubdtype", - "lib", - "linalg", - "longdouble", - "longfloat", - "longlong", - "ma", - "maximum_sctype", - "nan", - "number", - "object_", - "pi", - "polynomial", - "promote_types", - "rec", - "sctypeDict", - "sctypes", - "short", - "signedinteger", - "single", - "str_", - "typename", - "ubyte", - "uint", - "uint16", - "uint32", - "uint64", - "uint8", - "uintc", - "uintp", - "ulonglong", - "unsignedinteger", - "ushort", -] diff --git a/arkouda/numpy/_numeric.py b/arkouda/numpy/_numeric.py index 2be40cc316..b115240cd3 100644 --- a/arkouda/numpy/_numeric.py +++ b/arkouda/numpy/_numeric.py @@ -4,7 +4,7 @@ from arkouda.client import generic_msg from arkouda.pdarrayclass import create_pdarray, pdarray -from arkouda.dtypes import ( +from arkouda.numpy.dtypes import ( int64 as ak_int64, float64 as ak_float64, bool_ as ak_bool, diff --git a/arkouda/numpy/dtypes/__init__.py b/arkouda/numpy/dtypes/__init__.py index e69de29bb2..ee89c72a1d 100644 --- a/arkouda/numpy/dtypes/__init__.py +++ b/arkouda/numpy/dtypes/__init__.py @@ -0,0 +1,38 @@ +# flake8: noqa + +from numpy.dtypes import ( + BoolDType, + ByteDType, + BytesDType, + CLongDoubleDType, + Complex64DType, + Complex128DType, + DateTime64DType, + Float16DType, + Float32DType, + Float64DType, + Int8DType, + Int16DType, + Int32DType, + Int64DType, + IntDType, + LongDoubleDType, + LongDType, + LongLongDType, + ObjectDType, + ShortDType, + StrDType, + TimeDelta64DType, + UByteDType, + UInt8DType, + UInt16DType, + UInt32DType, + UInt64DType, + UIntDType, + ULongDType, + ULongLongDType, + UShortDType, + VoidDType, +) + +from .dtypes import * diff --git a/arkouda/dtypes.py b/arkouda/numpy/dtypes/dtypes.py similarity index 94% rename from arkouda/dtypes.py rename to arkouda/numpy/dtypes/dtypes.py index e3b1ac3a4a..faa94aadbc 100644 --- a/arkouda/dtypes.py +++ b/arkouda/numpy/dtypes/dtypes.py @@ -6,43 +6,73 @@ from typing import Union, cast import numpy as np +from numpy import ( + bool_, + complex64, + complex128, + float16, + float32, + float64, + int8, + int16, + int32, + int64, + str_, + uint8, + uint16, + uint32, + uint64, +) __all__ = [ - "DTypes", + "ARKOUDA_SUPPORTED_DTYPES", + "DType", "DTypeObjects", + "DTypes", + "NUMBER_FORMAT_STRINGS", + "NumericDTypes", "ScalarDTypes", + "SeriesDTypes", + "_is_dtype_in_union", + "_val_isinstance_of_union", + "all_scalars", + "bigint", + "bitType", + "bool_", + "bool_scalars", + "complex128", + "complex64", "dtype", - "uint8", - "uint16", - "uint32", - "uint64", - "int8", + "float16", + "float32", + "float64", + "float_scalars", + "get_byteorder", + "get_server_byteorder", "int16", "int32", "int64", - "float32", - "float64", - "complex64", - "complex128", - "bool_", - "str_", - "bigint", + "int8", "intTypes", - "bitType", - "resolve_scalar_dtype", - "ARKOUDA_SUPPORTED_DTYPES", - "bool_scalars", - "float_scalars", "int_scalars", + "isSupportedFloat", + "isSupportedInt", + "isSupportedNumber", + "numeric_and_bool_scalars", + "numeric_and_bool_scalars", "numeric_scalars", "numpy_scalars", + "resolve_scalar_dtype", + "resolve_scalar_dtype", + "str_", "str_scalars", - "all_scalars", - "get_byteorder", - "get_server_byteorder", - "isSupportedNumber", + "uint16", + "uint32", + "uint64", + "uint8", ] + NUMBER_FORMAT_STRINGS = { "bool": "{}", "int64": "{:n}", @@ -133,20 +163,6 @@ def type(self, x): return int(x) -uint8 = np.uint8 -uint16 = np.uint16 -uint32 = np.uint32 -uint64 = np.uint64 -int8 = np.int8 -int16 = np.int16 -int32 = np.int32 -int64 = np.int64 -float32 = np.float32 -float64 = np.float64 -complex64 = np.complex64 -complex128 = np.complex128 -bool_ = np.bool_ -str_ = np.str_ intTypes = frozenset((dtype("int64"), dtype("uint64"), dtype("uint8"))) bitType = uint64 diff --git a/arkouda/pdarrayclass.py b/arkouda/pdarrayclass.py index 14c07914b4..dda00ec31c 100644 --- a/arkouda/pdarrayclass.py +++ b/arkouda/pdarrayclass.py @@ -10,13 +10,13 @@ from typeguard import typechecked from arkouda.client import generic_msg -from arkouda.dtypes import NUMBER_FORMAT_STRINGS, DTypes, bigint -from arkouda.dtypes import bool_ as akbool -from arkouda.dtypes import dtype -from arkouda.dtypes import float64 as akfloat64 -from arkouda.dtypes import get_byteorder, get_server_byteorder -from arkouda.dtypes import int64 as akint64 -from arkouda.dtypes import ( +from arkouda.numpy.dtypes import NUMBER_FORMAT_STRINGS, DTypes, bigint +from arkouda.numpy.dtypes import bool_ as akbool +from arkouda.numpy.dtypes import dtype +from arkouda.numpy.dtypes import float64 as akfloat64 +from arkouda.numpy.dtypes import get_byteorder, get_server_byteorder +from arkouda.numpy.dtypes import int64 as akint64 +from arkouda.numpy.dtypes import ( int_scalars, isSupportedInt, isSupportedNumber, @@ -25,8 +25,8 @@ numpy_scalars, resolve_scalar_dtype, ) -from arkouda.dtypes import str_ as akstr_ -from arkouda.dtypes import uint64 as akuint64 +from arkouda.numpy.dtypes import str_ as akstr_ +from arkouda.numpy.dtypes import uint64 as akuint64 from arkouda.infoclass import information, pretty_print_information from arkouda.logger import getArkoudaLogger @@ -772,7 +772,7 @@ def inferred_type(self) -> Union[str, None]: """ Return a string of the type inferred from the values. """ - from arkouda.dtypes import float_scalars, int_scalars + from arkouda.numpy.dtypes import float_scalars, int_scalars from arkouda.util import _is_dtype_in_union if _is_dtype_in_union(self.dtype, int_scalars): diff --git a/arkouda/pdarraycreation.py b/arkouda/pdarraycreation.py index 40166a46d6..3f2715b110 100644 --- a/arkouda/pdarraycreation.py +++ b/arkouda/pdarraycreation.py @@ -6,24 +6,24 @@ from typeguard import typechecked from arkouda.client import generic_msg -from arkouda.dtypes import ( +from arkouda.numpy.dtypes import ( NUMBER_FORMAT_STRINGS, DTypes, NumericDTypes, SeriesDTypes, bigint, ) -from arkouda.dtypes import dtype as akdtype -from arkouda.dtypes import float64, get_byteorder, get_server_byteorder -from arkouda.dtypes import int64 as akint64 -from arkouda.dtypes import ( +from arkouda.numpy.dtypes import dtype as akdtype +from arkouda.numpy.dtypes import float64, get_byteorder, get_server_byteorder +from arkouda.numpy.dtypes import int64 as akint64 +from arkouda.numpy.dtypes import ( int_scalars, isSupportedInt, isSupportedNumber, numeric_scalars, resolve_scalar_dtype, ) -from arkouda.dtypes import uint64 as akuint64 +from arkouda.numpy.dtypes import uint64 as akuint64 from arkouda.pdarrayclass import create_pdarray, pdarray from arkouda.strings import Strings diff --git a/arkouda/pdarraysetops.py b/arkouda/pdarraysetops.py index d7bbb2f547..0755bf2b3b 100644 --- a/arkouda/pdarraysetops.py +++ b/arkouda/pdarraysetops.py @@ -7,10 +7,10 @@ from arkouda.client import generic_msg from arkouda.client_dtypes import BitVector -from arkouda.dtypes import bigint -from arkouda.dtypes import bool_ as akbool -from arkouda.dtypes import int64 as akint64 -from arkouda.dtypes import uint64 as akuint64 +from arkouda.numpy.dtypes import bigint +from arkouda.numpy.dtypes import bool_ as akbool +from arkouda.numpy.dtypes import int64 as akint64 +from arkouda.numpy.dtypes import uint64 as akuint64 from arkouda.groupbyclass import GroupBy, groupable, groupable_element_type, unique from arkouda.logger import getArkoudaLogger from arkouda.pdarrayclass import create_pdarray, pdarray @@ -339,7 +339,7 @@ def concatenate( """ from arkouda.categorical import Categorical as Categorical_ - from arkouda.dtypes import int_scalars + from arkouda.numpy.dtypes import int_scalars from arkouda.util import get_callback size: int_scalars = 0 diff --git a/arkouda/random/_generator.py b/arkouda/random/_generator.py index 3f44cfd7a6..efbefaab26 100644 --- a/arkouda/random/_generator.py +++ b/arkouda/random/_generator.py @@ -2,13 +2,13 @@ import numpy.random as np_random from arkouda.client import generic_msg -from arkouda.dtypes import _val_isinstance_of_union -from arkouda.dtypes import dtype as akdtype -from arkouda.dtypes import dtype as to_numpy_dtype -from arkouda.dtypes import float64 as akfloat64 -from arkouda.dtypes import float_scalars -from arkouda.dtypes import int64 as akint64 -from arkouda.dtypes import int_scalars, numeric_scalars +from arkouda.numpy.dtypes import _val_isinstance_of_union +from arkouda.numpy.dtypes import dtype as akdtype +from arkouda.numpy.dtypes import dtype as to_numpy_dtype +from arkouda.numpy.dtypes import float64 as akfloat64 +from arkouda.numpy.dtypes import float_scalars +from arkouda.numpy.dtypes import int64 as akint64 +from arkouda.numpy.dtypes import int_scalars, numeric_scalars from arkouda.pdarrayclass import create_pdarray, pdarray diff --git a/arkouda/random/_legacy.py b/arkouda/random/_legacy.py index eb69418d31..eac31b6a5d 100644 --- a/arkouda/random/_legacy.py +++ b/arkouda/random/_legacy.py @@ -3,10 +3,10 @@ from typeguard import typechecked from arkouda.client import generic_msg -from arkouda.dtypes import NUMBER_FORMAT_STRINGS, DTypes -from arkouda.dtypes import dtype as akdtype -from arkouda.dtypes import int64 as akint64 -from arkouda.dtypes import int_scalars, numeric_scalars +from arkouda.numpy.dtypes import NUMBER_FORMAT_STRINGS, DTypes +from arkouda.numpy.dtypes import dtype as akdtype +from arkouda.numpy.dtypes import int64 as akint64 +from arkouda.numpy.dtypes import int_scalars, numeric_scalars from arkouda.pdarrayclass import create_pdarray, pdarray diff --git a/arkouda/scipy/_stats_py.py b/arkouda/scipy/_stats_py.py index 7a45576666..78d12a2faf 100644 --- a/arkouda/scipy/_stats_py.py +++ b/arkouda/scipy/_stats_py.py @@ -6,7 +6,7 @@ import arkouda as ak from arkouda.scipy.special import xlogy -from arkouda.dtypes import float64 as akfloat64 +from arkouda.numpy.dtypes import float64 as akfloat64 __all__ = ["power_divergence", "chisquare", "Power_divergenceResult"] diff --git a/arkouda/segarray.py b/arkouda/segarray.py index bf8e3c832f..96876c550a 100644 --- a/arkouda/segarray.py +++ b/arkouda/segarray.py @@ -9,10 +9,10 @@ import numpy as np from arkouda.client import generic_msg -from arkouda.dtypes import bool_ as akbool -from arkouda.dtypes import int64 as akint64 -from arkouda.dtypes import int_scalars, isSupportedInt, str_ -from arkouda.dtypes import uint64 as akuint64 +from arkouda.numpy.dtypes import bool_ as akbool +from arkouda.numpy.dtypes import int64 as akint64 +from arkouda.numpy.dtypes import int_scalars, isSupportedInt, str_ +from arkouda.numpy.dtypes import uint64 as akuint64 from arkouda.groupbyclass import GroupBy, broadcast from arkouda.join import gen_ranges from arkouda.logger import getArkoudaLogger diff --git a/arkouda/series.py b/arkouda/series.py index 4c04731d40..8e762ac673 100644 --- a/arkouda/series.py +++ b/arkouda/series.py @@ -12,7 +12,7 @@ from arkouda.accessor import CachedAccessor, DatetimeAccessor, StringAccessor from arkouda.alignment import lookup from arkouda.categorical import Categorical -from arkouda.dtypes import dtype, float64, int64 +from arkouda.numpy.dtypes import dtype, float64, int64 from arkouda.groupbyclass import GroupBy, groupable_element_type from arkouda.index import Index, MultiIndex from arkouda.numeric import cast as akcast diff --git a/arkouda/sorting.py b/arkouda/sorting.py index b97b9e07cd..8af267011c 100644 --- a/arkouda/sorting.py +++ b/arkouda/sorting.py @@ -6,7 +6,7 @@ from typeguard import check_type, typechecked from arkouda.client import generic_msg -from arkouda.dtypes import bigint, bool_, dtype, float64, int64, int_scalars, uint64 +from arkouda.numpy.dtypes import bigint, bool_, dtype, float64, int64, int_scalars, uint64 from arkouda.pdarrayclass import create_pdarray, pdarray from arkouda.pdarraycreation import zeros from arkouda.strings import Strings diff --git a/arkouda/strings.py b/arkouda/strings.py index 8f6a5c4004..872afd4a6f 100644 --- a/arkouda/strings.py +++ b/arkouda/strings.py @@ -8,11 +8,11 @@ import numpy as np from typeguard import typechecked -import arkouda.dtypes +import arkouda.numpy.dtypes from arkouda.client import generic_msg -from arkouda.dtypes import NUMBER_FORMAT_STRINGS -from arkouda.dtypes import dtype as akdtype -from arkouda.dtypes import ( +from arkouda.numpy.dtypes import NUMBER_FORMAT_STRINGS +from arkouda.numpy.dtypes import dtype as akdtype +from arkouda.numpy.dtypes import ( int_scalars, resolve_scalar_dtype, str_, @@ -2205,9 +2205,9 @@ def _comp_to_ndarray(self, comp: str) -> np.ndarray: # Total number of bytes in the array data array_bytes = ( - self.size * arkouda.dtypes.dtype(arkouda.dtypes.int64).itemsize + self.size * arkouda.numpy.dtypes.dtype(arkouda.numpy.dtypes.int64).itemsize if comp == "offsets" - else self.nbytes * arkouda.dtypes.dtype(arkouda.dtypes.uint8).itemsize + else self.nbytes * arkouda.numpy.dtypes.dtype(arkouda.numpy.dtypes.uint8).itemsize ) # Guard against overflowing client memory @@ -2227,7 +2227,7 @@ def _comp_to_ndarray(self, comp: str) -> np.ndarray: # The server sends us native-endian bytes so we need to account for that. # Since bytes are immutable, we need to copy the np array to be mutable dt: np.dtype = np.dtype(np.int64) if comp == "offsets" else np.dtype(np.uint8) - if arkouda.dtypes.get_server_byteorder() == "big": + if arkouda.numpy.dtypes.get_server_byteorder() == "big": dt = dt.newbyteorder(">") else: dt = dt.newbyteorder("<") diff --git a/arkouda/timeclass.py b/arkouda/timeclass.py index a3cfb66964..0cf392f55f 100644 --- a/arkouda/timeclass.py +++ b/arkouda/timeclass.py @@ -11,7 +11,7 @@ from pandas import to_datetime, to_timedelta from arkouda.client import generic_msg -from arkouda.dtypes import int64, int_scalars, intTypes, isSupportedInt +from arkouda.numpy.dtypes import int64, int_scalars, intTypes, isSupportedInt from arkouda.numeric import abs as akabs from arkouda.numeric import cast from arkouda.pdarrayclass import RegistrationError, create_pdarray, pdarray diff --git a/arkouda/util.py b/arkouda/util.py index 4636f66be1..2c26cc5be3 100644 --- a/arkouda/util.py +++ b/arkouda/util.py @@ -10,7 +10,7 @@ from arkouda.categorical import Categorical from arkouda.client import generic_msg, get_config, get_mem_used from arkouda.client_dtypes import BitVector, BitVectorizer, IPv4 -from arkouda.dtypes import ( +from arkouda.numpy.dtypes import ( _is_dtype_in_union, dtype, float_scalars, diff --git a/benchmarks/stream.py b/benchmarks/stream.py index b2f8316313..a54e935568 100755 --- a/benchmarks/stream.py +++ b/benchmarks/stream.py @@ -6,7 +6,7 @@ import numpy as np import arkouda as ak -from arkouda.dtypes import dtype as akdtype +from arkouda.numpy.dtypes import dtype as akdtype TYPES = ("int64", "float64") diff --git a/pydoc/preprocess/generate_import_stubs.py b/pydoc/preprocess/generate_import_stubs.py index d1ad75f3d8..3baabe441b 100644 --- a/pydoc/preprocess/generate_import_stubs.py +++ b/pydoc/preprocess/generate_import_stubs.py @@ -146,7 +146,8 @@ def main(): import arkouda.scipy.stats as akscipyStats import arkouda.series as akSeries - write_stub(aknp, "arkouda/numpy.pyi", all_only=True, allow_arkouda=True) + write_stub(aknp, "arkouda/numpy.pyi", all_only=False, allow_arkouda=True) + write_stub(aknp.dtypes, "arkouda/numpy/dtypes.pyi", all_only=False, allow_arkouda=True) write_stub(akscipy, "arkouda/scipy.pyi", all_only=True, allow_arkouda=True) write_stub(akscipyStats, "arkouda/scipy/stats.pyi", all_only=True, allow_arkouda=True) write_stub(akscipySpecial, "arkouda/scipy/special.pyi", all_only=True, allow_arkouda=True) diff --git a/pytest.ini b/pytest.ini index f48d4e5d31..c58004cd25 100644 --- a/pytest.ini +++ b/pytest.ini @@ -23,7 +23,6 @@ testpaths = tests/compare_test.py tests/dataframe_test.py tests/datetime_test.py - tests/dtypes_test.py tests/extrema_test.py tests/groupby_test.py tests/indexing_test.py @@ -34,6 +33,7 @@ testpaths = tests/logger_test.py tests/message_test.py tests/numeric_test.py + tests/numpy/dtypes_test.py tests/numpy/numpy_numeric_test.py tests/numpy/numpy_test.py tests/operator_test.py diff --git a/tests/index_test.py b/tests/index_test.py index b6e2b8a0a5..7ecbb62aac 100644 --- a/tests/index_test.py +++ b/tests/index_test.py @@ -11,7 +11,7 @@ import arkouda as ak from arkouda import io_util -from arkouda.dtypes import dtype +from arkouda.numpy.dtypes import dtype from arkouda.index import Index from arkouda.pdarrayclass import pdarray from arkouda.testing import assert_index_equal @@ -380,7 +380,7 @@ def test_get_level_values(self): @pytest.mark.parametrize("size", pytest.prob_size) def test_memory_usage(self, size): - from arkouda.dtypes import bigint + from arkouda.numpy.dtypes import bigint from arkouda.index import Index, MultiIndex idx = Index(ak.cast(ak.array([1, 2, 3]), dt="bigint")) diff --git a/tests/dtypes_test.py b/tests/numpy/dtypes_test.py similarity index 98% rename from tests/dtypes_test.py rename to tests/numpy/dtypes_test.py index 5a153b52be..573ea855c9 100644 --- a/tests/dtypes_test.py +++ b/tests/numpy/dtypes_test.py @@ -2,7 +2,7 @@ import pytest import arkouda as ak -from arkouda import dtypes +from arkouda.numpy import dtypes """ DtypesTest encapsulates arkouda dtypes module methods @@ -55,7 +55,7 @@ def test_resolve_scalar_dtype(self): def test_is_dtype_in_union(self): from typing import Union - from arkouda.dtypes import _is_dtype_in_union + from arkouda.numpy.dtypes import _is_dtype_in_union float_scalars = Union[float, np.float64, np.float32] assert _is_dtype_in_union(np.float64, float_scalars)