File tree Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -7,22 +7,22 @@ def _missing_(cls, value):
77 if isinstance (value , str ):
88 upper_value = value .upper ()
99
10- key = StringEnum . _key_from_str_ (upper_value )
10+ key = cls . _key_from_str (upper_value )
1111 if key is not None :
1212 return key
1313
1414 lower_value = value .lower ()
1515
16- key = StringEnum . _key_from_str_ (lower_value )
16+ key = cls . _key_from_str (lower_value )
1717 if key is not None :
1818 return key
1919
2020 raise ValueError (f"{ value } is not a valid { cls .__name__ } " )
2121
2222 @classmethod
23- def _key_from_str_ (cls , value : str ):
24- if value in cls .__members__ :
25- return cls ( value )
23+ def _key_from_str (cls , value : str ):
24+ if value in cls ._member_map_ . keys () :
25+ return cls . _member_map_ [ value ]
2626
2727 return None
2828
You can’t perform that action at this time.
0 commit comments