Skip to content

Commit cadacab

Browse files
bluetechJelleZijlstra
authored andcommitted
Add missing attributes to the dateutil/relativedelta stub (#2319)
I have deduced the types from docstring & source code of the relativedelta class. Fixes #2269.
1 parent a38dbc6 commit cadacab

File tree

1 file changed

+26
-8
lines changed

1 file changed

+26
-8
lines changed

third_party/2and3/dateutil/relativedelta.pyi

Lines changed: 26 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,35 @@ from ._common import weekday
66

77
_SelfT = TypeVar('_SelfT', bound=relativedelta)
88
_DateT = TypeVar('_DateT', date, datetime)
9+
# Work around attribute and type having the same name.
10+
_weekday = weekday
911

10-
MO = ... # type: weekday
11-
TU = ... # type: weekday
12-
WE = ... # type: weekday
13-
TH = ... # type: weekday
14-
FR = ... # type: weekday
15-
SA = ... # type: weekday
16-
SU = ... # type: weekday
12+
MO: weekday
13+
TU: weekday
14+
WE: weekday
15+
TH: weekday
16+
FR: weekday
17+
SA: weekday
18+
SU: weekday
1719

1820

1921
class relativedelta(object):
22+
years: int
23+
months: int
24+
days: int
25+
leapdays: int
26+
hours: int
27+
minutes: int
28+
seconds: int
29+
microseconds: int
30+
year: Optional[int]
31+
month: Optional[int]
32+
weekday: Optional[_weekday]
33+
day: Optional[int]
34+
hour: Optional[int]
35+
minute: Optional[int]
36+
second: Optional[int]
37+
microsecond: Optional[int]
2038
def __init__(self,
2139
dt1: Optional[date]=...,
2240
dt2: Optional[date]=...,
@@ -27,7 +45,7 @@ class relativedelta(object):
2745
seconds: Optional[int]=..., microseconds: Optional[int]=...,
2846
year: Optional[int]=..., month: Optional[int]=...,
2947
day: Optional[int]=...,
30-
weekday: Optional[Union[int, weekday]]=...,
48+
weekday: Optional[Union[int, _weekday]]=...,
3149
yearday: Optional[int]=...,
3250
nlyearday: Optional[int]=...,
3351
hour: Optional[int]=..., minute: Optional[int]=...,

0 commit comments

Comments
 (0)