From 14d535911c392171ece9468ba99705781eb2c20d Mon Sep 17 00:00:00 2001 From: Stefan Harmuth Date: Fri, 22 Dec 2023 05:55:29 +0100 Subject: [PATCH] NEW: Coordinate().__mod__() --- src/tools/coordinate.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/tools/coordinate.py b/src/tools/coordinate.py index 139c4ef..8ab4e62 100644 --- a/src/tools/coordinate.py +++ b/src/tools/coordinate.py @@ -290,6 +290,12 @@ class Coordinate(tuple): else: return self.__class__(self[0] * other, self[1] * other, self[2] * other) + def __mod__(self, other: int) -> Coordinate: + if self[2] is None: + return self.__class__(self[0] % other, self[1] % other) + else: + return self.__class__(self[0] % other, self[1] % other, self[2] % other) + def __floordiv__(self, other: int | float) -> Coordinate: if self[2] is None: return self.__class__(self[0] // other, self[1] // other)