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
11 changes: 0 additions & 11 deletions stdlib/@tests/stubtest_allowlists/py315.txt
Original file line number Diff line number Diff line change
Expand Up @@ -112,10 +112,6 @@ binascii.b2a_base32
binascii.b2a_base64
binascii.b2a_base85
binascii.unhexlify
calendar.HTMLCalendar.formatmonthpage
calendar.__all__
calendar.standalone_month_abbr
calendar.standalone_month_name
codecs.backslashreplace_errors
codecs.ignore_errors
codecs.namereplace_errors
Expand All @@ -140,13 +136,6 @@ ctypes.SetPointerType
dataclasses._MISSING_TYPE
dataclasses.MISSING
dataclasses.field
datetime.date.fromisoformat
datetime.date.strptime
datetime.datetime.fromisoformat
datetime.datetime.strptime
datetime.time.fromisoformat
datetime.time.strptime
difflib.unified_diff
doctest.DocTestRunner.report_skip
enum.__all__
enum.auto.__init__
Expand Down
11 changes: 11 additions & 0 deletions stdlib/calendar.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ if sys.version_info >= (3, 12):
"NOVEMBER",
"DECEMBER",
]
if sys.version_info >= (3, 15):
__all__ += ["standalone_month_name", "standalone_month_abbr"]

_LocaleType: TypeAlias = tuple[str | None, str | None]

Expand Down Expand Up @@ -127,6 +129,11 @@ class HTMLCalendar(Calendar):
def formatweekheader(self) -> str: ...
def formatmonthname(self, theyear: int, themonth: int, withyear: bool = True) -> str: ...
def formatmonth(self, theyear: int, themonth: int, withyear: bool = True) -> str: ...
if sys.version_info >= (3, 15):
def formatmonthpage(
self, theyear: int, themonth: int, width: int = 3, css: str | None = "calendar.css", encoding: str | None = None
) -> bytes: ...

def formatyear(self, theyear: int, width: int = 3) -> str: ...
def formatyearpage(
self, theyear: int, width: int = 3, css: str | None = "calendar.css", encoding: str | None = None
Expand Down Expand Up @@ -212,3 +219,7 @@ else:
SUNDAY: Final = 6

EPOCH: Final = 1970

if sys.version_info >= (3, 15):
standalone_month_name: Sequence[str]
standalone_month_abbr: Sequence[str]
Comment on lines +224 to +225
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

The situation here is more complicated. There are instances of _localized_month, which isn't a full Sequence, but has other format field. Same actually for month_name and month_abbr. day_name and day_abbr are not instances of _localized_day. But the latter has been true since at least 3.10, so I'm fine with using Sequence in this PR, although I would prepare a followup, changing these fields.

Another thing I noticed, although that's probably legacy and possibly also out of scope: Through __getattr__, this module has two constants "January" (equaling 1), and "February" (equaling 2).

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Thanks, I'll prepare a followup for this.

Regarding the __getattr__, seems better to keep those out of the stub unless someone really needs them.

46 changes: 36 additions & 10 deletions stdlib/datetime.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,13 @@ class date:
def today(cls) -> Self: ...
@classmethod
def fromordinal(cls, n: int, /) -> Self: ...
@classmethod
def fromisoformat(cls, date_string: str, /) -> Self: ...
if sys.version_info >= (3, 15):
@classmethod
def fromisoformat(cls, string: str, /) -> Self: ...
else:
@classmethod
def fromisoformat(cls, date_string: str, /) -> Self: ...

@classmethod
def fromisocalendar(cls, year: int, week: int, day: int) -> Self: ...
@property
Expand All @@ -76,8 +81,12 @@ class date:
def ctime(self) -> str: ...

if sys.version_info >= (3, 14):
@classmethod
def strptime(cls, date_string: str, format: str, /) -> Self: ...
if sys.version_info >= (3, 15):
@classmethod
def strptime(cls, string: str, format: str, /) -> Self: ...
else:
@classmethod
def strptime(cls, date_string: str, format: str, /) -> Self: ...

# On <3.12, the name of the parameter in the pure-Python implementation
# didn't match the name in the C implementation,
Expand Down Expand Up @@ -147,12 +156,20 @@ class time:
def __eq__(self, value: object, /) -> bool: ...
def __hash__(self) -> int: ...
def isoformat(self, timespec: str = "auto") -> str: ...
@classmethod
def fromisoformat(cls, time_string: str, /) -> Self: ...
if sys.version_info >= (3, 15):
@classmethod
def fromisoformat(cls, string: str, /) -> Self: ...
else:
@classmethod
def fromisoformat(cls, time_string: str, /) -> Self: ...

if sys.version_info >= (3, 14):
@classmethod
def strptime(cls, date_string: str, format: str, /) -> Self: ...
if sys.version_info >= (3, 15):
@classmethod
def strptime(cls, string: str, format: str, /) -> Self: ...
else:
@classmethod
def strptime(cls, date_string: str, format: str, /) -> Self: ...

# On <3.12, the name of the parameter in the pure-Python implementation
# didn't match the name in the C implementation,
Expand Down Expand Up @@ -291,6 +308,10 @@ class datetime(date):
def utcnow(cls) -> Self: ...
@classmethod
def combine(cls, date: _Date, time: _Time, tzinfo: _TzInfo | None = ...) -> Self: ...
if sys.version_info >= (3, 15):
@classmethod
def fromisoformat(cls, string: str, /) -> Self: ...

def timestamp(self) -> float: ...
def utctimetuple(self) -> struct_time: ...
def date(self) -> _Date: ...
Expand Down Expand Up @@ -327,8 +348,13 @@ class datetime(date):
) -> Self: ...
def astimezone(self, tz: _TzInfo | None = None) -> Self: ...
def isoformat(self, sep: str = "T", timespec: str = "auto") -> str: ...
@classmethod
def strptime(cls, date_string: str, format: str, /) -> Self: ...
if sys.version_info >= (3, 15):
@classmethod
def strptime(cls, string: str, format: str, /) -> Self: ...
else:
@classmethod
def strptime(cls, date_string: str, format: str, /) -> Self: ...

def utcoffset(self) -> timedelta | None: ...
def tzname(self) -> str | None: ...
def dst(self) -> timedelta | None: ...
Expand Down
37 changes: 27 additions & 10 deletions stdlib/difflib.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -69,16 +69,33 @@ else:
def IS_LINE_JUNK(line: str, pat: Callable[[str], re.Match[str] | None] = ...) -> bool: ...

def IS_CHARACTER_JUNK(ch: str, ws: str = " \t") -> bool: ... # ws is undocumented
def unified_diff(
a: Sequence[str],
b: Sequence[str],
fromfile: str = "",
tofile: str = "",
fromfiledate: str = "",
tofiledate: str = "",
n: int = 3,
lineterm: str = "\n",
) -> Iterator[str]: ...

if sys.version_info >= (3, 15):
def unified_diff(
a: Sequence[str],
b: Sequence[str],
fromfile: str = "",
tofile: str = "",
fromfiledate: str = "",
tofiledate: str = "",
n: int = 3,
lineterm: str = "\n",
*,
color: bool = False,
) -> Iterator[str]: ...

else:
def unified_diff(
a: Sequence[str],
b: Sequence[str],
fromfile: str = "",
tofile: str = "",
fromfiledate: str = "",
tofiledate: str = "",
n: int = 3,
lineterm: str = "\n",
) -> Iterator[str]: ...

def context_diff(
a: Sequence[str],
b: Sequence[str],
Expand Down
Loading