diff --git a/infrahub_sdk/timestamp.py b/infrahub_sdk/timestamp.py index fd69122e..e826021a 100644 --- a/infrahub_sdk/timestamp.py +++ b/infrahub_sdk/timestamp.py @@ -5,7 +5,7 @@ from datetime import datetime, timezone from typing import Literal, TypedDict -from typing_extensions import NotRequired +from typing_extensions import NotRequired, Self from whenever import Date, Instant, OffsetDateTime, PlainDateTime, Time, ZonedDateTime from .exceptions import TimestampFormatError @@ -147,7 +147,7 @@ def __ge__(self, other: object) -> bool: def __hash__(self) -> int: return hash(self.to_string()) - def add_delta(self, hours: int = 0, minutes: int = 0, seconds: int = 0, microseconds: int = 0) -> Timestamp: + def add_delta(self, hours: int = 0, minutes: int = 0, seconds: int = 0, microseconds: int = 0) -> Self: warnings.warn( "add_delta() is deprecated. Use add() instead.", UserWarning, @@ -168,7 +168,7 @@ def add( microseconds: float = 0, nanoseconds: int = 0, disambiguate: Literal["compatible"] = "compatible", - ) -> Timestamp: + ) -> Self: return self.__class__( self._obj.add( years=years, @@ -198,7 +198,7 @@ def subtract( microseconds: float = 0, nanoseconds: int = 0, disambiguate: Literal["compatible"] = "compatible", - ) -> Timestamp: + ) -> Self: return self.__class__( self._obj.subtract( years=years,