Closed suffixing closed 1 year ago
if isinstance(value, list): return cls(*[getattr(cls, val.upper()) for val in value]) return getattr(cls, value.upper(), super()._missing_(value))
replaced if statements with a getattr() call, converts the input to uppercase, and used a list comprehension
getattr()
return getattr(cls, value.upper(), super()._missing_(value))
return the attribute with given value using getattr(). If the attribute is not found, it falls back to the default _missing_ implementation.
_missing_
replaced if statements with a
getattr()
call, converts the input to uppercase, and used a list comprehensionreturn the attribute with given value using
getattr()
. If the attribute is not found, it falls back to the default_missing_
implementation.