From b5155250138ac7a5321c30d0a76f6f9528af9b94 Mon Sep 17 00:00:00 2001 From: Jelle Zijlstra Date: Fri, 8 May 2026 20:35:58 -0700 Subject: [PATCH 1/2] calendar: fix day_name etc. type --- stdlib/calendar.pyi | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/stdlib/calendar.pyi b/stdlib/calendar.pyi index 4e5ec628e27c..35db9a7554ba 100644 --- a/stdlib/calendar.pyi +++ b/stdlib/calendar.pyi @@ -2,9 +2,9 @@ import datetime import enum import sys from _typeshed import Unused -from collections.abc import Iterable, Sequence +from collections.abc import Iterable, Iterator from time import struct_time -from typing import ClassVar, Final, TypeAlias +from typing import ClassVar, Final, TypeAlias, overload __all__ = [ "FRIDAY", @@ -160,10 +160,22 @@ def formatstring(cols: Iterable[str], colwidth: int = 20, spacing: int = 6) -> s def timegm(tuple: tuple[int, ...] | struct_time) -> int: ... # Data attributes -day_name: Sequence[str] -day_abbr: Sequence[str] -month_name: Sequence[str] -month_abbr: Sequence[str] +class _localized_day: + format: str + def __init__(self, format: str) -> None: ... + @overload + def __getitem__(self, i: int) -> str: ... + @overload + def __getitem__(self, i: slice) -> list[str]: ... + def __iter__(self) -> Iterator[str]: ... + def __len__(self) -> int: ... + +class _localized_month(_localized_day): ... + +day_name: _localized_day +day_abbr: _localized_day +month_name: _localized_month +month_abbr: _localized_month if sys.version_info >= (3, 12): class Month(enum.IntEnum): @@ -221,5 +233,5 @@ else: EPOCH: Final = 1970 if sys.version_info >= (3, 15): - standalone_month_name: Sequence[str] - standalone_month_abbr: Sequence[str] + standalone_month_name: _localized_month + standalone_month_abbr: _localized_month From d0c044c30c31b734e70338cb9dd81463f2092d64 Mon Sep 17 00:00:00 2001 From: Jelle Zijlstra Date: Fri, 8 May 2026 20:39:47 -0700 Subject: [PATCH 2/2] . --- stdlib/calendar.pyi | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/stdlib/calendar.pyi b/stdlib/calendar.pyi index 35db9a7554ba..3971c0b5a967 100644 --- a/stdlib/calendar.pyi +++ b/stdlib/calendar.pyi @@ -2,7 +2,7 @@ import datetime import enum import sys from _typeshed import Unused -from collections.abc import Iterable, Iterator +from collections.abc import Iterable from time import struct_time from typing import ClassVar, Final, TypeAlias, overload @@ -160,17 +160,23 @@ def formatstring(cols: Iterable[str], colwidth: int = 20, spacing: int = 6) -> s def timegm(tuple: tuple[int, ...] | struct_time) -> int: ... # Data attributes -class _localized_day: +class _localized_month: format: str def __init__(self, format: str) -> None: ... @overload def __getitem__(self, i: int) -> str: ... @overload def __getitem__(self, i: slice) -> list[str]: ... - def __iter__(self) -> Iterator[str]: ... def __len__(self) -> int: ... -class _localized_month(_localized_day): ... +class _localized_day: + format: str + def __init__(self, format: str) -> None: ... + @overload + def __getitem__(self, i: int) -> str: ... + @overload + def __getitem__(self, i: slice) -> list[str]: ... + def __len__(self) -> int: ... day_name: _localized_day day_abbr: _localized_day