Skip to content

Commit 9ae90e8

Browse files
committed
Removed match/case that will have to wait.
1 parent d3407d7 commit 9ae90e8

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

bson/binary.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -599,15 +599,15 @@ def as_numpy_vector(self) -> BinaryVector:
599599
raise ImportError("Converting binary to numpy.ndarray requires numpy to be installed.")
600600
dtype, padding = struct.unpack_from("<sB", self, 0)
601601
dtype = BinaryVectorDtype(dtype)
602-
match dtype:
603-
case BinaryVectorDtype.INT8:
604-
data = np.frombuffer(self[2:], dtype="int8")
605-
case BinaryVectorDtype.FLOAT32:
606-
data = np.frombuffer(self[2:], dtype="float32")
607-
case BinaryVectorDtype.PACKED_BIT:
608-
data = np.frombuffer(self[2:], dtype="uint8")
609-
case _:
610-
raise ValueError(f"Unsupported dtype code: {dtype!r}")
602+
603+
if dtype == BinaryVectorDtype.INT8:
604+
data = np.frombuffer(self[2:], dtype="int8")
605+
elif dtype == BinaryVectorDtype.FLOAT32:
606+
data = np.frombuffer(self[2:], dtype="float32")
607+
elif dtype == BinaryVectorDtype.PACKED_BIT:
608+
data = np.frombuffer(self[2:], dtype="uint8")
609+
else:
610+
raise ValueError(f"Unsupported dtype code: {dtype!r}")
611611
return BinaryVector(data, dtype, padding)
612612

613613
def __getnewargs__(self) -> Tuple[bytes, int]: # type: ignore[override]

0 commit comments

Comments
 (0)