Skip to content

Commit 6be20b3

Browse files
authored
Publicly expose is_nullable_numeric_dtype and get_data functions (#213)
1 parent 34552fe commit 6be20b3

2 files changed

Lines changed: 22 additions & 4 deletions

File tree

CHANGELOG.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,14 @@
77
Changelog
88
=========
99

10+
0.19.0 (2026-05-15)
11+
-------------------
12+
13+
**New feature**
14+
15+
- The :mod:`~ndonnx.extensions` module now publicly exposes the :func:`~ndonnx.extensions.is_nullable_numeric_dtype` and :func:`~ndonnx.extensions.get_data` functions.
16+
17+
1018
0.18.2 (2026-05-06)
1119
-------------------
1220

ndonnx/extensions.py

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,11 @@
1010
from typing_extensions import TypeIs, deprecated
1111

1212
import ndonnx as ndx
13-
14-
from . import _typed_array as tydx
15-
from ._typed_array.masked_onnx import TyMaArray
13+
import ndonnx._typed_array as tydx
14+
import ndonnx._typed_array.datetime
15+
import ndonnx._typed_array.funcs
16+
import ndonnx._typed_array.masked_onnx
17+
import ndonnx._typed_array.onnx
1618

1719
SCALAR = TypeVar("SCALAR", int, float, str)
1820

@@ -198,7 +200,7 @@ def make_nullable(
198200
null = None if null is None else null.copy()
199201

200202
if null is None:
201-
if isinstance(x._tyarray, TyMaArray):
203+
if isinstance(x._tyarray, tydx.masked_onnx.TyMaArray):
202204
return x
203205
if isinstance(x._tyarray, tydx.onnx.TyArray):
204206
return ndx.Array._from_tyarray(
@@ -399,6 +401,12 @@ def is_nullable_dtype(dtype: ndx.DType, /) -> TypeIs[tydx.masked_onnx.DTypes]:
399401
return isinstance(dtype, tydx.masked_onnx.DTypes)
400402

401403

404+
def is_nullable_numeric_dtype(
405+
dtype: ndx.DType, /
406+
) -> TypeIs[tydx.masked_onnx.NumericDTypes]:
407+
return is_nullable_integer_dtype(dtype) or is_nullable_float_dtype(dtype)
408+
409+
402410
def is_nullable_integer_dtype(
403411
dtype: ndx.DType, /
404412
) -> TypeIs[tydx.masked_onnx.IntegerDTypes]:
@@ -423,11 +431,13 @@ def is_time_unit(s: str, /) -> TypeIs[tydx.datetime.Unit]:
423431
"datetime_to_year_month_day",
424432
"fill_null",
425433
"get_mask",
434+
"get_data",
426435
"is_float_dtype",
427436
"is_integer_dtype",
428437
"is_nullable_dtype",
429438
"is_nullable_float_dtype",
430439
"is_nullable_integer_dtype",
440+
"is_nullable_numeric_dtype",
431441
"is_numeric_dtype",
432442
"is_onnx_dtype",
433443
"is_signed_integer_dtype",

0 commit comments

Comments
 (0)