We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 094d703 commit 4f3d094Copy full SHA for 4f3d094
src/aleph/sdk/utils.py
@@ -85,8 +85,10 @@ def enum_as_str(obj: Union[str, Enum]) -> str:
85
Python 3.11 adds a new formatting of string enums.
86
`str(MyEnum.value)` becomes `MyEnum.value` instead of `value`.
87
"""
88
- if isinstance(obj, str):
89
- return obj
90
- else:
91
- assert isinstance(obj, Enum)
+ if not isinstance(obj, str):
+ raise TypeError(f"Unsupported enum type: {type(obj)}")
+
+ if isinstance(obj, Enum):
92
return obj.value
93
94
+ return obj
0 commit comments