Big diff: use lower-case list and dict (#5888)

This commit is contained in:
Akuli
2021-08-08 19:26:35 +03:00
committed by GitHub
parent 11f54c3407
commit ce11072dbe
325 changed files with 2196 additions and 2334 deletions

View File

@@ -1,6 +1,6 @@
from socket import _RetAddress, socket
from threading import Thread
from typing import Dict, Protocol, Tuple
from typing import Protocol, Tuple
from paramiko.channel import Channel
from paramiko.message import Message
@@ -45,7 +45,7 @@ class AgentServerProxy(AgentSSH):
def __del__(self) -> None: ...
def connect(self) -> None: ...
def close(self) -> None: ...
def get_env(self) -> Dict[str, str]: ...
def get_env(self) -> dict[str, str]: ...
class AgentRequestHandler:
def __init__(self, chanClient: Channel) -> None: ...

View File

@@ -32,7 +32,7 @@ class AuthHandler:
def auth_gssapi_with_mic(self, username: str, gss_host: str, gss_deleg_creds: bool, event: Event) -> None: ...
def auth_gssapi_keyex(self, username: str, event: Event) -> None: ...
def abort(self) -> None: ...
def wait_for_response(self, event: Event) -> List[str]: ...
def wait_for_response(self, event: Event) -> list[str]: ...
class GssapiWithMicAuthHandler:
method: str

View File

@@ -1,4 +1,4 @@
from typing import Any, Iterable, List
from typing import Any, Iterable
class BERException(Exception): ...
@@ -7,10 +7,10 @@ class BER:
idx: int
def __init__(self, content: bytes = ...) -> None: ...
def asbytes(self) -> bytes: ...
def decode(self) -> None | int | List[int]: ...
def decode_next(self) -> None | int | List[int]: ...
def decode(self) -> None | int | list[int]: ...
def decode_next(self) -> None | int | list[int]: ...
@staticmethod
def decode_sequence(data: bytes) -> List[int | List[int]]: ...
def decode_sequence(data: bytes) -> list[int | list[int]]: ...
def encode_tlv(self, ident: int, val: bytes) -> None: ...
def encode(self, x: Any) -> None: ...
@staticmethod

View File

@@ -1,5 +1,5 @@
from socket import socket
from typing import Dict, Iterable, Mapping, NoReturn, Tuple, Type
from typing import Iterable, Mapping, NoReturn, Tuple, Type
from paramiko.channel import Channel, ChannelFile, ChannelStderrFile, ChannelStdinFile
from paramiko.hostkeys import HostKeys
@@ -37,7 +37,7 @@ class SSHClient(ClosingContextManager):
auth_timeout: float | None = ...,
gss_trust_dns: bool = ...,
passphrase: str | None = ...,
disabled_algorithms: Dict[str, Iterable[str]] | None = ...,
disabled_algorithms: dict[str, Iterable[str]] | None = ...,
) -> None: ...
def close(self) -> None: ...
def exec_command(
@@ -46,7 +46,7 @@ class SSHClient(ClosingContextManager):
bufsize: int = ...,
timeout: float | None = ...,
get_pty: bool = ...,
environment: Dict[str, str] | None = ...,
environment: dict[str, str] | None = ...,
) -> Tuple[ChannelStdinFile, ChannelFile, ChannelStderrFile]: ...
def invoke_shell(
self,

View File

@@ -1,5 +1,5 @@
import sys
from typing import Dict, Protocol, Text, Union
from typing import Protocol, Text, Union
MSG_DISCONNECT: int
MSG_IGNORE: int
@@ -74,7 +74,7 @@ cMSG_CHANNEL_REQUEST: bytes
cMSG_CHANNEL_SUCCESS: bytes
cMSG_CHANNEL_FAILURE: bytes
MSG_NAMES: Dict[int, str]
MSG_NAMES: dict[int, str]
AUTH_SUCCESSFUL: int
AUTH_PARTIALLY_SUCCESSFUL: int
@@ -86,7 +86,7 @@ OPEN_FAILED_CONNECT_FAILED: int
OPEN_FAILED_UNKNOWN_CHANNEL_TYPE: int
OPEN_FAILED_RESOURCE_SHORTAGE: int
CONNECTION_FAILED_CODE: Dict[int, str]
CONNECTION_FAILED_CODE: dict[int, str]
DISCONNECT_SERVICE_NOT_AVAILABLE: int
DISCONNECT_AUTH_CANCELLED_BY_USER: int

View File

@@ -1,4 +1,4 @@
from typing import IO, Any, Dict, Iterable, List, Pattern, Set
from typing import IO, Any, Dict, Iterable, Pattern, Set
from paramiko.ssh_exception import ConfigParseError as ConfigParseError, CouldNotCanonicalize as CouldNotCanonicalize
@@ -6,7 +6,7 @@ SSH_PORT: int
class SSHConfig:
SETTINGS_REGEX: Pattern[str]
TOKENS_BY_CONFIG_KEY: Dict[str, List[str]]
TOKENS_BY_CONFIG_KEY: dict[str, list[str]]
def __init__(self) -> None: ...
@classmethod
def from_text(cls, text: str) -> SSHConfig: ...

View File

@@ -1,4 +1,4 @@
from typing import IO, Any, Callable, List, Sequence, Tuple, Type
from typing import IO, Any, Callable, Sequence, Tuple, Type
from cryptography.hazmat.primitives.asymmetric.ec import EllipticCurve, EllipticCurvePrivateKey, EllipticCurvePublicKey
from cryptography.hazmat.primitives.hashes import HashAlgorithm
@@ -16,7 +16,7 @@ class _ECDSACurve:
class _ECDSACurveSet:
ecdsa_curves: Sequence[_ECDSACurve]
def __init__(self, ecdsa_curves: Sequence[_ECDSACurve]) -> None: ...
def get_key_format_identifier_list(self) -> List[str]: ...
def get_key_format_identifier_list(self) -> list[str]: ...
def get_by_curve_class(self, curve_class: Type[Any]) -> _ECDSACurve | None: ...
def get_by_key_format_identifier(self, key_format_identifier: str) -> _ECDSACurve | None: ...
def get_by_key_length(self, key_length: int) -> _ECDSACurve | None: ...
@@ -37,7 +37,7 @@ class ECDSAKey(PKey):
validate_point: bool = ...,
) -> None: ...
@classmethod
def supported_key_format_identifiers(cls: Any) -> List[str]: ...
def supported_key_format_identifiers(cls: Any) -> list[str]: ...
def asbytes(self) -> bytes: ...
def __hash__(self) -> int: ...
def get_name(self) -> str: ...

