From b00a8a7f21c49141fb30ef51baf00043ef9400bc Mon Sep 17 00:00:00 2001 From: Julian Vogel Date: Mon, 16 Sep 2024 15:16:20 +0200 Subject: [PATCH] model.datatypes: fix bytes copy issue for Date class --- basyx/aas/model/datatypes.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/basyx/aas/model/datatypes.py b/basyx/aas/model/datatypes.py index f20c4d045..fb2a622d6 100644 --- a/basyx/aas/model/datatypes.py +++ b/basyx/aas/model/datatypes.py @@ -78,6 +78,17 @@ def __eq__(self, other: object) -> bool: other_tzinfo = other.tzinfo if hasattr(other, 'tzinfo') else None # type: ignore return datetime.date.__eq__(self, other) and self.tzinfo == other_tzinfo + def __copy__(self): + cls = self.__class__ + result = cls.__new__(cls, self.year, self.month, self.day, self.tzinfo) + return result + + def __deepcopy__(self, memo): + cls = self.__class__ + result = cls.__new__(cls, self.year, self.month, self.day, self.tzinfo) + memo[id(self)] = result + return result + # TODO override comparsion operators # TODO add into_datetime function # TODO add includes(:DateTime) -> bool function