File tree 2 files changed +5
-5
lines changed
2 files changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -27,9 +27,9 @@ def get_verification_buffer(message: Dict) -> bytes:
27
27
# Convert Enum values to strings
28
28
return "\n " .join (
29
29
(
30
- enum_as_str (message ["chain" ]),
30
+ enum_as_str (message ["chain" ]) or "" ,
31
31
message ["sender" ],
32
- enum_as_str (message ["type" ]),
32
+ enum_as_str (message ["type" ]) or "" ,
33
33
message ["item_hash" ],
34
34
)
35
35
).encode ()
Original file line number Diff line number Diff line change @@ -115,14 +115,14 @@ async def copy_async_readable_to_buffer(
115
115
buffer .write (chunk )
116
116
117
117
118
- def enum_as_str (obj : Optional [Union [str , Enum ]]) -> str :
118
+ def enum_as_str (obj : Optional [Union [str , Enum ]]) -> Optional [ str ] :
119
119
"""Returns the value of an Enum, or the string itself when passing a string.
120
120
121
121
Python 3.11 adds a new formatting of string enums.
122
122
`str(MyEnum.value)` becomes `MyEnum.value` instead of `value`.
123
123
"""
124
- if obj is None :
125
- return ""
124
+ if not obj :
125
+ return None
126
126
if not isinstance (obj , str ):
127
127
raise TypeError (f"Unsupported enum type: { type (obj )} " )
128
128
You can’t perform that action at this time.
0 commit comments