View File

@@ -1,4 +1,4 @@
from typing import Any, AnyStr, Generic, Iterable, List, Tuple
from typing import Any, AnyStr, Generic, Iterable, Tuple
from paramiko.util import ClosingContextManager
@@ -28,7 +28,7 @@ class BufferedFile(ClosingContextManager, Generic[AnyStr]):
def readinto(self, buff: bytearray) -> int: ...
def read(self, size: int | None = ...) -> bytes: ...
def readline(self, size: int | None = ...) -> AnyStr: ...
def readlines(self, sizehint: int | None = ...) -> List[AnyStr]: ...
def readlines(self, sizehint: int | None = ...) -> list[AnyStr]: ...
def seek(self, offset: int, whence: int = ...) -> None: ...
def tell(self) -> int: ...
def write(self, data: AnyStr) -> None: ...

View File

@@ -1,16 +1,16 @@
from typing import Iterator, List, Mapping, MutableMapping
from typing import Iterator, Mapping, MutableMapping
from paramiko.pkey import PKey
class _SubDict(MutableMapping[str, PKey]):
# Internal to HostKeys.lookup()
def __init__(self, hostname: str, entries: List[HostKeyEntry], hostkeys: HostKeys) -> None: ...
def __init__(self, hostname: str, entries: list[HostKeyEntry], hostkeys: HostKeys) -> None: ...
def __iter__(self) -> Iterator[str]: ...
def __len__(self) -> int: ...
def __delitem__(self, key: str) -> None: ...
def __getitem__(self, key: str) -> PKey: ...
def __setitem__(self, key: str, val: PKey) -> None: ...
def keys(self) -> List[str]: ... # type: ignore
def keys(self) -> list[str]: ... # type: ignore
class HostKeys(MutableMapping[str, _SubDict]):
def __init__(self, filename: str | None = ...) -> None: ...
@@ -25,8 +25,8 @@ class HostKeys(MutableMapping[str, _SubDict]):
def __getitem__(self, key: str) -> _SubDict: ...
def __delitem__(self, key: str) -> None: ...
def __setitem__(self, hostname: str, entry: Mapping[str, PKey]) -> None: ...
def keys(self) -> List[str]: ... # type: ignore
def values(self) -> List[_SubDict]: ... # type: ignore
def keys(self) -> list[str]: ... # type: ignore
def values(self) -> list[_SubDict]: ... # type: ignore
@staticmethod
def hash_host(hostname: str, salt: str | None = ...) -> str: ...
@@ -39,7 +39,7 @@ class HostKeyEntry:
valid: bool
hostnames: str
key: PKey
def __init__(self, hostnames: List[str] | None = ..., key: PKey | None = ...) -> None: ...
def __init__(self, hostnames: list[str] | None = ..., key: PKey | None = ...) -> None: ...
@classmethod
def from_line(cls, line: str, lineno: int | None = ...) -> HostKeyEntry | None: ...
def to_line(self) -> str | None: ...

