Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
9 changes: 7 additions & 2 deletions stubs/python-dateutil/dateutil/tz/_common.pyi
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
import abc
from collections.abc import Callable
from datetime import datetime, timedelta, tzinfo
from typing import ClassVar
from typing import ClassVar, TypeVar
from typing_extensions import ParamSpec

ZERO: timedelta

__all__ = ["tzname_in_python2", "enfold"]

def tzname_in_python2(namefunc): ...
_P = ParamSpec("_P")
_R = TypeVar("_R")

def tzname_in_python2(namefunc: Callable[_P, _R]) -> Callable[_P, _R]: ...
def enfold(dt: datetime, fold: int = 1): ...

# Doesn't actually have ABCMeta as the metaclass at runtime,
Expand Down
6 changes: 3 additions & 3 deletions stubs/python-dateutil/dateutil/tz/win.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ if sys.platform == "win32":

class tzres:
p_wchar: ClassVar[type[_Pointer[c_wchar]]]
def __init__(self, tzres_loc="tzres.dll"): ...
def load_name(self, offset): ...
def name_from_string(self, tzname_str: str): ...
def __init__(self, tzres_loc: str = "tzres.dll") -> None: ...
Copy link
Contributor

@donbarbos donbarbos Nov 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might be worth using a type that ctypes.WinDLL() accepts inside (_NameTypes is type alias from ctypes),
and attribute could be specified right away:

Suggested change
def __init__(self, tzres_loc: str = "tzres.dll") -> None: ...
tzres_loc: _NameTypes
def __init__(self, tzres_loc: _NameTypes = "tzres.dll") -> None: ...

def load_name(self, offset: int) -> str: ...
def name_from_string(self, tzname_str: str) -> str: ...

def picknthweekday(year: int, month: int, dayofweek: int, hour: int, minute: int, whichweek: int) -> datetime: ...
def valuestodict(key: _KeyType) -> dict[str, Any]: ... # keys and values in dict are results of winreg.EnumValue() function
5 changes: 4 additions & 1 deletion stubs/python-dateutil/dateutil/zoneinfo/rebuild.pyi
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
from _typeshed import StrOrBytesPath
from collections.abc import Iterable
from typing import Any

def rebuild(filename: StrOrBytesPath, tag=None, format: str = "gz", zonegroups: Iterable[str] = [], metadata=None) -> None: ...
def rebuild(
filename: StrOrBytesPath, tag=None, format: str = "gz", zonegroups: Iterable[str] = [], metadata: dict[str, Any] | None = None
Copy link
Contributor

@donbarbos donbarbos Nov 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think Incomplete is more appropriate here since it is used for the return type from gettz_db_metadata

and if _MetadataType (type alias to dict[str, Incomplete]) is changed to TypedDict, it will be changed at the same time

Suggested change
filename: StrOrBytesPath, tag=None, format: str = "gz", zonegroups: Iterable[str] = [], metadata: dict[str, Any] | None = None
filename: StrOrBytesPath, tag=None, format: str = "gz", zonegroups: Iterable[str] = [], metadata: _MetadataType | None = None

) -> None: ...