diff --git a/coffea/util.py b/coffea/util.py index ee456a56bd..3e9d62c376 100644 --- a/coffea/util.py +++ b/coffea/util.py @@ -73,9 +73,9 @@ def _ensure_flat(array, allow_missing=False): aktype = ak.type(array) if not isinstance(aktype, ak.types.ArrayType): raise ValueError("Expected an array type, received: %r" % aktype) - isprimitive = isinstance(aktype.type, ak.types.PrimitiveType) - isoptionprimitive = isinstance(aktype.type, ak.types.OptionType) and isinstance( - aktype.type.type, ak.types.PrimitiveType + isprimitive = isinstance(aktype.content, ak.types.NumpyType) + isoptionprimitive = isinstance(aktype.content, ak.types.OptionType) and isinstance( + aktype.content.content, ak.types.NumpyType ) if allow_missing and not (isprimitive or isoptionprimitive): raise ValueError( diff --git a/tests/test_analysis_tools.py b/tests/test_analysis_tools.py index aeebd93555..476140416b 100644 --- a/tests/test_analysis_tools.py +++ b/tests/test_analysis_tools.py @@ -167,12 +167,12 @@ def test_packed_selection(): sel = PackedSelection() shape = (10,) - all_true = np.full(shape=shape, fill_value=True, dtype=np.bool) - all_false = np.full(shape=shape, fill_value=False, dtype=np.bool) + all_true = np.full(shape=shape, fill_value=True, dtype=bool) + all_false = np.full(shape=shape, fill_value=False, dtype=bool) fizz = np.arange(shape[0]) % 3 == 0 buzz = np.arange(shape[0]) % 5 == 0 ones = np.ones(shape=shape, dtype=np.uint64) - wrong_shape = ones = np.ones(shape=(shape[0] - 5,), dtype=np.bool) + wrong_shape = ones = np.ones(shape=(shape[0] - 5,), dtype=bool) sel.add("all_true", all_true) sel.add("all_false", all_false)