View File

@@ -1,5 +1,5 @@
import sys
from typing import Any, Iterable, List, Text
from typing import Any, Iterable, Text
from .common import _LikeBytes
@@ -29,7 +29,7 @@ class Message:
def get_string(self) -> bytes: ...
def get_text(self) -> Text: ...
def get_binary(self) -> bytes: ...
def get_list(self) -> List[str]: ...
def get_list(self) -> list[str]: ...
def add_bytes(self, b: bytes) -> Message: ...
def add_byte(self, b: bytes) -> Message: ...
def add_boolean(self, b: bool) -> Message: ...

View File

@@ -1,8 +1,8 @@
from typing import Dict, List, Tuple
from typing import Tuple
class ModulusPack:
pack: Dict[int, List[Tuple[int, int]]]
discarded: List[Tuple[int, str]]
pack: dict[int, list[Tuple[int, int]]]
discarded: list[Tuple[int, str]]
def __init__(self) -> None: ...
def read_file(self, filename: str) -> None: ...
def get_modulus(self, min: int, prefer: int, max: int) -> Tuple[int, int]: ...

View File

@@ -1,10 +1,10 @@
from subprocess import Popen
from typing import Any, List
from typing import Any
from paramiko.util import ClosingContextManager
class ProxyCommand(ClosingContextManager):
cmd: List[str]
cmd: list[str]
process: Popen[Any]
timeout: float | None
def __init__(self, command_line: str) -> None: ...

View File

@@ -1,5 +1,5 @@
import threading
from typing import Any, List, Tuple
from typing import Any, Tuple
from paramiko.channel import Channel
from paramiko.message import Message
@@ -13,7 +13,7 @@ class ServerInterface:
def check_auth_password(self, username: str, password: str) -> int: ...
def check_auth_publickey(self, username: str, key: PKey) -> int: ...
def check_auth_interactive(self, username: str, submethods: str) -> int | InteractiveQuery: ...
def check_auth_interactive_response(self, responses: List[str]) -> int | InteractiveQuery: ...
def check_auth_interactive_response(self, responses: list[str]) -> int | InteractiveQuery: ...
def check_auth_gssapi_with_mic(self, username: str, gss_authenticated: int = ..., cc_file: str | None = ...) -> int: ...
def check_auth_gssapi_keyex(self, username: str, gss_authenticated: int = ..., cc_file: str | None = ...) -> int: ...
def enable_auth_gssapi(self) -> bool: ...
@@ -40,7 +40,7 @@ class ServerInterface:
class InteractiveQuery:
name: str
instructions: str
prompts: List[Tuple[str, bool]]
prompts: list[Tuple[str, bool]]
def __init__(self, name: str = ..., instructions: str = ..., *prompts: str | Tuple[str, bool]) -> None: ...
def add_prompt(self, prompt: str, echo: bool = ...) -> None: ...

View File

@@ -1,5 +1,4 @@
from logging import Logger
from typing import Dict, List
from paramiko.channel import Channel
@@ -41,7 +40,7 @@ SFTP_NO_CONNECTION: int
SFTP_CONNECTION_LOST: int
SFTP_OP_UNSUPPORTED: int
SFTP_DESC: List[str]
SFTP_DESC: list[str]
SFTP_FLAG_READ: int
SFTP_FLAG_WRITE: int
@@ -50,7 +49,7 @@ SFTP_FLAG_CREATE: int
SFTP_FLAG_TRUNC: int
SFTP_FLAG_EXCL: int
CMD_NAMES: Dict[int, str]
CMD_NAMES: dict[int, str]
class SFTPError(Exception): ...

