Skip to content

Commit

Permalink
Remove ndx.promote_nullable and fix docs (#100)
Browse files Browse the repository at this point in the history
  • Loading branch information
adityagoel4512 authored Jan 27, 2025
1 parent 86ada1b commit e277f9f
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 17 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@
Changelog
=========

0.10.0 (unreleased)
-------------------

- Removed the deprecated :func:`ndonnx.promote_nullable` function. Use :func:`ndonnx.additional.make_nullable` instead.


0.9.3 (2024-10-25)
------------------

Expand Down
1 change: 0 additions & 1 deletion ndonnx/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
NullableIntegral,
NullableNumerical,
Numerical,
promote_nullable,
from_numpy_dtype,
bool,
float32,
Expand Down
2 changes: 1 addition & 1 deletion ndonnx/_core/_numericimpl.py
Original file line number Diff line number Diff line change
Expand Up @@ -1020,7 +1020,7 @@ def _determine_reduce_op_dtype(
raise TypeError(f"Cannot reduce {x.dtype} to a smaller unsigned dtype")
elif isinstance(x.dtype, dtypes.NullableUnsigned):
if ndx.iinfo(x.dtype).bits <= ndx.iinfo(maximum_unsigned_dtype).bits:
return dtypes.promote_nullable(maximum_unsigned_dtype)
return dtypes.into_nullable(maximum_unsigned_dtype)
else:
raise TypeError(f"Cannot reduce {x.dtype} to a smaller unsigned dtype")
elif isinstance(x.dtype, dtypes.Integral):
Expand Down
10 changes: 0 additions & 10 deletions ndonnx/_data_types/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
# SPDX-License-Identifier: BSD-3-Clause

from __future__ import annotations
from ndonnx._utility import deprecated
from typing import Union
from .aliases import (
bool,
Expand Down Expand Up @@ -102,14 +101,6 @@ def into_nullable(dtype: StructType | CoreType) -> NullableCore:
Dtype = Union[CoreType, StructType]


@deprecated(
"Function 'ndonnx.promote_nullable' will be deprecated in ndonnx 0.7. "
"To create nullable array, use 'ndonnx.additional.make_nullable' instead."
)
def promote_nullable(dtype: StructType | CoreType) -> NullableCore:
return into_nullable(dtype)


__all__ = [
"CoreType",
"StructType",
Expand Down Expand Up @@ -150,7 +141,6 @@ def promote_nullable(dtype: StructType | CoreType) -> NullableCore:
"nutf8",
"get_finfo",
"get_iinfo",
"promote_nullable",
"Schema",
"CastMixin",
"CastError",
Expand Down
2 changes: 2 additions & 0 deletions ndonnx/_funcs.py
Original file line number Diff line number Diff line change
Expand Up @@ -986,10 +986,12 @@ def _unary(func, x):
"trunc",
"matmul",
"matrix_transpose",
"tensordot",
"concat",
"expand_dims",
"flip",
"permute_dims",
"repeat",
"reshape",
"roll",
"squeeze",
Expand Down
5 changes: 0 additions & 5 deletions tests/test_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -658,11 +658,6 @@ def test_array_creation_with_invalid_fields():
)


def test_promote_nullable():
with pytest.warns(DeprecationWarning):
assert ndx.promote_nullable(np.int64) == ndx.nint64


@pytest.mark.parametrize(
"operation", [ndx.sin, ndx.cos, ndx.tan, ndx.sinh, ndx.mean, ndx.sum, ndx.abs]
)
Expand Down

0 comments on commit e277f9f

Please sign in to comment.