Skip to content

Commit be6af5b

Browse files
committed
Ditch the match/case
1 parent a7e137c commit be6af5b

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

quixstreams/state/rocksdb/timestamped.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -203,13 +203,11 @@ def _ensure_bytes(self, prefix: Any) -> bytes:
203203
return serialize(prefix, dumps=self._dumps)
204204

205205
def _serialize_key(self, key: Union[int, bytes], prefix: bytes) -> bytes:
206-
match key:
207-
case int():
208-
return prefix + SEPARATOR + int_to_int64_bytes(key)
209-
case bytes():
210-
return prefix + SEPARATOR + key
211-
case _:
212-
raise ValueError(f"Invalid key type: {type(key)}")
206+
if isinstance(key, int):
207+
return prefix + SEPARATOR + int_to_int64_bytes(key)
208+
elif isinstance(key, bytes):
209+
return prefix + SEPARATOR + key
210+
raise ValueError(f"Invalid key type: {type(key)}")
213211

214212
def _get_latest_timestamp(self, prefix: bytes, timestamp: int) -> Any:
215213
"""

0 commit comments

Comments
 (0)