Skip to content

Commit

Permalink
padding does need to be an integer
Browse files Browse the repository at this point in the history
  • Loading branch information
caseyclements committed Oct 1, 2024
1 parent 8946daf commit 9397129
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions bson/binary.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import struct
from dataclasses import dataclass
from enum import Enum
from typing import TYPE_CHECKING, Any, Optional, Sequence, Tuple, Type, Union
from typing import TYPE_CHECKING, Any, Sequence, Tuple, Type, Union
from uuid import UUID

"""Tools for representing BSON binary data.
Expand Down Expand Up @@ -406,7 +406,7 @@ def from_vector(
cls: Type[Binary],
vector: list[int, float],
dtype: BinaryVectorDtype,
padding: Optional[int] = None,
padding: int = 0,
) -> Binary:
"""**(BETA)** Create a BSON :class:`~bson.binary.Binary` of Vector subtype from a list of Numbers.
Expand All @@ -428,7 +428,6 @@ def from_vector(
raise ValueError(f"padding does not apply to {dtype=}")
elif dtype == BinaryVectorDtype.PACKED_BIT: # pack ints in [0, 255] as unsigned uint8
format_str = "B"
padding = 0 if padding is None else padding
elif dtype == BinaryVectorDtype.FLOAT32: # pack floats as float32
format_str = "f"
if padding:
Expand Down

0 comments on commit 9397129

Please sign in to comment.