Skip to content

Commit

Permalink
fix Weight, etc. pending scikit-hep/awkward#1841
Browse files Browse the repository at this point in the history
  • Loading branch information
lgray committed Mar 15, 2023
1 parent de120e4 commit 942d8e5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions coffea/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
6 changes: 3 additions & 3 deletions tests/test_analysis_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 942d8e5

Please sign in to comment.