Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion type_def/size.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
# SPDX-License-Identifier: BSD-3-Clause
#

from __future__ import annotations

import enum
import math
import random
Expand Down Expand Up @@ -181,7 +183,10 @@ def __rmul__(self, other: float | int):
return Size(math.ceil(self.get_value() * other))

@multimethod
def __truediv__(self, other: float | int):
def __truediv__(self, other: float | int | Size):
if isinstance(other, Size):
other = other.get_value()
return math.ceil(self.get_value() / other)
if other == 0:
raise ValueError("Divisor must not be equal to 0.")
return Size(math.ceil(self.get_value() / other))
Expand Down
Loading