From fcb789a2b087a78d0109f189a6e748101f0d6a15 Mon Sep 17 00:00:00 2001 From: Jim Kitchen Date: Tue, 4 Oct 2022 08:53:47 -0500 Subject: [PATCH 1/2] Remove indexunary and select ops from gb.op namespace --- graphblas/operator.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/graphblas/operator.py b/graphblas/operator.py index 29cf4af29..2e28b4262 100644 --- a/graphblas/operator.py +++ b/graphblas/operator.py @@ -1466,7 +1466,7 @@ def register_new(cls, name, func, *, parameterized=False, is_udt=False, lazy=Fal def _initialize(cls): if cls._initialized: return - super()._initialize() + super()._initialize(include_in_ops=False) # Update type information to include UINT64 for positional ops for name in ("tril", "triu", "diag", "offdiag", "colle", "colgt", "rowle", "rowgt"): op = getattr(indexunary, name) From 7537b253e0a6658c361fe25b0a49508d857f3567 Mon Sep 17 00:00:00 2001 From: Jim Kitchen Date: Wed, 12 Oct 2022 11:02:29 -0500 Subject: [PATCH 2/2] Update tests to match new logic in `op` namespace --- graphblas/tests/test_op.py | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/graphblas/tests/test_op.py b/graphblas/tests/test_op.py index a222675c7..e7c2fbd51 100644 --- a/graphblas/tests/test_op.py +++ b/graphblas/tests/test_op.py @@ -685,12 +685,11 @@ def test_op_namespace(): # Make sure all have been initialized so `vars` below works for key in list(op._delayed): # pragma: no cover getattr(op, key) - known_aliases = {"index", "indexle", "indexgt"} opnames = { key for key, val in vars(op).items() if isinstance(val, (operator.OpBase, operator.ParameterizedUdf)) - } | known_aliases + } unarynames = { key for key, val in vars(unary).items() @@ -725,11 +724,10 @@ def test_op_namespace(): assert not binarynames - opnames, binarynames - opnames assert not monoidnames - opnames, monoidnames - opnames assert not semiringnames - opnames, semiringnames - opnames - assert not indexunarynames - opnames, indexunarynames - opnames - assert not selectnames - opnames, selectnames - opnames - assert not opnames - ( - unarynames | binarynames | monoidnames | semiringnames | indexunarynames | selectnames - ) + assert not opnames - (unarynames | binarynames | monoidnames | semiringnames) + # These are not part of the `op` namespace + assert indexunarynames - opnames == indexunarynames, indexunarynames - opnames + assert selectnames - opnames == selectnames, selectnames - opnames @pytest.mark.slow