From 51446f35fc1795166178e22ce9b73dfe884729e1 Mon Sep 17 00:00:00 2001 From: Katelyn Gigante Date: Tue, 15 May 2018 23:04:57 +1000 Subject: [PATCH] Add stub for dateutil.rrule (#1808) --- third_party/2and3/dateutil/_common.pyi | 13 +++ third_party/2and3/dateutil/relativedelta.pyi | 15 +-- third_party/2and3/dateutil/rrule.pyi | 103 +++++++++++++++++++ 3 files changed, 118 insertions(+), 13 deletions(-) create mode 100644 third_party/2and3/dateutil/_common.pyi create mode 100644 third_party/2and3/dateutil/rrule.pyi diff --git a/third_party/2and3/dateutil/_common.pyi b/third_party/2and3/dateutil/_common.pyi new file mode 100644 index 000000000..45ebbb827 --- /dev/null +++ b/third_party/2and3/dateutil/_common.pyi @@ -0,0 +1,13 @@ +from typing import Optional + +class weekday(object): + def __init__(self, weekday: int, n: Optional[int]=...) -> None: ... + + def __call__(self, n: int) -> 'weekday': ... + + def __eq__(self, other) -> bool: ... + + def __repr__(self) -> str: ... + + weekday = ... # type: int + n = ... # type: int diff --git a/third_party/2and3/dateutil/relativedelta.pyi b/third_party/2and3/dateutil/relativedelta.pyi index 71b3aeeff..57fdaf313 100644 --- a/third_party/2and3/dateutil/relativedelta.pyi +++ b/third_party/2and3/dateutil/relativedelta.pyi @@ -1,24 +1,13 @@ from typing import overload, Any, List, Optional, SupportsFloat, TypeVar, Union from datetime import date, datetime, timedelta +from ._common import weekday + __all__ = ... # type: List[str] _SelfT = TypeVar('_SelfT', bound=relativedelta) _DateT = TypeVar('_DateT', date, datetime) - -class weekday(object): - def __init__(self, weekday: int, n: Optional[int]=...) -> None: ... - - def __call__(self, n: int) -> 'weekday': ... - - def __eq__(self, other) -> bool: ... - - def __repr__(self) -> str: ... - - weekday = ... # type: int - n = ... # type: int - MO = ... # type: weekday TU = ... # type: weekday WE = ... # type: weekday diff --git a/third_party/2and3/dateutil/rrule.pyi b/third_party/2and3/dateutil/rrule.pyi new file mode 100644 index 000000000..f8ab9d29a --- /dev/null +++ b/third_party/2and3/dateutil/rrule.pyi @@ -0,0 +1,103 @@ +from ._common import weekday as weekdaybase +from typing import Any, Iterable, Optional, Union +import datetime + +YEARLY: int +MONTHLY: int +WEEKLY: int +DAILY: int +HOURLY: int +MINUTELY: int +SECONDLY: int + +class weekday(weekdaybase): + ... + +MO: weekday +TU: weekday +WE: weekday +TH: weekday +FR: weekday +SA: weekday +SU: weekday + +class rrulebase: + def __init__(self, cache: bool = ...) -> None: ... + def __iter__(self): ... + def __getitem__(self, item): ... + def __contains__(self, item): ... + def count(self): ... + def before(self, dt, inc: bool = ...): ... + def after(self, dt, inc: bool = ...): ... + def xafter(self, dt, count: Optional[Any] = ..., inc: bool = ...): ... + def between(self, after, before, inc: bool = ..., count: int = ...): ... + +class rrule(rrulebase): + def __init__(self, + freq, + dtstart: Optional[datetime.datetime] = ..., + interval: int = ..., + wkst: Optional[Union[weekday, int]] = ..., + count: Optional[int] = ..., + until: Optional[Union[datetime.datetime, int]] = ..., + bysetpos: Optional[Union[int, Iterable[int]]] = ..., + bymonth: Optional[Union[int, Iterable[int]]] = ..., + bymonthday: Optional[Union[int, Iterable[int]]] = ..., + byyearday: Optional[Union[int, Iterable[int]]] = ..., + byeaster: Optional[Union[int, Iterable[int]]] = ..., + byweekno: Optional[Union[int, Iterable[int]]] = ..., + byweekday: Optional[Union[int, Iterable[int]]] = ..., + byhour: Optional[Union[int, Iterable[int]]] = ..., + byminute: Optional[Union[int, Iterable[int]]] = ..., + bysecond: Optional[Union[int, Iterable[int]]] = ..., + cache: bool = ...) -> None: ... + def replace(self, **kwargs): ... + +class _iterinfo: + rrule: Any = ... + def __init__(self, rrule) -> None: ... + yearlen: int = ... + nextyearlen: int = ... + yearordinal: int = ... + yearweekday: int = ... + mmask: Any = ... + mdaymask: Any = ... + nmdaymask: Any = ... + wdaymask: Any = ... + mrange: Any = ... + wnomask: Any = ... + nwdaymask: Any = ... + eastermask: Any = ... + lastyear: int = ... + lastmonth: int = ... + def rebuild(self, year, month): ... + def ydayset(self, year, month, day): ... + def mdayset(self, year, month, day): ... + def wdayset(self, year, month, day): ... + def ddayset(self, year, month, day): ... + def htimeset(self, hour, minute, second): ... + def mtimeset(self, hour, minute, second): ... + def stimeset(self, hour, minute, second): ... + +class rruleset(rrulebase): + class _genitem: + dt: Any = ... + genlist: Any = ... + gen: Any = ... + def __init__(self, genlist, gen) -> None: ... + def __next__(self): ... + next: Any = ... + def __lt__(self, other): ... + def __gt__(self, other): ... + def __eq__(self, other): ... + def __ne__(self, other): ... + def __init__(self, cache: bool = ...) -> None: ... + def rrule(self, rrule): ... + def rdate(self, rdate): ... + def exrule(self, exrule): ... + def exdate(self, exdate): ... + +class _rrulestr: + def __call__(self, s, **kwargs): ... + +rrulestr: _rrulestr