View File

@@ -1,5 +1,4 @@
from os import stat_result
from typing import Dict
class SFTPAttributes:
FLAG_SIZE: int
@@ -15,7 +14,7 @@ class SFTPAttributes:
st_mtime: int | None
filename: str # only when from_stat() is used
longname: str # only when from_stat() is used
attr: Dict[str, str]
attr: dict[str, str]
def __init__(self) -> None: ...
@classmethod
def from_stat(cls, obj: stat_result, filename: str | None = ...) -> SFTPAttributes: ...

View File

@@ -1,5 +1,5 @@
from logging import Logger
from typing import IO, Any, Callable, Iterator, List, Text, Tuple
from typing import IO, Any, Callable, Iterator, Text, Tuple
from paramiko.channel import Channel
from paramiko.sftp import BaseSFTP
@@ -24,8 +24,8 @@ class SFTPClient(BaseSFTP, ClosingContextManager):
) -> SFTPClient | None: ...
def close(self) -> None: ...
def get_channel(self) -> Channel | None: ...
def listdir(self, path: str = ...) -> List[str]: ...
def listdir_attr(self, path: str = ...) -> List[SFTPAttributes]: ...
def listdir(self, path: str = ...) -> list[str]: ...
def listdir_attr(self, path: str = ...) -> list[SFTPAttributes]: ...
def listdir_iter(self, path: bytes | Text = ..., read_aheads: int = ...) -> Iterator[SFTPAttributes]: ...
def open(self, filename: bytes | Text, mode: str = ..., bufsize: int = ...) -> SFTPFile: ...
file = open

View File

