Skip to content

Commit

Permalink
fix: the result of group_mapping() should be checked for None
Browse files Browse the repository at this point in the history
Signed-off-by: Henry Schreiner <[email protected]>
  • Loading branch information
henryiii committed Aug 23, 2024
1 parent deb759b commit 3e2d9e3
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
5 changes: 1 addition & 4 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
[submodule "pybind11"]
path = extern/pybind11
url = ../../pybind/pybind11.git
[submodule "extern/boosthistogram"]
[submodule "extern/histogram"]
path = extern/histogram
url = ../../boostorg/histogram.git
[submodule "extern/core"]
Expand Down
8 changes: 6 additions & 2 deletions src/boost_histogram/_internal/hist.py
Original file line number Diff line number Diff line change
Expand Up @@ -862,8 +862,12 @@ def __getitem__(self: H, index: IndexingExpr) -> H | float | Accumulator:
if ind.step is not None:
if getattr(ind.step, "factor", None) is not None:
merge = ind.step.factor
elif getattr(ind.step, "group_mapping", None) is not None:
groups = ind.step.group_mapping(self.axes[i])
elif (
hasattr(ind.step, "group_mapping")
and (tmp_groups := ind.step.group_mapping(self.axes[i]))
is not None
):
groups = tmp_groups
elif callable(ind.step):
if ind.step is sum:
integrations.add(i)
Expand Down
2 changes: 1 addition & 1 deletion src/boost_histogram/tag.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

from ._internal.typing import AxisLike

__all__ = ("Slicer", "Locator", "at", "loc", "overflow", "underflow", "sum", "rebin")
__all__ = ("Slicer", "Locator", "at", "loc", "overflow", "underflow", "rebin", "sum")


class Slicer:
Expand Down

0 comments on commit 3e2d9e3

Please sign in to comment.