Skip to content

Commit e10d414

Browse files
authored
[python-dateutil] Add missing parameter annotations (#14996)
1 parent 354b33a commit e10d414

File tree

3 files changed

+17
-7
lines changed

3 files changed

+17
-7
lines changed

stubs/python-dateutil/dateutil/tz/_common.pyi

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,17 @@
11
import abc
2+
from collections.abc import Callable
23
from datetime import datetime, timedelta, tzinfo
3-
from typing import ClassVar
4+
from typing import ClassVar, TypeVar
5+
from typing_extensions import ParamSpec
46

57
ZERO: timedelta
68

79
__all__ = ["tzname_in_python2", "enfold"]
810

9-
def tzname_in_python2(namefunc): ...
11+
_P = ParamSpec("_P")
12+
_R = TypeVar("_R")
13+
14+
def tzname_in_python2(namefunc: Callable[_P, _R]) -> Callable[_P, _R]: ...
1015
def enfold(dt: datetime, fold: int = 1): ...
1116

1217
# Doesn't actually have ABCMeta as the metaclass at runtime,

stubs/python-dateutil/dateutil/tz/win.pyi

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import sys
2-
from ctypes import _Pointer, c_wchar
2+
from ctypes import _NameTypes, _Pointer, c_wchar
33
from datetime import datetime, timedelta
44
from typing import Any, ClassVar, Final
55

@@ -18,9 +18,10 @@ if sys.platform == "win32":
1818

1919
class tzres:
2020
p_wchar: ClassVar[type[_Pointer[c_wchar]]]
21-
def __init__(self, tzres_loc="tzres.dll"): ...
22-
def load_name(self, offset): ...
23-
def name_from_string(self, tzname_str: str): ...
21+
tzres_loc: _NameTypes
22+
def __init__(self, tzres_loc: _NameTypes = "tzres.dll") -> None: ...
23+
def load_name(self, offset: int) -> str: ...
24+
def name_from_string(self, tzname_str: str) -> str: ...
2425

2526
def picknthweekday(year: int, month: int, dayofweek: int, hour: int, minute: int, whichweek: int) -> datetime: ...
2627
def valuestodict(key: _KeyType) -> dict[str, Any]: ... # keys and values in dict are results of winreg.EnumValue() function
Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
from _typeshed import StrOrBytesPath
22
from collections.abc import Iterable
33

4-
def rebuild(filename: StrOrBytesPath, tag=None, format: str = "gz", zonegroups: Iterable[str] = [], metadata=None) -> None: ...
4+
from ..zoneinfo import _MetadataType
5+
6+
def rebuild(
7+
filename: StrOrBytesPath, tag=None, format: str = "gz", zonegroups: Iterable[str] = [], metadata: _MetadataType | None = None
8+
) -> None: ...

0 commit comments

Comments
 (0)