We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent c542c60 commit 6a90fe3Copy full SHA for 6a90fe3
src/aleph/sdk/utils.py
@@ -115,14 +115,14 @@ async def copy_async_readable_to_buffer(
115
buffer.write(chunk)
116
117
118
-def enum_as_str(obj: Optional[Union[str, Enum]]) -> Optional[str]:
+def enum_as_str(obj: Optional[Union[str, Enum]]) -> str:
119
"""Returns the value of an Enum, or the string itself when passing a string.
120
121
Python 3.11 adds a new formatting of string enums.
122
`str(MyEnum.value)` becomes `MyEnum.value` instead of `value`.
123
"""
124
if obj is None:
125
- return None
+ return ""
126
if not isinstance(obj, str):
127
raise TypeError(f"Unsupported enum type: {type(obj)}")
128
0 commit comments