Skip to content

Commit 6a90fe3

Browse files
philogicaeMHHukiewitz
authored andcommitted
Fix wrong type on enum_as_str by removing Optional
1 parent c542c60 commit 6a90fe3

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/aleph/sdk/utils.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -115,14 +115,14 @@ async def copy_async_readable_to_buffer(
115115
buffer.write(chunk)
116116

117117

118-
def enum_as_str(obj: Optional[Union[str, Enum]]) -> Optional[str]:
118+
def enum_as_str(obj: Optional[Union[str, Enum]]) -> str:
119119
"""Returns the value of an Enum, or the string itself when passing a string.
120120
121121
Python 3.11 adds a new formatting of string enums.
122122
`str(MyEnum.value)` becomes `MyEnum.value` instead of `value`.
123123
"""
124124
if obj is None:
125-
return None
125+
return ""
126126
if not isinstance(obj, str):
127127
raise TypeError(f"Unsupported enum type: {type(obj)}")
128128

0 commit comments

Comments
 (0)