Mark stub-only private symbols as @type_check_only in third-party stubs (#14545)

This commit is contained in:
Brian Schubert
2025-08-08 05:29:48 -04:00
committed by GitHub
parent a358dc24e8
commit 81c8fcb2e6
131 changed files with 334 additions and 147 deletions
+2 -1
View File
@@ -4,13 +4,14 @@ from collections.abc import Mapping
from logging import _ExcInfoType
from socket import _RetAddress, socket
from threading import Thread
from typing import Final, Protocol
from typing import Final, Protocol, type_check_only
from paramiko.channel import Channel
from paramiko.message import Message, _LikeBytes
from paramiko.pkey import PKey
from paramiko.transport import Transport
@type_check_only
class _AgentProxy(Protocol):
def connect(self) -> None: ...
def close(self) -> None: ...
+2 -1
View File
@@ -1,6 +1,6 @@
from _typeshed import FileDescriptorOrPath
from collections.abc import Iterable, Mapping
from typing import NoReturn, Protocol
from typing import NoReturn, Protocol, type_check_only
from paramiko.auth_strategy import AuthStrategy
from paramiko.channel import Channel, ChannelFile, ChannelStderrFile, ChannelStdinFile
@@ -10,6 +10,7 @@ from paramiko.sftp_client import SFTPClient
from paramiko.transport import Transport, _SocketLike
from paramiko.util import ClosingContextManager
@type_check_only
class _TransportFactory(Protocol):
def __call__(
self,
+3 -1
View File
@@ -1,11 +1,13 @@
from _typeshed import FileDescriptorOrPath
from collections.abc import Iterator, Mapping, MutableMapping
from typing import type_check_only
from typing_extensions import Self
from paramiko.pkey import PKey
# Internal to HostKeys.lookup(). Calls itself "SubDict".
@type_check_only
class _SubDict(MutableMapping[str, PKey]):
# Internal to HostKeys.lookup()
def __init__(self, hostname: str, entries: list[HostKeyEntry], hostkeys: HostKeys) -> None: ...
def __iter__(self) -> Iterator[str]: ...
def __len__(self) -> int: ...
+2 -1
View File
@@ -1,9 +1,10 @@
from _typeshed import ReadableBuffer
from collections.abc import Iterable
from io import BytesIO
from typing import Any, Protocol
from typing import Any, Protocol, type_check_only
from typing_extensions import TypeAlias
@type_check_only
class _SupportsAsBytes(Protocol):
def asbytes(self) -> bytes: ...
+3 -1
View File
@@ -1,9 +1,11 @@
from typing import Protocol
from typing import Protocol, type_check_only
@type_check_only
class _BasePipe(Protocol):
def clear(self) -> None: ...
def set(self) -> None: ...
@type_check_only
class _Pipe(_BasePipe, Protocol):
def close(self) -> None: ...
def fileno(self) -> int: ...
+2 -1
View File
@@ -4,7 +4,7 @@ from logging import Logger
from socket import socket
from threading import Condition, Event, Lock, Thread
from types import ModuleType
from typing import Any, Protocol
from typing import Any, Protocol, type_check_only
from typing_extensions import TypeAlias
from paramiko.auth_handler import AuthHandler, AuthOnlyHandler, _InteractiveCallback
@@ -21,6 +21,7 @@ from paramiko.util import ClosingContextManager
_Addr: TypeAlias = tuple[str, int]
_SocketLike: TypeAlias = str | _Addr | socket | Channel | ProxyCommand
@type_check_only
class _KexEngine(Protocol):
def start_kex(self) -> None: ...
def parse_next(self, ptype: int, m: Message) -> None: ...