Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 6 additions & 7 deletions stubs/python-dateutil/dateutil/parser/_parser.pyi
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import re
from _typeshed import Incomplete, SupportsRead
from _typeshed import SupportsRead
from collections.abc import Callable, Mapping
from datetime import _TzInfo, datetime
from io import StringIO
Expand Down Expand Up @@ -58,22 +58,21 @@ class parserinfo:
def convertyear(self, year: int, century_specified: bool = False) -> int: ...
def validate(self, res: datetime) -> bool: ...

class _ymd(list[Incomplete]):
class _ymd(list[int]):
century_specified: bool
dstridx: int | None
mstridx: int | None
ystridx: int | None
def __init__(self, *args, **kwargs) -> None: ...
@property
def has_year(self) -> bool: ...
@property
def has_month(self) -> bool: ...
@property
def has_day(self) -> bool: ...
def could_be_day(self, value): ...
def append(self, val, label=None): ...
def _resolve_from_stridxs(self, strids): ...
def resolve_ymd(self, yearfirst: bool | None, dayfirst: bool | None): ...
def could_be_day(self, value: int) -> bool: ...
def append(self, val: str | int, label: str | None = None) -> None: ...
def _resolve_from_stridxs(self, strids: dict[str, int]) -> tuple[int, int, int]: ...
def resolve_ymd(self, yearfirst: bool | None, dayfirst: bool | None) -> tuple[int, int, int]: ...

class parser:
info: parserinfo
Expand Down
53 changes: 28 additions & 25 deletions stubs/python-dateutil/dateutil/rrule.pyi
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import datetime
from _typeshed import Incomplete
from collections.abc import Generator, Iterable, Iterator, Sequence
from collections.abc import Callable, Generator, Iterable, Iterator, Mapping, Sequence
from typing import Final, Literal, overload
from typing_extensions import Self, TypeAlias

from dateutil.parser._parser import _TzInfos

from ._common import weekday as weekdaybase

