mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-07 12:44:28 +08:00
paramiko: Replace str with FileDescriptorOrPath in many locations (#11800)
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
from _typeshed import FileDescriptorOrPath
|
||||
from collections.abc import Iterable, Mapping
|
||||
from typing import NoReturn, Protocol
|
||||
|
||||
@@ -22,9 +23,9 @@ class _TransportFactory(Protocol):
|
||||
|
||||
class SSHClient(ClosingContextManager):
|
||||
def __init__(self) -> None: ...
|
||||
def load_system_host_keys(self, filename: str | None = None) -> None: ...
|
||||
def load_host_keys(self, filename: str) -> None: ...
|
||||
def save_host_keys(self, filename: str) -> None: ...
|
||||
def load_system_host_keys(self, filename: FileDescriptorOrPath | None = None) -> None: ...
|
||||
def load_host_keys(self, filename: FileDescriptorOrPath) -> None: ...
|
||||
def save_host_keys(self, filename: FileDescriptorOrPath) -> None: ...
|
||||
def get_host_keys(self) -> HostKeys: ...
|
||||
def set_log_channel(self, name: str) -> None: ...
|
||||
def set_missing_host_key_policy(self, policy: type[MissingHostKeyPolicy] | MissingHostKeyPolicy) -> None: ...
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
from _typeshed import FileDescriptorOrPath
|
||||
from collections.abc import Iterable
|
||||
from re import Pattern
|
||||
from typing import IO
|
||||
@@ -14,7 +15,7 @@ class SSHConfig:
|
||||
@classmethod
|
||||
def from_text(cls, text: str) -> Self: ...
|
||||
@classmethod
|
||||
def from_path(cls, path: str) -> Self: ...
|
||||
def from_path(cls, path: FileDescriptorOrPath) -> Self: ...
|
||||
@classmethod
|
||||
def from_file(cls, flo: IO[str]) -> Self: ...
|
||||
def parse(self, file_obj: IO[str]) -> None: ...
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from _typeshed import ReadableBuffer
|
||||
from _typeshed import FileDescriptorOrPath, ReadableBuffer
|
||||
from collections.abc import Callable
|
||||
from typing import IO
|
||||
|
||||
@@ -17,7 +17,7 @@ class DSSKey(PKey):
|
||||
self,
|
||||
msg: Message | None = None,
|
||||
data: ReadableBuffer | None = None,
|
||||
filename: str | None = None,
|
||||
filename: FileDescriptorOrPath | None = None,
|
||||
password: str | None = None,
|
||||
vals: tuple[int, int, int, int] | None = None,
|
||||
file_obj: IO[str] | None = None,
|
||||
@@ -29,7 +29,7 @@ class DSSKey(PKey):
|
||||
def can_sign(self) -> bool: ...
|
||||
def sign_ssh_data(self, data: bytes, algorithm: str | None = None) -> Message: ...
|
||||
def verify_ssh_sig(self, data: bytes, msg: Message) -> bool: ...
|
||||
def write_private_key_file(self, filename: str, password: str | None = None) -> None: ...
|
||||
def write_private_key_file(self, filename: FileDescriptorOrPath, password: str | None = None) -> None: ...
|
||||
def write_private_key(self, file_obj: IO[str], password: str | None = None) -> None: ...
|
||||
@staticmethod
|
||||
def generate(bits: int = 1024, progress_func: Callable[..., object] | None = None) -> DSSKey: ...
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from _typeshed import ReadableBuffer
|
||||
from _typeshed import FileDescriptorOrPath, ReadableBuffer
|
||||
from collections.abc import Callable, Sequence
|
||||
from typing import IO, Any
|
||||
|
||||
@@ -32,7 +32,7 @@ class ECDSAKey(PKey):
|
||||
self,
|
||||
msg: Message | None = None,
|
||||
data: ReadableBuffer | None = None,
|
||||
filename: str | None = None,
|
||||
filename: FileDescriptorOrPath | None = None,
|
||||
password: str | None = None,
|
||||
vals: tuple[EllipticCurvePrivateKey, EllipticCurvePublicKey] | None = None,
|
||||
file_obj: IO[str] | None = None,
|
||||
@@ -47,7 +47,7 @@ class ECDSAKey(PKey):
|
||||
def can_sign(self) -> bool: ...
|
||||
def sign_ssh_data(self, data: bytes, algorithm: str | None = None) -> Message: ...
|
||||
def verify_ssh_sig(self, data: bytes, msg: Message) -> bool: ...
|
||||
def write_private_key_file(self, filename: str, password: str | None = None) -> None: ...
|
||||
def write_private_key_file(self, filename: FileDescriptorOrPath, password: str | None = None) -> None: ...
|
||||
def write_private_key(self, file_obj: IO[str], password: str | None = None) -> None: ...
|
||||
@classmethod
|
||||
def generate(
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from _typeshed import ReadableBuffer
|
||||
from _typeshed import FileDescriptorOrPath, ReadableBuffer
|
||||
from typing import IO
|
||||
|
||||
from paramiko.message import Message
|
||||
@@ -10,7 +10,7 @@ class Ed25519Key(PKey):
|
||||
self,
|
||||
msg: Message | None = None,
|
||||
data: ReadableBuffer | None = None,
|
||||
filename: str | None = None,
|
||||
filename: FileDescriptorOrPath | None = None,
|
||||
password: str | None = None,
|
||||
file_obj: IO[str] | None = None,
|
||||
) -> None: ...
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
from _typeshed import FileDescriptorOrPath
|
||||
from collections.abc import Iterator, Mapping, MutableMapping
|
||||
from typing_extensions import Self
|
||||
|
||||
@@ -14,10 +15,10 @@ class _SubDict(MutableMapping[str, PKey]):
|
||||
def keys(self) -> list[str]: ... # type: ignore[override]
|
||||
|
||||
class HostKeys(MutableMapping[str, _SubDict]):
|
||||
def __init__(self, filename: str | None = None) -> None: ...
|
||||
def __init__(self, filename: FileDescriptorOrPath | None = None) -> None: ...
|
||||
def add(self, hostname: str, keytype: str, key: PKey) -> None: ...
|
||||
def load(self, filename: str) -> None: ...
|
||||
def save(self, filename: str) -> None: ...
|
||||
def load(self, filename: FileDescriptorOrPath) -> None: ...
|
||||
def save(self, filename: FileDescriptorOrPath) -> None: ...
|
||||
def lookup(self, hostname: str) -> _SubDict | None: ...
|
||||
def check(self, hostname: str, key: PKey) -> bool: ...
|
||||
def clear(self) -> None: ...
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
from _typeshed import FileDescriptorOrPath
|
||||
from pathlib import Path
|
||||
from re import Pattern
|
||||
from typing import IO, TypeVar
|
||||
@@ -38,10 +39,10 @@ class PKey:
|
||||
def sign_ssh_data(self, data: bytes, algorithm: str | None = None) -> Message: ...
|
||||
def verify_ssh_sig(self, data: bytes, msg: Message) -> bool: ...
|
||||
@classmethod
|
||||
def from_private_key_file(cls, filename: str, password: str | None = None) -> Self: ...
|
||||
def from_private_key_file(cls, filename: FileDescriptorOrPath, password: str | None = None) -> Self: ...
|
||||
@classmethod
|
||||
def from_private_key(cls, file_obj: IO[str], password: str | None = None) -> Self: ...
|
||||
def write_private_key_file(self, filename: str, password: str | None = None) -> None: ...
|
||||
def write_private_key_file(self, filename: FileDescriptorOrPath, password: str | None = None) -> None: ...
|
||||
def write_private_key(self, file_obj: IO[str], password: str | None = None) -> None: ...
|
||||
def load_certificate(self, value: Message | str) -> None: ...
|
||||
|
||||
@@ -51,7 +52,7 @@ class PublicBlob:
|
||||
comment: str
|
||||
def __init__(self, type_: str, blob: bytes, comment: str | None = None) -> None: ...
|
||||
@classmethod
|
||||
def from_file(cls, filename: str) -> Self: ...
|
||||
def from_file(cls, filename: FileDescriptorOrPath) -> Self: ...
|
||||
@classmethod
|
||||
def from_string(cls, string: str) -> Self: ...
|
||||
@classmethod
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
from _typeshed import FileDescriptorOrPath
|
||||
|
||||
class ModulusPack:
|
||||
pack: dict[int, list[tuple[int, int]]]
|
||||
discarded: list[tuple[int, str]]
|
||||
def __init__(self) -> None: ...
|
||||
def read_file(self, filename: str) -> None: ...
|
||||
def read_file(self, filename: FileDescriptorOrPath) -> None: ...
|
||||
def get_modulus(self, min: int, prefer: int, max: int) -> tuple[int, int]: ...
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from _typeshed import ReadableBuffer
|
||||
from _typeshed import FileDescriptorOrPath, ReadableBuffer
|
||||
from collections.abc import Callable
|
||||
from typing import IO
|
||||
|
||||
@@ -13,7 +13,7 @@ class RSAKey(PKey):
|
||||
self,
|
||||
msg: Message | None = None,
|
||||
data: ReadableBuffer | None = None,
|
||||
filename: str | None = None,
|
||||
filename: FileDescriptorOrPath | None = None,
|
||||
password: str | None = None,
|
||||
key: None | RSAPublicKey | RSAPrivateKey = None,
|
||||
file_obj: IO[str] | None = None,
|
||||
@@ -29,7 +29,7 @@ class RSAKey(PKey):
|
||||
def can_sign(self) -> bool: ...
|
||||
def sign_ssh_data(self, data: bytes, algorithm: str | None = None) -> Message: ...
|
||||
def verify_ssh_sig(self, data: bytes, msg: Message) -> bool: ...
|
||||
def write_private_key_file(self, filename: str, password: str | None = None) -> None: ...
|
||||
def write_private_key_file(self, filename: FileDescriptorOrPath, password: str | None = None) -> None: ...
|
||||
def write_private_key(self, file_obj: IO[str], password: str | None = None) -> None: ...
|
||||
@staticmethod
|
||||
def generate(bits: int, progress_func: Callable[..., object] | None = None) -> RSAKey: ...
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
from _typeshed import FileDescriptorOrPath
|
||||
from logging import Logger
|
||||
from typing import Any
|
||||
|
||||
@@ -25,4 +26,4 @@ class SFTPServer(BaseSFTP, SubsystemHandler):
|
||||
@staticmethod
|
||||
def convert_errno(e: int) -> int: ...
|
||||
@staticmethod
|
||||
def set_file_attr(filename: str, attr: SFTPAttributes) -> None: ...
|
||||
def set_file_attr(filename: FileDescriptorOrPath, attr: SFTPAttributes) -> None: ...
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
from _typeshed import FileDescriptorOrPath
|
||||
from collections.abc import Callable, Iterable, Mapping, Sequence
|
||||
from logging import Logger
|
||||
from socket import socket
|
||||
@@ -105,7 +106,7 @@ class Transport(Thread, ClosingContextManager):
|
||||
def add_server_key(self, key: PKey) -> None: ...
|
||||
def get_server_key(self) -> PKey | None: ...
|
||||
@staticmethod
|
||||
def load_server_moduli(filename: str | None = None) -> bool: ...
|
||||
def load_server_moduli(filename: FileDescriptorOrPath | None = None) -> bool: ...
|
||||
def close(self) -> None: ...
|
||||
def get_remote_server_key(self) -> PKey: ...
|
||||
def is_active(self) -> bool: ...
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from _typeshed import ReadableBuffer
|
||||
from _typeshed import FileDescriptorOrPath, ReadableBuffer
|
||||
from collections.abc import Iterable
|
||||
from hashlib import _Hash
|
||||
from logging import Logger, LogRecord
|
||||
@@ -20,12 +20,12 @@ def safe_string(s: Iterable[int | str]) -> bytes: ...
|
||||
def bit_length(n: int) -> int: ...
|
||||
def tb_strings() -> list[str]: ...
|
||||
def generate_key_bytes(hash_alg: type[_Hash], salt: ReadableBuffer, key: bytes | str, nbytes: int) -> bytes: ...
|
||||
def load_host_keys(filename: str) -> HostKeys: ...
|
||||
def load_host_keys(filename: FileDescriptorOrPath) -> HostKeys: ...
|
||||
def parse_ssh_config(file_obj: IO[str]) -> SSHConfig: ...
|
||||
def lookup_ssh_host_config(hostname: str, config: SSHConfig) -> SSHConfigDict: ...
|
||||
def mod_inverse(x: int, m: int) -> int: ...
|
||||
def get_thread_id() -> int: ...
|
||||
def log_to_file(filename: str, level: int = 10) -> None: ...
|
||||
def log_to_file(filename: FileDescriptorOrPath, level: int = 10) -> None: ...
|
||||
|
||||
class PFilter:
|
||||
def filter(self, record: LogRecord) -> bool: ...
|
||||
|
||||
Reference in New Issue
Block a user