scio enums#

In many place in this package, we use Enum classes in conjunction with Literal as follows:

class Arg(str, Enum):
   '''Enum for supported ``arg`` values.'''

   __slots__ = ()

   VALUE1 = "value1"
   VALUE2 = "value2"


type ArgLike = Arg | Literal["value1", "value2"]

This allows static type checkers to understand direct API calls such as func("value1"), while also providing runtime sanitization for more complex uses such as func(Arg(kw[0])).

In fact, we derive such enums from a custom base EnumWithExplicitSupport, which adds nice little tweaks.

EnumWithExplicitSupport

Base Enum for explicit error message.

Used enums

AggrName

Enum for supported named \(1\)D aggregation methods.

ClassAggr

Enum for supported class_aggregation in JTLA.

IndexMetric

Enum for supported metric values in Index.

InterpolationKind

Enum for supported ROC interpolation methods.

LabelKind

Enum for supported calib_labels values with Gram.

MultinomialTestMode

Enum for supported mode in multinomial_test().

ScoreClassifMode

Enum for supported mode in classification scores.

ScoreTimerOperation

Enum for supported operations timed by ScoreTimer.

ZAggr

Enum for supported \(z\)-aggregation schemes in Odds.