From 88b45b6f0b57326b5c69488c28703b69ad56c978 Mon Sep 17 00:00:00 2001 From: Erik Welch Date: Wed, 28 Jun 2023 23:05:47 -0500 Subject: [PATCH 1/2] Move `dtypes._core` to `core.dtypes` I think this follows established patterns that we typically use. --- graphblas/{dtypes/_core.py => core/dtypes.py} | 0 graphblas/core/operator/binary.py | 2 +- graphblas/core/operator/indexunary.py | 2 +- graphblas/core/operator/unary.py | 2 +- graphblas/core/ss/matrix.py | 2 +- graphblas/core/ss/vector.py | 2 +- graphblas/dtypes/__init__.py | 4 ++-- graphblas/tests/test_dtype.py | 12 ++++++------ 8 files changed, 13 insertions(+), 13 deletions(-) rename graphblas/{dtypes/_core.py => core/dtypes.py} (100%) diff --git a/graphblas/dtypes/_core.py b/graphblas/core/dtypes.py similarity index 100% rename from graphblas/dtypes/_core.py rename to graphblas/core/dtypes.py diff --git a/graphblas/core/operator/binary.py b/graphblas/core/operator/binary.py index 434ad91cb..88191c39b 100644 --- a/graphblas/core/operator/binary.py +++ b/graphblas/core/operator/binary.py @@ -22,9 +22,9 @@ _supports_complex, lookup_dtype, ) -from ...dtypes._core import _sample_values from ...exceptions import UdfParseError, check_status_carg from .. import _has_numba, _supports_udfs, ffi, lib +from ..dtypes import _sample_values from ..expr import InfixExprBase from .base import ( _SS_OPERATORS, diff --git a/graphblas/core/operator/indexunary.py b/graphblas/core/operator/indexunary.py index 8b1211258..b5351e916 100644 --- a/graphblas/core/operator/indexunary.py +++ b/graphblas/core/operator/indexunary.py @@ -4,9 +4,9 @@ from ... import _STANDARD_OPERATOR_NAMES, indexunary, select from ...dtypes import BOOL, FP64, INT8, INT64, UINT64, lookup_dtype -from ...dtypes._core import _sample_values from ...exceptions import UdfParseError, check_status_carg from .. import _has_numba, ffi, lib +from ..dtypes import _sample_values from .base import OpBase, ParameterizedUdf, TypedOpBase, _call_op, _deserialize_parameterized if _has_numba: diff --git a/graphblas/core/operator/unary.py b/graphblas/core/operator/unary.py index 11ada4e48..437334ccc 100644 --- a/graphblas/core/operator/unary.py +++ b/graphblas/core/operator/unary.py @@ -18,9 +18,9 @@ _supports_complex, lookup_dtype, ) -from ...dtypes._core import _sample_values from ...exceptions import UdfParseError, check_status_carg from .. import _has_numba, ffi, lib +from ..dtypes import _sample_values from ..utils import output_type from .base import ( _SS_OPERATORS, diff --git a/graphblas/core/ss/matrix.py b/graphblas/core/ss/matrix.py index 990d692b9..56c28f52f 100644 --- a/graphblas/core/ss/matrix.py +++ b/graphblas/core/ss/matrix.py @@ -8,10 +8,10 @@ from ... import binary, monoid from ...dtypes import _INDEX, BOOL, INT64, UINT64, lookup_dtype -from ...dtypes._core import _string_to_dtype from ...exceptions import _error_code_lookup, check_status, check_status_carg from .. import NULL, _has_numba, ffi, lib from ..base import call +from ..dtypes import _string_to_dtype from ..operator import get_typed_op from ..scalar import Scalar, _as_scalar, _scalar_index from ..utils import ( diff --git a/graphblas/core/ss/vector.py b/graphblas/core/ss/vector.py index ff9e233eb..a8bff4ee5 100644 --- a/graphblas/core/ss/vector.py +++ b/graphblas/core/ss/vector.py @@ -7,10 +7,10 @@ from ... import binary, monoid from ...dtypes import _INDEX, INT64, UINT64, lookup_dtype -from ...dtypes._core import _string_to_dtype from ...exceptions import _error_code_lookup, check_status, check_status_carg from .. import NULL, ffi, lib from ..base import call +from ..dtypes import _string_to_dtype from ..operator import get_typed_op from ..scalar import Scalar, _as_scalar from ..utils import ( diff --git a/graphblas/dtypes/__init__.py b/graphblas/dtypes/__init__.py index 0d26a44a0..49e46d787 100644 --- a/graphblas/dtypes/__init__.py +++ b/graphblas/dtypes/__init__.py @@ -1,4 +1,4 @@ -from ._core import ( +from ..core.dtypes import ( _INDEX, BOOL, FP32, @@ -20,7 +20,7 @@ ) if _supports_complex: - from ._core import FC32, FC64 + from ..core.dtypes import FC32, FC64 def __dir__(): diff --git a/graphblas/tests/test_dtype.py b/graphblas/tests/test_dtype.py index 47a226313..5797dda10 100644 --- a/graphblas/tests/test_dtype.py +++ b/graphblas/tests/test_dtype.py @@ -7,7 +7,7 @@ import pytest import graphblas as gb -from graphblas import dtypes +from graphblas import core, dtypes from graphblas.core import lib from graphblas.dtypes import lookup_dtype @@ -123,7 +123,7 @@ def test_dtype_bad_comparison(): def test_dtypes_match_numpy(): - for key, val in dtypes._core._registry.items(): + for key, val in core.dtypes._registry.items(): try: if key is int or (isinstance(key, str) and key == "int"): # For win64, numpy treats int as int32, not int64 @@ -137,7 +137,7 @@ def test_dtypes_match_numpy(): def test_pickle(): - for val in dtypes._core._registry.values(): + for val in core.dtypes._registry.values(): s = pickle.dumps(val) val2 = pickle.loads(s) if val._is_udt: # pragma: no cover @@ -205,7 +205,7 @@ def test_auto_register(): def test_default_names(): - from graphblas.dtypes._core import _default_name + from graphblas.core.dtypes import _default_name assert _default_name(np.dtype([("x", np.int32), ("y", np.float64)], align=True)) == ( "{'x': INT32, 'y': FP64}" @@ -230,9 +230,9 @@ def test_dtype_to_from_string(): except Exception: pass for dtype in types: - s = dtypes._core._dtype_to_string(dtype) + s = core.dtypes._dtype_to_string(dtype) try: - dtype2 = dtypes._core._string_to_dtype(s) + dtype2 = core.dtypes._string_to_dtype(s) except Exception: with pytest.raises(ValueError, match="Unknown dtype"): lookup_dtype(dtype) From d8b4915cb974f25ec0960ad168471a4994f69f22 Mon Sep 17 00:00:00 2001 From: Erik Welch Date: Thu, 29 Jun 2023 00:09:41 -0500 Subject: [PATCH 2/2] What's with the test failure? We should already be ignoring that warning. --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index ddd718ef6..8d3f0b213 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -196,7 +196,7 @@ filterwarnings = [ # This deprecation warning was added in setuptools v67.5.0 (8 Mar 2023). See: # https://setuptools.pypa.io/en/latest/history.html#v67-5-0 - "ignore:pkg_resources is deprecated as an API:DeprecationWarning:pkg_resources", + "ignore:pkg_resources is deprecated as an API:DeprecationWarning:", # sre_parse deprecated in 3.11; this is triggered by awkward 0.10 "ignore:module 'sre_parse' is deprecated:DeprecationWarning:",