File tree Expand file tree Collapse file tree 2 files changed +5
-5
lines changed Expand file tree Collapse file tree 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:
2727 # Convert Enum values to strings
2828 return "\n " .join (
2929 (
30- enum_as_str (message ["chain" ]),
30+ enum_as_str (message ["chain" ]) or "" ,
3131 message ["sender" ],
32- enum_as_str (message ["type" ]),
32+ enum_as_str (message ["type" ]) or "" ,
3333 message ["item_hash" ],
3434 )
3535 ).encode ()
Original file line number Diff line number Diff 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 ]]) -> str :
118+ def enum_as_str (obj : Optional [Union [str , Enum ]]) -> Optional [ 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 """
124- if obj is None :
125- return ""
124+ if not obj :
125+ return None
126126 if not isinstance (obj , str ):
127127 raise TypeError (f"Unsupported enum type: { type (obj )} " )
128128
You can’t perform that action at this time.
0 commit comments