mirror of
https://github.com/davidhalter/typeshed.git
synced 2026-02-24 18:48:46 +08:00
Use TypeAlias where possible for type aliases (#7630)
This commit is contained in:
@@ -1,11 +1,12 @@
|
||||
from threading import Event
|
||||
from typing import Callable
|
||||
from typing_extensions import TypeAlias
|
||||
|
||||
from paramiko.pkey import PKey
|
||||
from paramiko.ssh_gss import _SSH_GSSAuth
|
||||
from paramiko.transport import Transport
|
||||
|
||||
_InteractiveCallback = Callable[[str, str, list[tuple[str, bool]]], list[str]]
|
||||
_InteractiveCallback: TypeAlias = Callable[[str, str, list[tuple[str, bool]]], list[str]]
|
||||
|
||||
class AuthHandler:
|
||||
transport: Transport
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import sys
|
||||
from typing import Protocol
|
||||
from typing_extensions import TypeAlias
|
||||
|
||||
MSG_DISCONNECT: int
|
||||
MSG_IGNORE: int
|
||||
@@ -109,7 +110,7 @@ else:
|
||||
class _SupportsAsBytes(Protocol):
|
||||
def asbytes(self) -> bytes: ...
|
||||
|
||||
_LikeBytes = bytes | str | _SupportsAsBytes
|
||||
_LikeBytes: TypeAlias = bytes | str | _SupportsAsBytes
|
||||
|
||||
def asbytes(s: _LikeBytes) -> bytes: ...
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import sys
|
||||
from typing import Any, Iterable
|
||||
from typing_extensions import TypeAlias
|
||||
|
||||
from .common import _LikeBytes
|
||||
|
||||
@@ -8,7 +9,7 @@ if sys.version_info >= (3, 0):
|
||||
else:
|
||||
from StringIO import StringIO
|
||||
|
||||
BytesIO = StringIO[bytes]
|
||||
BytesIO: TypeAlias = StringIO[bytes]
|
||||
|
||||
class Message:
|
||||
big_int: int
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
from _typeshed import Self
|
||||
from logging import Logger
|
||||
from typing import IO, Any, Callable, Iterator
|
||||
from typing_extensions import TypeAlias
|
||||
|
||||
from paramiko.channel import Channel
|
||||
from paramiko.sftp import BaseSFTP
|
||||
@@ -9,7 +10,7 @@ from paramiko.sftp_file import SFTPFile
|
||||
from paramiko.transport import Transport
|
||||
from paramiko.util import ClosingContextManager
|
||||
|
||||
_Callback = Callable[[int, int], Any]
|
||||
_Callback: TypeAlias = Callable[[int, int], Any]
|
||||
|
||||
b_slash: bytes
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ from socket import socket
|
||||
from threading import Condition, Event, Lock, Thread
|
||||
from types import ModuleType
|
||||
from typing import Any, Callable, Iterable, Protocol, Sequence
|
||||
from typing_extensions import TypeAlias
|
||||
|
||||
from paramiko.auth_handler import AuthHandler, _InteractiveCallback
|
||||
from paramiko.channel import Channel
|
||||
@@ -14,8 +15,8 @@ from paramiko.sftp_client import SFTPClient
|
||||
from paramiko.ssh_gss import _SSH_GSSAuth
|
||||
from paramiko.util import ClosingContextManager
|
||||
|
||||
_Addr = tuple[str, int]
|
||||
_SocketLike = str | _Addr | socket | Channel
|
||||
_Addr: TypeAlias = tuple[str, int]
|
||||
_SocketLike: TypeAlias = str | _Addr | socket | Channel
|
||||
|
||||
class _KexEngine(Protocol):
|
||||
def start_kex(self) -> None: ...
|
||||
|
||||
Reference in New Issue
Block a user