mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-07 12:44:28 +08:00
Re-organize directory structure (#4971)
See discussion in #2491 Co-authored-by: Ivan Levkivskyi <ilevkivskyi@dropbox.com>
This commit is contained in:
0
stubs/python-dateutil/dateutil/__init__.pyi
Normal file
0
stubs/python-dateutil/dateutil/__init__.pyi
Normal file
12
stubs/python-dateutil/dateutil/_common.pyi
Normal file
12
stubs/python-dateutil/dateutil/_common.pyi
Normal file
@@ -0,0 +1,12 @@
|
||||
from typing import Optional, TypeVar
|
||||
|
||||
_T = TypeVar("_T")
|
||||
|
||||
class weekday(object):
|
||||
def __init__(self, weekday: int, n: Optional[int] = ...) -> None: ...
|
||||
def __call__(self: _T, n: int) -> _T: ...
|
||||
def __eq__(self, other) -> bool: ...
|
||||
def __repr__(self) -> str: ...
|
||||
def __hash__(self) -> int: ...
|
||||
weekday: int
|
||||
n: int
|
||||
8
stubs/python-dateutil/dateutil/easter.pyi
Normal file
8
stubs/python-dateutil/dateutil/easter.pyi
Normal file
@@ -0,0 +1,8 @@
|
||||
from datetime import date
|
||||
from typing_extensions import Literal
|
||||
|
||||
EASTER_JULIAN: Literal[1]
|
||||
EASTER_ORTHODOX: Literal[2]
|
||||
EASTER_WESTERN: Literal[3]
|
||||
|
||||
def easter(year: int, method: Literal[1, 2, 3] = ...) -> date: ...
|
||||
51
stubs/python-dateutil/dateutil/parser.pyi
Normal file
51
stubs/python-dateutil/dateutil/parser.pyi
Normal file
@@ -0,0 +1,51 @@
|
||||
from datetime import datetime, tzinfo
|
||||
from typing import IO, Any, Dict, List, Mapping, Optional, Text, Tuple, Union
|
||||
|
||||
_FileOrStr = Union[bytes, Text, IO[str], IO[Any]]
|
||||
|
||||
class parserinfo(object):
|
||||
JUMP: List[str]
|
||||
WEEKDAYS: List[Tuple[str, str]]
|
||||
MONTHS: List[Tuple[str, str]]
|
||||
HMS: List[Tuple[str, str, str]]
|
||||
AMPM: List[Tuple[str, str]]
|
||||
UTCZONE: List[str]
|
||||
PERTAIN: List[str]
|
||||
TZOFFSET: Dict[str, int]
|
||||
def __init__(self, dayfirst: bool = ..., yearfirst: bool = ...) -> None: ...
|
||||
def jump(self, name: Text) -> bool: ...
|
||||
def weekday(self, name: Text) -> Optional[int]: ...
|
||||
def month(self, name: Text) -> Optional[int]: ...
|
||||
def hms(self, name: Text) -> Optional[int]: ...
|
||||
def ampm(self, name: Text) -> Optional[int]: ...
|
||||
def pertain(self, name: Text) -> bool: ...
|
||||
def utczone(self, name: Text) -> bool: ...
|
||||
def tzoffset(self, name: Text) -> Optional[int]: ...
|
||||
def convertyear(self, year: int) -> int: ...
|
||||
def validate(self, res: datetime) -> bool: ...
|
||||
|
||||
class parser(object):
|
||||
def __init__(self, info: Optional[parserinfo] = ...) -> None: ...
|
||||
def parse(
|
||||
self,
|
||||
timestr: _FileOrStr,
|
||||
default: Optional[datetime] = ...,
|
||||
ignoretz: bool = ...,
|
||||
tzinfos: Optional[Mapping[Text, tzinfo]] = ...,
|
||||
**kwargs: Any,
|
||||
) -> datetime: ...
|
||||
|
||||
def isoparse(dt_str: Union[str, bytes, IO[str], IO[bytes]]) -> datetime: ...
|
||||
|
||||
DEFAULTPARSER: parser
|
||||
|
||||
def parse(timestr: _FileOrStr, parserinfo: Optional[parserinfo] = ..., **kwargs: Any) -> datetime: ...
|
||||
|
||||
class _tzparser: ...
|
||||
|
||||
DEFAULTTZPARSER: _tzparser
|
||||
|
||||
class InvalidDatetimeError(ValueError): ...
|
||||
class InvalidDateError(InvalidDatetimeError): ...
|
||||
class InvalidTimeError(InvalidDatetimeError): ...
|
||||
class ParserError(ValueError): ...
|
||||
97
stubs/python-dateutil/dateutil/relativedelta.pyi
Normal file
97
stubs/python-dateutil/dateutil/relativedelta.pyi
Normal file
@@ -0,0 +1,97 @@
|
||||
from datetime import date, datetime, timedelta
|
||||
from typing import Optional, SupportsFloat, TypeVar, Union, overload
|
||||
|
||||
from ._common import weekday
|
||||
|
||||
_SelfT = TypeVar("_SelfT", bound=relativedelta)
|
||||
_DateT = TypeVar("_DateT", date, datetime)
|
||||
# Work around attribute and type having the same name.
|
||||
_weekday = weekday
|
||||
|
||||
MO: weekday
|
||||
TU: weekday
|
||||
WE: weekday
|
||||
TH: weekday
|
||||
FR: weekday
|
||||
SA: weekday
|
||||
SU: weekday
|
||||
|
||||
class relativedelta(object):
|
||||
years: int
|
||||
months: int
|
||||
days: int
|
||||
leapdays: int
|
||||
hours: int
|
||||
minutes: int
|
||||
seconds: int
|
||||
microseconds: int
|
||||
year: Optional[int]
|
||||
month: Optional[int]
|
||||
weekday: Optional[_weekday]
|
||||
day: Optional[int]
|
||||
hour: Optional[int]
|
||||
minute: Optional[int]
|
||||
second: Optional[int]
|
||||
microsecond: Optional[int]
|
||||
def __init__(
|
||||
self,
|
||||
dt1: Optional[date] = ...,
|
||||
dt2: Optional[date] = ...,
|
||||
years: Optional[int] = ...,
|
||||
months: Optional[int] = ...,
|
||||
days: Optional[int] = ...,
|
||||
leapdays: Optional[int] = ...,
|
||||
weeks: Optional[int] = ...,
|
||||
hours: Optional[int] = ...,
|
||||
minutes: Optional[int] = ...,
|
||||
seconds: Optional[int] = ...,
|
||||
microseconds: Optional[int] = ...,
|
||||
year: Optional[int] = ...,
|
||||
month: Optional[int] = ...,
|
||||
day: Optional[int] = ...,
|
||||
weekday: Optional[Union[int, _weekday]] = ...,
|
||||
yearday: Optional[int] = ...,
|
||||
nlyearday: Optional[int] = ...,
|
||||
hour: Optional[int] = ...,
|
||||
minute: Optional[int] = ...,
|
||||
second: Optional[int] = ...,
|
||||
microsecond: Optional[int] = ...,
|
||||
) -> None: ...
|
||||
@property
|
||||
def weeks(self) -> int: ...
|
||||
@weeks.setter
|
||||
def weeks(self, value: int) -> None: ...
|
||||
def normalized(self: _SelfT) -> _SelfT: ...
|
||||
# TODO: use Union when mypy will handle it properly in overloaded operator
|
||||
# methods (#2129, #1442, #1264 in mypy)
|
||||
@overload
|
||||
def __add__(self: _SelfT, other: relativedelta) -> _SelfT: ...
|
||||
@overload
|
||||
def __add__(self: _SelfT, other: timedelta) -> _SelfT: ...
|
||||
@overload
|
||||
def __add__(self, other: _DateT) -> _DateT: ...
|
||||
@overload
|
||||
def __radd__(self: _SelfT, other: relativedelta) -> _SelfT: ...
|
||||
@overload
|
||||
def __radd__(self: _SelfT, other: timedelta) -> _SelfT: ...
|
||||
@overload
|
||||
def __radd__(self, other: _DateT) -> _DateT: ...
|
||||
@overload
|
||||
def __rsub__(self: _SelfT, other: relativedelta) -> _SelfT: ...
|
||||
@overload
|
||||
def __rsub__(self: _SelfT, other: timedelta) -> _SelfT: ...
|
||||
@overload
|
||||
def __rsub__(self, other: _DateT) -> _DateT: ...
|
||||
def __sub__(self: _SelfT, other: relativedelta) -> _SelfT: ...
|
||||
def __neg__(self: _SelfT) -> _SelfT: ...
|
||||
def __bool__(self) -> bool: ...
|
||||
def __nonzero__(self) -> bool: ...
|
||||
def __mul__(self: _SelfT, other: SupportsFloat) -> _SelfT: ...
|
||||
def __rmul__(self: _SelfT, other: SupportsFloat) -> _SelfT: ...
|
||||
def __eq__(self, other) -> bool: ...
|
||||
def __ne__(self, other: object) -> bool: ...
|
||||
def __div__(self: _SelfT, other: SupportsFloat) -> _SelfT: ...
|
||||
def __truediv__(self: _SelfT, other: SupportsFloat) -> _SelfT: ...
|
||||
def __repr__(self) -> str: ...
|
||||
def __abs__(self: _SelfT) -> _SelfT: ...
|
||||
def __hash__(self) -> int: ...
|
||||
105
stubs/python-dateutil/dateutil/rrule.pyi
Normal file
105
stubs/python-dateutil/dateutil/rrule.pyi
Normal file
@@ -0,0 +1,105 @@
|
||||
import datetime
|
||||
from typing import Any, Iterable, Optional, Union
|
||||
|
||||
from ._common import weekday as weekdaybase
|
||||
|
||||
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.date] = ...,
|
||||
interval: int = ...,
|
||||
wkst: Optional[Union[weekday, int]] = ...,
|
||||
count: Optional[int] = ...,
|
||||
until: Optional[Union[datetime.date, 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, weekday, Iterable[int], Iterable[weekday]]] = ...,
|
||||
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
|
||||
15
stubs/python-dateutil/dateutil/tz/__init__.pyi
Normal file
15
stubs/python-dateutil/dateutil/tz/__init__.pyi
Normal file
@@ -0,0 +1,15 @@
|
||||
from .tz import (
|
||||
datetime_ambiguous as datetime_ambiguous,
|
||||
datetime_exists as datetime_exists,
|
||||
gettz as gettz,
|
||||
resolve_imaginary as resolve_imaginary,
|
||||
tzfile as tzfile,
|
||||
tzical as tzical,
|
||||
tzlocal as tzlocal,
|
||||
tzoffset as tzoffset,
|
||||
tzrange as tzrange,
|
||||
tzstr as tzstr,
|
||||
tzutc as tzutc,
|
||||
)
|
||||
|
||||
UTC: tzutc
|
||||
24
stubs/python-dateutil/dateutil/tz/_common.pyi
Normal file
24
stubs/python-dateutil/dateutil/tz/_common.pyi
Normal file
@@ -0,0 +1,24 @@
|
||||
from datetime import datetime, timedelta, tzinfo
|
||||
from typing import Any, Optional
|
||||
|
||||
def tzname_in_python2(namefunc): ...
|
||||
def enfold(dt: datetime, fold: int = ...): ...
|
||||
|
||||
class _DatetimeWithFold(datetime):
|
||||
@property
|
||||
def fold(self): ...
|
||||
|
||||
class _tzinfo(tzinfo):
|
||||
def is_ambiguous(self, dt: datetime) -> bool: ...
|
||||
def fromutc(self, dt: datetime) -> datetime: ...
|
||||
|
||||
class tzrangebase(_tzinfo):
|
||||
def __init__(self) -> None: ...
|
||||
def utcoffset(self, dt: Optional[datetime]) -> Optional[timedelta]: ...
|
||||
def dst(self, dt: Optional[datetime]) -> Optional[timedelta]: ...
|
||||
def tzname(self, dt: Optional[datetime]) -> str: ...
|
||||
def fromutc(self, dt: datetime) -> datetime: ...
|
||||
def is_ambiguous(self, dt: datetime) -> bool: ...
|
||||
__hash__: Any
|
||||
def __ne__(self, other): ...
|
||||
__reduce__: Any
|
||||
101
stubs/python-dateutil/dateutil/tz/tz.pyi
Normal file
101
stubs/python-dateutil/dateutil/tz/tz.pyi
Normal file
@@ -0,0 +1,101 @@
|
||||
import datetime
|
||||
from typing import IO, Any, List, Optional, Text, Tuple, Union
|
||||
|
||||
from ..relativedelta import relativedelta
|
||||
from ._common import _tzinfo as _tzinfo, enfold as enfold, tzname_in_python2 as tzname_in_python2, tzrangebase as tzrangebase
|
||||
|
||||
_FileObj = Union[str, Text, IO[str], IO[Text]]
|
||||
|
||||
ZERO: datetime.timedelta
|
||||
EPOCH: datetime.datetime
|
||||
EPOCHORDINAL: int
|
||||
|
||||
class tzutc(datetime.tzinfo):
|
||||
def utcoffset(self, dt: Optional[datetime.datetime]) -> Optional[datetime.timedelta]: ...
|
||||
def dst(self, dt: Optional[datetime.datetime]) -> Optional[datetime.timedelta]: ...
|
||||
def tzname(self, dt: Optional[datetime.datetime]) -> str: ...
|
||||
def is_ambiguous(self, dt: Optional[datetime.datetime]) -> bool: ...
|
||||
def __eq__(self, other): ...
|
||||
__hash__: Any
|
||||
def __ne__(self, other): ...
|
||||
__reduce__: Any
|
||||
|
||||
class tzoffset(datetime.tzinfo):
|
||||
def __init__(self, name, offset) -> None: ...
|
||||
def utcoffset(self, dt: Optional[datetime.datetime]) -> Optional[datetime.timedelta]: ...
|
||||
def dst(self, dt: Optional[datetime.datetime]) -> Optional[datetime.timedelta]: ...
|
||||
def is_ambiguous(self, dt: Optional[datetime.datetime]) -> bool: ...
|
||||
def tzname(self, dt: Optional[datetime.datetime]) -> str: ...
|
||||
def __eq__(self, other): ...
|
||||
__hash__: Any
|
||||
def __ne__(self, other): ...
|
||||
__reduce__: Any
|
||||
@classmethod
|
||||
def instance(cls, name, offset) -> tzoffset: ...
|
||||
|
||||
class tzlocal(_tzinfo):
|
||||
def __init__(self) -> None: ...
|
||||
def utcoffset(self, dt: Optional[datetime.datetime]) -> Optional[datetime.timedelta]: ...
|
||||
def dst(self, dt: Optional[datetime.datetime]) -> Optional[datetime.timedelta]: ...
|
||||
def tzname(self, dt: Optional[datetime.datetime]) -> str: ...
|
||||
def is_ambiguous(self, dt: Optional[datetime.datetime]) -> bool: ...
|
||||
def __eq__(self, other): ...
|
||||
__hash__: Any
|
||||
def __ne__(self, other): ...
|
||||
__reduce__: Any
|
||||
|
||||
class _ttinfo:
|
||||
def __init__(self) -> None: ...
|
||||
def __eq__(self, other): ...
|
||||
__hash__: Any
|
||||
def __ne__(self, other): ...
|
||||
|
||||
class tzfile(_tzinfo):
|
||||
def __init__(self, fileobj: _FileObj, filename: Optional[Text] = ...) -> None: ...
|
||||
def is_ambiguous(self, dt: Optional[datetime.datetime], idx: Optional[int] = ...) -> bool: ...
|
||||
def utcoffset(self, dt: Optional[datetime.datetime]) -> Optional[datetime.timedelta]: ...
|
||||
def dst(self, dt: Optional[datetime.datetime]) -> Optional[datetime.timedelta]: ...
|
||||
def tzname(self, dt: Optional[datetime.datetime]) -> str: ...
|
||||
def __eq__(self, other): ...
|
||||
__hash__: Any
|
||||
def __ne__(self, other): ...
|
||||
def __reduce__(self): ...
|
||||
def __reduce_ex__(self, protocol): ...
|
||||
|
||||
class tzrange(tzrangebase):
|
||||
hasdst: bool
|
||||
def __init__(
|
||||
self,
|
||||
stdabbr: Text,
|
||||
stdoffset: Union[int, datetime.timedelta, None] = ...,
|
||||
dstabbr: Optional[Text] = ...,
|
||||
dstoffset: Union[int, datetime.timedelta, None] = ...,
|
||||
start: Optional[relativedelta] = ...,
|
||||
end: Optional[relativedelta] = ...,
|
||||
) -> None: ...
|
||||
def transitions(self, year: int) -> Tuple[datetime.datetime, datetime.datetime]: ...
|
||||
def __eq__(self, other): ...
|
||||
|
||||
class tzstr(tzrange):
|
||||
hasdst: bool
|
||||
def __init__(self, s: Union[bytes, _FileObj], posix_offset: bool = ...) -> None: ...
|
||||
@classmethod
|
||||
def instance(cls, name, offset) -> tzoffset: ...
|
||||
|
||||
class tzical:
|
||||
def __init__(self, fileobj: _FileObj) -> None: ...
|
||||
def keys(self): ...
|
||||
def get(self, tzid: Optional[Any] = ...): ...
|
||||
|
||||
TZFILES: List[str]
|
||||
TZPATHS: List[str]
|
||||
|
||||
def datetime_exists(dt: datetime.datetime, tz: Optional[datetime.tzinfo] = ...) -> bool: ...
|
||||
def datetime_ambiguous(dt: datetime.datetime, tz: Optional[datetime.tzinfo] = ...) -> bool: ...
|
||||
def resolve_imaginary(dt: datetime.datetime) -> datetime.datetime: ...
|
||||
|
||||
class _GetTZ:
|
||||
def __call__(self, name: Optional[Text] = ...) -> Optional[datetime.tzinfo]: ...
|
||||
def nocache(self, name: Optional[Text]) -> Optional[datetime.tzinfo]: ...
|
||||
|
||||
gettz: _GetTZ
|
||||
6
stubs/python-dateutil/dateutil/utils.pyi
Normal file
6
stubs/python-dateutil/dateutil/utils.pyi
Normal file
@@ -0,0 +1,6 @@
|
||||
from datetime import datetime, timedelta, tzinfo
|
||||
from typing import Optional
|
||||
|
||||
def default_tzinfo(dt: datetime, tzinfo: tzinfo) -> datetime: ...
|
||||
def today(tzinfo: Optional[tzinfo] = ...) -> datetime: ...
|
||||
def within_delta(dt1: datetime, dt2: datetime, delta: timedelta) -> bool: ...
|
||||
Reference in New Issue
Block a user