Use lowercase tuple where possible (#6170)

This commit is contained in:
Akuli
2021-10-15 00:18:19 +00:00
committed by GitHub
parent 5f386b0575
commit 994b69ef8f
242 changed files with 1212 additions and 1224 deletions

View File

@@ -1,3 +1 @@
from typing import Tuple
__version_info__: Tuple[int, int, int]
__version_info__: tuple[int, int, int]

View File

@@ -26,11 +26,11 @@ class AgentProxyThread(Thread):
class AgentLocalProxy(AgentProxyThread):
def __init__(self, agent: AgentServerProxy) -> None: ...
def get_connection(self) -> Tuple[socket, _RetAddress]: ...
def get_connection(self) -> tuple[socket, _RetAddress]: ...
class AgentRemoteProxy(AgentProxyThread):
def __init__(self, agent: AgentClientProxy, chan: Channel) -> None: ...
def get_connection(self) -> Tuple[socket, _RetAddress]: ...
def get_connection(self) -> tuple[socket, _RetAddress]: ...
class AgentClientProxy:
thread: Thread

View File

@@ -1,6 +1,6 @@
from logging import Logger
from threading import Condition, Event, Lock
from typing import Any, Callable, Mapping, Tuple, TypeVar
from typing import Any, Callable, Mapping, TypeVar
from paramiko.buffered_pipe import BufferedPipe
from paramiko.file import BufferedFile
@@ -58,7 +58,7 @@ class Channel(ClosingContextManager):
auth_protocol: str | None = ...,
auth_cookie: str | None = ...,
single_connection: bool = ...,
handler: Callable[[Channel, Tuple[str, int]], None] | None = ...,
handler: Callable[[Channel, tuple[str, int]], None] | None = ...,
) -> bytes: ...
def request_forward_agent(self, handler: Callable[[Channel], None]) -> bool: ...
def get_transport(self) -> Transport: ...

View File

@@ -1,5 +1,5 @@
from socket import socket
from typing import Iterable, Mapping, NoReturn, Tuple, Type
from typing import Iterable, Mapping, NoReturn, Type
from paramiko.channel import Channel, ChannelFile, ChannelStderrFile, ChannelStdinFile
from paramiko.hostkeys import HostKeys
@@ -47,7 +47,7 @@ class SSHClient(ClosingContextManager):
timeout: float | None = ...,
get_pty: bool = ...,
environment: dict[str, str] | None = ...,
) -> Tuple[ChannelStdinFile, ChannelFile, ChannelStderrFile]: ...
) -> tuple[ChannelStdinFile, ChannelFile, ChannelStderrFile]: ...
def invoke_shell(
self,
term: str = ...,

View File

@@ -1,4 +1,4 @@
from typing import IO, Any, Callable, Tuple
from typing import IO, Any, Callable
from paramiko.message import Message
from paramiko.pkey import PKey
@@ -17,7 +17,7 @@ class DSSKey(PKey):
data: bytes | None = ...,
filename: str | None = ...,
password: str | None = ...,
vals: Tuple[int, int, int, int] | None = ...,
vals: tuple[int, int, int, int] | None = ...,
file_obj: IO[str] | None = ...,
) -> None: ...
def asbytes(self) -> bytes: ...

View File

@@ -1,4 +1,4 @@
from typing import IO, Any, Callable, Sequence, Tuple, Type
from typing import IO, Any, Callable, Sequence, Type
from cryptography.hazmat.primitives.asymmetric.ec import EllipticCurve, EllipticCurvePrivateKey, EllipticCurvePublicKey
from cryptography.hazmat.primitives.hashes import HashAlgorithm
@@ -32,7 +32,7 @@ class ECDSAKey(PKey):
data: bytes | None = ...,
filename: str | None = ...,
password: str | None = ...,
vals: Tuple[EllipticCurvePrivateKey, EllipticCurvePublicKey] | None = ...,
vals: tuple[EllipticCurvePrivateKey, EllipticCurvePublicKey] | None = ...,
file_obj: IO[str] | None = ...,
validate_point: bool = ...,
) -> None: ...

View File

@@ -1,7 +1,7 @@
import sys
from logging import Logger
from socket import socket
from typing import Any, Callable, Tuple
from typing import Any, Callable
from cryptography.hazmat.primitives.ciphers import Cipher
from paramiko.compress import ZlibCompressor, ZlibDecompressor
@@ -57,4 +57,4 @@ class Packetizer:
def write_all(self, out: bytes) -> None: ...
def readline(self, timeout: float) -> str: ...
def send_message(self, data: Message) -> None: ...
def read_message(self) -> Tuple[int, Message]: ...
def read_message(self) -> tuple[int, Message]: ...

View File

@@ -1,4 +1,4 @@
from typing import Protocol, Tuple
from typing import Protocol
class _BasePipe(Protocol):
def clear(self) -> None: ...
@@ -32,4 +32,4 @@ class OrPipe:
def set(self) -> None: ...
def clear(self) -> None: ...
def make_or_pipe(pipe: _Pipe) -> Tuple[OrPipe, OrPipe]: ...
def make_or_pipe(pipe: _Pipe) -> tuple[OrPipe, OrPipe]: ...

