@@ -583,15 +583,15 @@ def _repr_args_(self) -> list[str]:
583583
584584 if self .traits .growth :
585585 ret .append ("growth=True" )
586- elif self .traits .circular :
587- ret .append ("circular=True " )
586+ elif not self .traits .overflow :
587+ ret .append ("overflow=False " )
588588
589589 ret += super ()._repr_args_ ()
590590 return ret
591591
592592
593593@set_module ("boost_histogram.axis" )
594- @register ({ca .category_str_growth , ca .category_str })
594+ @register ({ca .category_str_growth , ca .category_str , ca . category_str_none })
595595class StrCategory (BaseCategory , family = boost_histogram ):
596596 __slots__ = ()
597597
@@ -601,6 +601,7 @@ def __init__(
601601 * ,
602602 metadata : Any = None ,
603603 growth : bool = False ,
604+ overflow : bool = True ,
604605 __dict__ : dict [str , Any ] | None = None ,
605606 ):
606607 """
@@ -618,21 +619,25 @@ def __init__(
618619 growth : bool = False
619620 Allow the axis to grow if a value is encountered out of range.
620621 Be careful, the axis will grow as large as needed.
622+ overflow : bool = True
623+ Include an overflow bin for "missed" hits. Ignored if growth=True.
621624 __dict__: Optional[Dict[str, Any]] = None
622625 The full metadata dictionary
623626 """
624627
625- options = _opts (growth = growth )
628+ options = _opts (growth = growth , overflow = overflow )
626629
627630 ax : ca ._BaseCatStr
628631
629632 # henryiii: We currently expand "abc" to "a", "b", "c" - some
630633 # Python interfaces protect against that
631634
632- if options == { "growth" } :
635+ if "growth" in options :
633636 ax = ca .category_str_growth (tuple (categories ))
634- elif options == set () :
637+ elif options == { "overflow" } :
635638 ax = ca .category_str (tuple (categories ))
639+ elif not options :
640+ ax = ca .category_str_none (tuple (categories ))
636641 else :
637642 raise KeyError ("Unsupported collection of options" )
638643
@@ -659,7 +664,7 @@ def _repr_args_(self) -> list[str]:
659664
660665
661666@set_module ("boost_histogram.axis" )
662- @register ({ca .category_int , ca .category_int_growth })
667+ @register ({ca .category_int , ca .category_int_growth , ca . category_int_none })
663668class IntCategory (BaseCategory , family = boost_histogram ):
664669 __slots__ = ()
665670
@@ -669,6 +674,7 @@ def __init__(
669674 * ,
670675 metadata : Any = None ,
671676 growth : bool = False ,
677+ overflow : bool = True ,
672678 __dict__ : dict [str , Any ] | None = None ,
673679 ):
674680 """
@@ -686,17 +692,21 @@ def __init__(
686692 growth : bool = False
687693 Allow the axis to grow if a value is encountered out of range.
688694 Be careful, the axis will grow as large as needed.
695+ overflow : bool = True
696+ Include an overflow bin for "missed" hits. Ignored if growth=True.
689697 __dict__: Optional[Dict[str, Any]] = None
690698 The full metadata dictionary
691699 """
692700
693- options = _opts (growth = growth )
701+ options = _opts (growth = growth , overflow = overflow )
694702 ax : ca ._BaseCatInt
695703
696- if options == { "growth" } :
704+ if "growth" in options :
697705 ax = ca .category_int_growth (tuple (categories ))
698- elif options == set () :
706+ elif options == { "overflow" } :
699707 ax = ca .category_int (tuple (categories ))
708+ elif not options :
709+ ax = ca .category_int_none (tuple (categories ))
700710 else :
701711 raise KeyError ("Unsupported collection of options" )
702712
0 commit comments