Skip to content

Commit 633a4d7

Browse files
authored
Use union instead of overloads in dateutil (#13184)
1 parent 6b98467 commit 633a4d7

File tree

1 file changed

+3
-11
lines changed

1 file changed

+3
-11
lines changed

stubs/python-dateutil/dateutil/relativedelta.pyi

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -63,24 +63,16 @@ class relativedelta:
6363
@weeks.setter
6464
def weeks(self, value: int) -> None: ...
6565
def normalized(self) -> Self: ...
66-
# TODO: use Union when mypy will handle it properly in overloaded operator
67-
# methods (#2129, #1442, #1264 in mypy)
6866
@overload
69-
def __add__(self, other: relativedelta) -> Self: ...
70-
@overload
71-
def __add__(self, other: timedelta) -> Self: ...
67+
def __add__(self, other: timedelta | relativedelta) -> Self: ...
7268
@overload
7369
def __add__(self, other: _DateT) -> _DateT: ...
7470
@overload
75-
def __radd__(self, other: relativedelta) -> Self: ...
76-
@overload
77-
def __radd__(self, other: timedelta) -> Self: ...
71+
def __radd__(self, other: timedelta | relativedelta) -> Self: ...
7872
@overload
7973
def __radd__(self, other: _DateT) -> _DateT: ...
8074
@overload
81-
def __rsub__(self, other: relativedelta) -> Self: ...
82-
@overload
83-
def __rsub__(self, other: timedelta) -> Self: ...
75+
def __rsub__(self, other: timedelta | relativedelta) -> Self: ...
8476
@overload
8577
def __rsub__(self, other: _DateT) -> _DateT: ...
8678
def __sub__(self, other: relativedelta) -> Self: ...

0 commit comments

Comments
 (0)