@@ -1,5 +1,5 @@
from logging import Logger
from typing import Any, Dict, Type
from typing import Any, Type
from paramiko.channel import Channel
from paramiko.server import ServerInterface, SubsystemHandler
@@ -13,8 +13,8 @@ class SFTPServer(BaseSFTP, SubsystemHandler):
logger: Logger
ultra_debug: bool
next_handle: int
file_table: Dict[bytes, SFTPHandle]
folder_table: Dict[bytes, SFTPHandle]
file_table: dict[bytes, SFTPHandle]
folder_table: dict[bytes, SFTPHandle]
server: SFTPServerInterface
sock: Channel | None
def __init__(

View File

@@ -1,4 +1,4 @@
from typing import Any, List
from typing import Any
from paramiko.server import ServerInterface
from paramiko.sftp_attr import SFTPAttributes
@@ -9,7 +9,7 @@ class SFTPServerInterface:
def session_started(self) -> None: ...
def session_ended(self) -> None: ...
def open(self, path: str, flags: int, attr: SFTPAttributes) -> SFTPHandle | int: ...
def list_folder(self, path: str) -> List[SFTPAttributes] | int: ...
def list_folder(self, path: str) -> list[SFTPAttributes] | int: ...
def stat(self, path: str) -> SFTPAttributes | int: ...
def lstat(self, path: str) -> SFTPAttributes | int: ...
def remove(self, path: str) -> int: ...

View File

@@ -1,5 +1,5 @@
import socket
from typing import List, Mapping, Tuple
from typing import Mapping, Tuple
from paramiko.pkey import PKey
@@ -8,13 +8,13 @@ class AuthenticationException(SSHException): ...
class PasswordRequiredException(AuthenticationException): ...
class BadAuthenticationType(AuthenticationException):
allowed_types: List[str]
allowed_types: list[str]
explanation: str
def __init__(self, explanation: str, types: List[str]) -> None: ...
def __init__(self, explanation: str, types: list[str]) -> None: ...
class PartialAuthentication(AuthenticationException):
allowed_types: List[str]
def __init__(self, types: List[str]) -> None: ...
allowed_types: list[str]
def __init__(self, types: list[str]) -> None: ...
class ChannelException(SSHException):
code: int

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, Dict, Iterable, List, Protocol, Sequence, Tuple, Type
from typing import Any, Callable, Iterable, Protocol, Sequence, Tuple, Type
from paramiko.auth_handler import AuthHandler, _InteractiveCallback
from paramiko.channel import Channel
@@ -45,8 +45,8 @@ class Transport(Thread, ClosingContextManager):
in_kex: bool
authenticated: bool
lock: Lock
channel_events: Dict[int, Event]
channels_seen: Dict[int, bool]
channel_events: dict[int, Event]
channels_seen: dict[int, bool]
default_max_packet_size: int
default_window_size: int
saved_exception: Exception | None
@@ -61,13 +61,13 @@ class Transport(Thread, ClosingContextManager):
banner_timeout: float
handshake_timeout: float
auth_timeout: float
disabled_algorithms: Dict[str, Iterable[str]] | None
disabled_algorithms: dict[str, Iterable[str]] | None
server_mode: bool
server_object: ServerInterface | None
server_key_dict: Dict[str, PKey]
server_accepts: List[Channel]
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,
@@ -76,7 +76,7 @@ class Transport(Thread, ClosingContextManager):
default_max_packet_size: int = ...,
gss_kex: bool = ...,
gss_deleg_creds: bool = ...,
disabled_algorithms: Dict[str, Iterable[str]] | None = ...,
disabled_algorithms: dict[str, Iterable[str]] | None = ...,
) -> None: ...
@property
def preferred_ciphers(self) -> Sequence[str]: ...
@@ -142,15 +142,15 @@ class Transport(Thread, ClosingContextManager):
def is_authenticated(self) -> bool: ...
def get_username(self) -> str | None: ...
def get_banner(self) -> bytes | None: ...
def auth_none(self, username: str) -> List[str]: ...
def auth_password(self, username: str, password: str, event: Event | None = ..., fallback: bool = ...) -> List[str]: ...
def auth_publickey(self, username: str, key: PKey, event: Event | None = ...) -> List[str]: ...
def auth_interactive(self, username: str, handler: _InteractiveCallback, submethods: str = ...) -> List[str]: ...
def auth_none(self, username: str) -> list[str]: ...
def auth_password(self, username: str, password: str, event: Event | None = ..., fallback: bool = ...) -> list[str]: ...
def auth_publickey(self, username: str, key: PKey, event: Event | None = ...) -> list[str]: ...
def auth_interactive(self, username: str, handler: _InteractiveCallback, submethods: str = ...) -> list[str]: ...
def auth_interactive_dumb(
self, username: str, handler: _InteractiveCallback | None = ..., submethods: str = ...
) -> List[str]: ...
def auth_gssapi_with_mic(self, username: str, gss_host: str, gss_deleg_creds: bool) -> List[str]: ...
def auth_gssapi_keyex(self, username: str) -> List[str]: ...
) -> list[str]: ...
def auth_gssapi_with_mic(self, username: str, gss_host: str, gss_deleg_creds: bool) -> list[str]: ...
def auth_gssapi_keyex(self, username: str) -> list[str]: ...
def set_log_channel(self, name: str) -> None: ...
def get_log_channel(self) -> str: ...
def set_hexdump(self, hexdump: bool) -> None: ...
@@ -188,5 +188,5 @@ class ChannelMap:
def put(self, chanid: int, chan: Channel) -> None: ...
def get(self, chanid: int) -> Channel: ...
def delete(self, chanid: int) -> None: ...
def values(self) -> List[Channel]: ...
def values(self) -> list[Channel]: ...
def __len__(self) -> int: ...

View File

@@ -1,7 +1,7 @@
import sys
from logging import Logger, LogRecord
from types import TracebackType
from typing import IO, AnyStr, Callable, List, Protocol, Type, TypeVar
from typing import IO, AnyStr, Callable, Protocol, Type, TypeVar
from paramiko.config import SSHConfig, SSHConfigDict
from paramiko.hostkeys import HostKeys
@@ -23,11 +23,11 @@ deflate_zero: int
deflate_ff: int
def deflate_long(n: int, add_sign_padding: bool = ...) -> bytes: ...
def format_binary(data: bytes, prefix: str = ...) -> List[str]: ...
def format_binary(data: bytes, prefix: str = ...) -> list[str]: ...
def format_binary_line(data: bytes) -> str: ...
def safe_string(s: bytes) -> bytes: ...
def bit_length(n: int) -> int: ...
def tb_strings() -> List[str]: ...
def tb_strings() -> list[str]: ...
def generate_key_bytes(hash_alg: Type[_Hash], salt: bytes, key: bytes | str, nbytes: int) -> bytes: ...
def load_host_keys(filename: str) -> HostKeys: ...
def parse_ssh_config(file_obj: IO[str]) -> SSHConfig: ...