Use PEP 585 syntax wherever possible (#6717)

This commit is contained in:
Alex Waygood
2021-12-28 10:31:43 +00:00
committed by GitHub
parent e6cb341d94
commit 8d5d2520ac
237 changed files with 966 additions and 1069 deletions

View File

@@ -1,6 +1,6 @@
from socket import _RetAddress, socket
from threading import Thread
from typing import Protocol, Tuple
from typing import Protocol
from paramiko.channel import Channel
from paramiko.message import Message
@@ -18,7 +18,7 @@ SSH2_AGENT_SIGN_RESPONSE: int
class AgentSSH:
def __init__(self) -> None: ...
def get_keys(self) -> Tuple[AgentKey, ...]: ...
def get_keys(self) -> tuple[AgentKey, ...]: ...
class AgentProxyThread(Thread):
def __init__(self, agent: _AgentProxy) -> None: ...

View File

@@ -1,11 +1,11 @@
from threading import Event
from typing import Callable, List, Tuple
from typing import Callable
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 = Callable[[str, str, list[tuple[str, bool]]], list[str]]
class AuthHandler:
transport: Transport

View File

@@ -1,4 +1,4 @@
from typing import IO, Any, Dict, Iterable, Pattern
from typing import IO, Any, Iterable, Pattern
from paramiko.ssh_exception import ConfigParseError as ConfigParseError, CouldNotCanonicalize as CouldNotCanonicalize
@@ -25,7 +25,7 @@ class LazyFqdn:
host: str | None
def __init__(self, config: SSHConfigDict, host: str | None = ...) -> None: ...
class SSHConfigDict(Dict[str, str]):
class SSHConfigDict(dict[str, str]):
def __init__(self, *args: Any, **kwargs: Any) -> None: ...
def as_bool(self, key: str) -> bool: ...
def as_int(self, key: str) -> int: ...

View File

@@ -1,4 +1,4 @@
from typing import Any, AnyStr, Generic, Iterable, Tuple
from typing import Any, AnyStr, Generic, Iterable
from paramiko.util import ClosingContextManager
@@ -15,7 +15,7 @@ class BufferedFile(ClosingContextManager, Generic[AnyStr]):
FLAG_LINE_BUFFERED: int
FLAG_UNIVERSAL_NEWLINE: int
newlines: None | AnyStr | Tuple[AnyStr, ...]
newlines: None | AnyStr | tuple[AnyStr, ...]
def __init__(self) -> None: ...
def __del__(self) -> None: ...
def __iter__(self) -> BufferedFile[Any]: ...

View File

@@ -1,5 +1,4 @@
import threading
from typing import Tuple
from paramiko.channel import Channel
from paramiko.message import Message
@@ -19,7 +18,7 @@ class ServerInterface:
def enable_auth_gssapi(self) -> bool: ...
def check_port_forward_request(self, address: str, port: int) -> int: ...
def cancel_port_forward_request(self, address: str, port: int) -> None: ...
def check_global_request(self, kind: str, msg: Message) -> bool | Tuple[bool | int | str, ...]: ...
def check_global_request(self, kind: str, msg: Message) -> bool | tuple[bool | int | str, ...]: ...
def check_channel_pty_request(
self, channel: Channel, term: bytes, width: int, height: int, pixelwidth: int, pixelheight: int, modes: bytes
) -> bool: ...

View File

@@ -1,7 +1,7 @@
from typing import Any, Tuple, Type
from typing import Any, Type
GSS_AUTH_AVAILABLE: bool
GSS_EXCEPTIONS: Tuple[Type[Exception], ...]
GSS_EXCEPTIONS: tuple[Type[Exception], ...]
def GSSAuth(auth_method: str, gss_deleg_creds: bool = ...) -> _SSH_GSSAuth: ...

View File

@@ -2,7 +2,7 @@ from logging import Logger
from socket import socket
from threading import Condition, Event, Lock, Thread
from types import ModuleType
from typing import Any, Callable, Iterable, Protocol, Sequence, Tuple, Type
from typing import Any, Callable, Iterable, Protocol, Sequence, Type
from paramiko.auth_handler import AuthHandler, _InteractiveCallback
from paramiko.channel import Channel
@@ -14,7 +14,7 @@ from paramiko.sftp_client import SFTPClient
from paramiko.ssh_gss import _SSH_GSSAuth
from paramiko.util import ClosingContextManager
_Addr = Tuple[str, int]
_Addr = tuple[str, int]
class _KexEngine(Protocol):
def start_kex(self) -> None: ...
@@ -67,7 +67,7 @@ class Transport(Thread, ClosingContextManager):
server_key_dict: dict[str, PKey]
server_accepts: list[Channel]
server_accept_cv: Condition
subsystem_table: dict[str, tuple[Type[SubsystemHandler], Tuple[Any, ...], dict[str, Any]]]
subsystem_table: dict[str, tuple[Type[SubsystemHandler], tuple[Any, ...], dict[str, Any]]]
sys: ModuleType
def __init__(
self,