Skip to content

Commit 971d6a3

Browse files
hrimovhauntsaninja
andauthored
Enhance ZoneInfo.from_file stub (#14221)
Enhance ZoneInfo.from_file stub Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
1 parent 74be917 commit 971d6a3

File tree

4 files changed

+8
-8
lines changed

4 files changed

+8
-8
lines changed

stdlib/@tests/stubtest_allowlists/py312.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@
77
# >= 3.12
88
# =======
99

10-
zoneinfo.ZoneInfo.from_file # Pos-only parameters had different "names" in different Python versions
11-
1210
# Initialized at runtime
1311
typing_extensions.TypeAliasType.__parameters__
1412
typing_extensions.TypeAliasType.__value__

stdlib/@tests/stubtest_allowlists/py313.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@
1212
# >= 3.12
1313
# =======
1414

15-
zoneinfo.ZoneInfo.from_file # Pos-only parameters had different "names" in different Python versions
16-
1715
# Initialized at runtime
1816
typing_extensions.TypeAliasType.__parameters__
1917
typing_extensions.TypeAliasType.__value__

stdlib/@tests/stubtest_allowlists/py314.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,6 @@ functools.partialmethod.__new__
5050
# >= 3.12
5151
# =======
5252

53-
zoneinfo.ZoneInfo.from_file # Pos-only parameters had different "names" in different Python versions
54-
5553
# Types that require `__setattr__` and `__delattr__` for typing purposes:
5654
types.SimpleNamespace.__setattr__
5755
types.SimpleNamespace.__delattr__

stdlib/zoneinfo/__init__.pyi

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import sys
12
from collections.abc import Iterable
23
from datetime import datetime, timedelta, tzinfo
34
from typing_extensions import Self
@@ -17,8 +18,13 @@ class ZoneInfo(tzinfo):
1718
def __new__(cls, key: str) -> Self: ...
1819
@classmethod
1920
def no_cache(cls, key: str) -> Self: ...
20-
@classmethod
21-
def from_file(cls, fobj: _IOBytes, /, key: str | None = None) -> Self: ...
21+
if sys.version_info >= (3, 12):
22+
@classmethod
23+
def from_file(cls, file_obj: _IOBytes, /, key: str | None = None) -> Self: ...
24+
else:
25+
@classmethod
26+
def from_file(cls, fobj: _IOBytes, /, key: str | None = None) -> Self: ...
27+
2228
@classmethod
2329
def clear_cache(cls, *, only_keys: Iterable[str] | None = None) -> None: ...
2430
def tzname(self, dt: datetime | None, /) -> str | None: ...

0 commit comments

Comments
 (0)