From 633a4d73f257d3d1e73f8fdae24f2ddcca724399 Mon Sep 17 00:00:00 2001 From: Konstantin Baikov Date: Thu, 5 Dec 2024 20:17:22 +0100 Subject: [PATCH] Use union instead of overloads in dateutil (#13184) --- stubs/python-dateutil/dateutil/relativedelta.pyi | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/stubs/python-dateutil/dateutil/relativedelta.pyi b/stubs/python-dateutil/dateutil/relativedelta.pyi index 7f228880c..9de928158 100644 --- a/stubs/python-dateutil/dateutil/relativedelta.pyi +++ b/stubs/python-dateutil/dateutil/relativedelta.pyi @@ -63,24 +63,16 @@ class relativedelta: @weeks.setter def weeks(self, value: int) -> None: ... def normalized(self) -> Self: ... - # TODO: use Union when mypy will handle it properly in overloaded operator - # methods (#2129, #1442, #1264 in mypy) @overload - def __add__(self, other: relativedelta) -> Self: ... - @overload - def __add__(self, other: timedelta) -> Self: ... + def __add__(self, other: timedelta | relativedelta) -> Self: ... @overload def __add__(self, other: _DateT) -> _DateT: ... @overload - def __radd__(self, other: relativedelta) -> Self: ... - @overload - def __radd__(self, other: timedelta) -> Self: ... + def __radd__(self, other: timedelta | relativedelta) -> Self: ... @overload def __radd__(self, other: _DateT) -> _DateT: ... @overload - def __rsub__(self, other: relativedelta) -> Self: ... - @overload - def __rsub__(self, other: timedelta) -> Self: ... + def __rsub__(self, other: timedelta | relativedelta) -> Self: ... @overload def __rsub__(self, other: _DateT) -> _DateT: ... def __sub__(self, other: relativedelta) -> Self: ...