__all__ = [
Expand Down Expand Up @@ -58,13 +59,15 @@ SU: weekday
class rrulebase:
def __init__(self, cache: bool | None = False) -> None: ...
def __iter__(self) -> Iterator[datetime.datetime]: ...
def __getitem__(self, item): ...
def __contains__(self, item) -> bool: ...
def __getitem__(self, item: int | slice) -> datetime.datetime: ...
def __contains__(self, item: datetime.datetime) -> bool: ...
def count(self) -> int | None: ...
def before(self, dt, inc: bool = False): ...
def after(self, dt, inc: bool = False): ...
def xafter(self, dt, count=None, inc: bool = False) -> Generator[Incomplete]: ...
def between(self, after, before, inc: bool = False, count: int = 1) -> list[Incomplete]: ...
def before(self, dt: datetime.datetime, inc: bool = False): ...
def after(self, dt: datetime.datetime, inc: bool = False): ...
def xafter(self, dt: datetime.datetime, count: int | None = None, inc: bool = False) -> Generator[datetime.datetime]: ...
def between(
self, after: datetime.datetime, before: datetime.datetime, inc: bool = False, count: int = 1
) -> list[datetime.datetime]: ...

class rrule(rrulebase):
def __init__(
Expand Down Expand Up @@ -156,22 +159,22 @@ class _iterinfo:

class rruleset(rrulebase):
class _genitem:
dt: Incomplete
genlist: list[Incomplete]
gen: Incomplete
def __init__(self, genlist, gen) -> None: ...
dt: datetime.datetime
genlist: list[Self]
gen: Iterator[datetime.datetime]
def __init__(self, genlist: list[Self], gen: Iterator[datetime.datetime]) -> None: ...
def __next__(self) -> None: ...
next = __next__
def __lt__(self, other) -> bool: ...
def __gt__(self, other) -> bool: ...
def __eq__(self, other) -> bool: ...
def __ne__(self, other) -> bool: ...
def __lt__(self, other: Self) -> bool: ...
def __gt__(self, other: Self) -> bool: ...
def __eq__(self, other: object) -> bool: ...
def __ne__(self, other: object) -> bool: ...

def __init__(self, cache: bool | None = False) -> None: ...
def rrule(self, rrule: _RRule) -> None: ...
def rdate(self, rdate) -> None: ...
def exrule(self, exrule) -> None: ...
def exdate(self, exdate) -> None: ...
def rdate(self, rdate: datetime.datetime) -> None: ...
def exrule(self, exrule: _RRule) -> None: ...
def exdate(self, exdate: datetime.datetime) -> None: ...

class _rrulestr:
@overload
Expand All @@ -185,8 +188,8 @@ class _rrulestr:
unfold: bool = False,
compatible: bool = False,
ignoretz: bool = False,
tzids=None,
tzinfos=None,
tzids: Callable[[str], datetime.tzinfo] | Mapping[str, datetime.tzinfo] | None = None,
tzinfos: _TzInfos | None = None,
) -> rruleset: ...
@overload
def __call__(
Expand All @@ -199,8 +202,8 @@ class _rrulestr:
unfold: bool = False,
forceset: bool = False,
ignoretz: bool = False,
tzids=None,
tzinfos=None,
tzids: Callable[[str], datetime.tzinfo] | Mapping[str, datetime.tzinfo] | None = None,
tzinfos: _TzInfos | None = None,
) -> rruleset: ...
@overload
def __call__(
Expand All @@ -213,8 +216,8 @@ class _rrulestr:
forceset: bool = False,
compatible: bool = False,
ignoretz: bool = False,
tzids=None,
tzinfos=None,
tzids: Callable[[str], datetime.tzinfo] | Mapping[str, datetime.tzinfo] | None = None,
tzinfos: _TzInfos | None = None,
) -> rrule | rruleset: ...

rrulestr: _rrulestr
2 changes: 1 addition & 1 deletion stubs/python-dateutil/dateutil/tz/_common.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,5 @@ class tzrangebase(_tzinfo):
def fromutc(self, dt: datetime) -> datetime: ...
def is_ambiguous(self, dt: datetime) -> bool: ...
__hash__: ClassVar[None] # type: ignore[assignment]
def __ne__(self, other): ...
def __ne__(self, other: object) -> bool: ...
__reduce__ = object.__reduce__
40 changes: 21 additions & 19 deletions stubs/python-dateutil/dateutil/tz/tz.pyi
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import sys
from _typeshed import Unused
from datetime import datetime, timedelta, tzinfo
from typing import ClassVar, Literal, Protocol, TypeVar, type_check_only
from typing import Any, ClassVar, Literal, Protocol, TypeVar, type_check_only
from typing_extensions import Self

from ..relativedelta import relativedelta
from ._common import _tzinfo, enfold as enfold, tzrangebase
Expand All @@ -23,36 +25,36 @@ class tzutc(tzinfo):
def tzname(self, dt: datetime | None) -> str: ...
def is_ambiguous(self, dt: datetime | None) -> bool: ...
def fromutc(self, dt: _DT) -> _DT: ...
def __eq__(self, other): ...
def __eq__(self, other: object) -> bool: ...
__hash__: ClassVar[None] # type: ignore[assignment]
def __ne__(self, other): ...
def __ne__(self, other: object) -> bool: ...
__reduce__ = object.__reduce__

UTC: tzutc

class tzoffset(tzinfo):
def __init__(self, name, offset) -> None: ...
def __init__(self, name: str | None, offset: float | timedelta) -> None: ...
def utcoffset(self, dt: datetime | None) -> timedelta | None: ...
def dst(self, dt: datetime | None) -> timedelta | None: ...
def is_ambiguous(self, dt: datetime | None) -> bool: ...
def tzname(self, dt: datetime | None) -> str: ...
def fromutc(self, dt: _DT) -> _DT: ...
def __eq__(self, other): ...
def __eq__(self, other: object) -> bool: ...
__hash__: ClassVar[None] # type: ignore[assignment]
def __ne__(self, other): ...
def __ne__(self, other: object) -> bool: ...
__reduce__ = object.__reduce__
@classmethod
def instance(cls, name, offset) -> tzoffset: ...
def instance(cls, name: str | None, offset: float | timedelta) -> tzoffset: ...

class tzlocal(_tzinfo):
def __init__(self) -> None: ...
def utcoffset(self, dt: datetime | None) -> timedelta | None: ...
def dst(self, dt: datetime | None) -> timedelta | None: ...
def tzname(self, dt: datetime | None) -> str: ...
def is_ambiguous(self, dt: datetime | None) -> bool: ...
def __eq__(self, other): ...
def __eq__(self, other: object) -> bool: ...
__hash__: ClassVar[None] # type: ignore[assignment]
def __ne__(self, other): ...
def __ne__(self, other: object) -> bool: ...
__reduce__ = object.__reduce__

class _ttinfo:
Expand All @@ -65,9 +67,9 @@ class _ttinfo:
isgmt: bool
dstoffset: timedelta
def __init__(self) -> None: ...
def __eq__(self, other): ...
def __eq__(self, other: object) -> bool: ...
__hash__: ClassVar[None] # type: ignore[assignment]
def __ne__(self, other): ...
def __ne__(self, other: object) -> bool: ...

@type_check_only
class _TZFileReader(Protocol):
Expand All @@ -82,11 +84,11 @@ class tzfile(_tzinfo):
def utcoffset(self, dt: datetime | None) -> timedelta | None: ...
def dst(self, dt: datetime | None) -> timedelta | None: ...
def tzname(self, dt: datetime | None) -> str: ...
def __eq__(self, other): ...
def __eq__(self, other: object) -> bool: ...
__hash__: ClassVar[None] # type: ignore[assignment]
def __ne__(self, other): ...
def __reduce__(self): ...
def __reduce_ex__(self, protocol): ...
def __ne__(self, other: object) -> bool: ...
def __reduce__(self) -> tuple[type[Self], tuple[None, str], dict[str, Any]]: ...
def __reduce_ex__(self, protocol: Unused) -> tuple[type[Self], tuple[None, str], dict[str, Any]]: ...

class tzrange(tzrangebase):
hasdst: bool
Expand All @@ -100,13 +102,13 @@ class tzrange(tzrangebase):
end: relativedelta | None = None,
) -> None: ...
def transitions(self, year: int) -> tuple[datetime, datetime]: ...
def __eq__(self, other): ...
def __eq__(self, other: object) -> bool: ...

class tzstr(tzrange):
hasdst: bool
def __init__(self, s: str, posix_offset: bool = False) -> None: ...
@classmethod
def instance(cls, name, offset) -> tzoffset: ...
def instance(cls, name: str | None, offset: float | timedelta) -> tzoffset: ...

@type_check_only
class _ICalReader(Protocol):
Expand All @@ -116,8 +118,8 @@ class _ICalReader(Protocol):

class tzical:
def __init__(self, fileobj: str | _ICalReader) -> None: ...
def keys(self): ...
def get(self, tzid=None): ...
def keys(self) -> list[str]: ...
def get(self, tzid: str | None = None) -> tzinfo | None: ...

TZFILES: list[str]
TZPATHS: list[str]
Expand Down
3 changes: 2 additions & 1 deletion stubs/python-dateutil/dateutil/zoneinfo/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ ZONEFILENAME: Final[str]
METADATA_FN: Final[str]

class tzfile(_tzfile):
def __reduce__(self) -> tuple[Callable[[str], Self], tuple[str, ...]]: ...
# source code does this override, changing the type
def __reduce__(self) -> tuple[Callable[[str], Self], tuple[str]]: ... # type: ignore[override]

def getzoneinfofile_stream() -> BytesIO | None: ...

Expand Down