Skip to content

Commit 62accb3

Browse files
Improve netrc types on py311+ (#9376)
1 parent 04d4cbd commit 62accb3

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

stdlib/netrc.pyi

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import sys
12
from _typeshed import StrOrBytesPath
23
from typing_extensions import TypeAlias
34

@@ -10,7 +11,10 @@ class NetrcParseError(Exception):
1011
def __init__(self, msg: str, filename: StrOrBytesPath | None = ..., lineno: int | None = ...) -> None: ...
1112

1213
# (login, account, password) tuple
13-
_NetrcTuple: TypeAlias = tuple[str, str | None, str | None]
14+
if sys.version_info >= (3, 11):
15+
_NetrcTuple: TypeAlias = tuple[str, str, str]
16+
else:
17+
_NetrcTuple: TypeAlias = tuple[str, str | None, str | None]
1418

1519
class netrc:
1620
hosts: dict[str, _NetrcTuple]

0 commit comments

Comments
 (0)