View File

@@ -1,8 +1,6 @@
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]: ...
def get_modulus(self, min: int, prefer: int, max: int) -> tuple[int, int]: ...

View File

@@ -33,15 +33,15 @@ class ServerInterface:
self, channel: Channel, single_connection: bool, auth_protocol: str, auth_cookie: bytes, screen_number: int
) -> bool: ...
def check_channel_forward_agent_request(self, channel: Channel) -> bool: ...
def check_channel_direct_tcpip_request(self, chanid: int, origin: Tuple[str, int], destination: Tuple[str, int]) -> int: ...
def check_channel_direct_tcpip_request(self, chanid: int, origin: tuple[str, int], destination: tuple[str, int]) -> int: ...
def check_channel_env_request(self, channel: Channel, name: str, value: str) -> bool: ...
def get_banner(self) -> Tuple[str | None, str | None]: ...
def get_banner(self) -> tuple[str | None, str | None]: ...
class InteractiveQuery:
name: str
instructions: str
prompts: list[Tuple[str, bool]]
def __init__(self, name: str = ..., instructions: str = ..., *prompts: str | Tuple[str, bool]) -> None: ...
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: ...
class SubsystemHandler(threading.Thread):

View File

@@ -1,5 +1,5 @@
from logging import Logger
from typing import IO, Any, Callable, Iterator, Text, Tuple
from typing import IO, Any, Callable, Iterator, Text
from paramiko.channel import Channel
from paramiko.sftp import BaseSFTP
@@ -40,7 +40,7 @@ class SFTPClient(BaseSFTP, ClosingContextManager):
def symlink(self, source: bytes | Text, dest: bytes | Text) -> None: ...
def chmod(self, path: bytes | Text, mode: int) -> None: ...
def chown(self, path: bytes | Text, uid: int, gid: int) -> None: ...
def utime(self, path: bytes | Text, times: Tuple[float, float] | None) -> None: ...
def utime(self, path: bytes | Text, times: tuple[float, float] | None) -> None: ...
def truncate(self, path: bytes | Text, size: int) -> None: ...
def readlink(self, path: bytes | Text) -> Text | None: ...
def normalize(self, path: bytes | Text) -> Text: ...

View File

@@ -1,4 +1,4 @@
from typing import Any, Iterator, Sequence, Tuple
from typing import Any, Iterator, Sequence
from paramiko.file import BufferedFile
from paramiko.sftp_attr import SFTPAttributes
@@ -21,9 +21,9 @@ class SFTPFile(BufferedFile[Any]):
def stat(self) -> SFTPAttributes: ...
def chmod(self, mode: int) -> None: ...
def chown(self, uid: int, gid: int) -> None: ...
def utime(self, times: Tuple[float, float] | None) -> None: ...
def utime(self, times: tuple[float, float] | None) -> None: ...
def truncate(self, size: int) -> None: ...
def check(self, hash_algorithm: str, offset: int = ..., length: int = ..., block_size: int = ...) -> bytes: ...
def set_pipelined(self, pipelined: bool = ...) -> None: ...
def prefetch(self, file_size: int | None = ...) -> None: ...
def readv(self, chunks: Sequence[Tuple[int, int]]) -> Iterator[bytes]: ...
def readv(self, chunks: Sequence[tuple[int, int]]) -> Iterator[bytes]: ...

View File

@@ -1,5 +1,5 @@
import socket
from typing import Mapping, Tuple
from typing import Mapping
from paramiko.pkey import PKey
@@ -33,9 +33,9 @@ class ProxyCommandFailure(SSHException):
def __init__(self, command: str, error: str) -> None: ...
class NoValidConnectionsError(socket.error):
errors: Mapping[Tuple[str, int] | Tuple[str, int, int, int], Exception]
def __init__(self, errors: Mapping[Tuple[str, int] | Tuple[str, int, int, int], Exception]) -> None: ...
def __reduce__(self) -> Tuple[type, Tuple[Mapping[Tuple[str, int] | Tuple[str, int, int, int], Exception]]]: ...
errors: Mapping[tuple[str, int] | tuple[str, int, int, int], Exception]
def __init__(self, errors: Mapping[tuple[str, int] | tuple[str, int, int, int], Exception]) -> None: ...
def __reduce__(self) -> tuple[type, tuple[Mapping[tuple[str, int] | tuple[str, int, int, int], Exception]]]: ...
class CouldNotCanonicalize(SSHException): ...
class ConfigParseError(SSHException): ...

View File

@@ -67,11 +67,11 @@ 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,
sock: str | Tuple[str, int] | socket,
sock: str | tuple[str, int] | socket,
default_window_size: int = ...,
default_max_packet_size: int = ...,
gss_kex: bool = ...,
@@ -156,7 +156,7 @@ class Transport(Thread, ClosingContextManager):
def set_hexdump(self, hexdump: bool) -> None: ...
def get_hexdump(self) -> bool: ...
def use_compression(self, compress: bool = ...) -> None: ...
def getpeername(self) -> Tuple[str, int]: ...
def getpeername(self) -> tuple[str, int]: ...
def stop_thread(self) -> None: ...
def run(self) -> None: ...