MCPcopy Create free account
hub / github.com/catboost/catboost / enum_from_enum_or_str

Function enum_from_enum_or_str

catboost/python-package/catboost/core.py:258–264  ·  view source on GitHub ↗
(enum_type, arg)

Source from the content-addressed store, hash-verified

256
257
258def enum_from_enum_or_str(enum_type, arg):
259 if isinstance(arg, enum_type):
260 return arg
261 elif isinstance(arg, str):
262 return enum_type[arg]
263 else:
264 raise Exception("can't create enum " + str(enum_type) + " from type " + str(type(arg)))
265
266
267class EFstrType(Enum):

Callers 2

select_featuresMethod · 0.85

Calls 3

isinstanceFunction · 0.85
strClass · 0.50
typeClass · 0.50

Tested by

no test coverage detected