MCPcopy Create free account
hub / github.com/SooLab/CGFormer / ExplicitEnum

Class ExplicitEnum

bert/tokenization_utils_base.py:74–83  ·  view source on GitHub ↗

Enum with more explicit error message for missing values.

Source from the content-addressed store, hash-verified

72
73
74class ExplicitEnum(Enum):
75 """ Enum with more explicit error message for missing values.
76 """
77
78 @classmethod
79 def _missing_(cls, value):
80 raise ValueError(
81 "%r is not a valid %s, please select one of %s"
82 % (value, cls.__name__, str(list(cls._value2member_map_.keys())))
83 )
84
85
86class TruncationStrategy(ExplicitEnum):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected