Update paramiko stubs to 3.0.* (#9667)

This commit is contained in:
Alex Waygood
2023-02-06 15:01:50 +00:00
committed by GitHub
parent 191afbc559
commit 262f2067aa
8 changed files with 20 additions and 61 deletions

View File

@@ -2,11 +2,6 @@ paramiko.SFTPServer.__init__
paramiko.Transport.open_x11_channel
paramiko.Transport.send_ignore
paramiko.Transport.start_server
paramiko.py3compat.input
paramiko.py3compat.BytesIO.readlines
paramiko.py3compat.BytesIO.seek
paramiko.py3compat.StringIO.seek
paramiko.py3compat.StringIO.truncate
paramiko.sftp_server.SFTPServer.__init__
paramiko.transport.Transport.open_x11_channel
paramiko.transport.Transport.send_ignore

View File

@@ -1,4 +1,4 @@
version = "2.12.*"
version = "3.0.*"
# Requires a version of cryptography where cryptography.hazmat.primitives.ciphers.Cipher is generic
requires = ["cryptography>=37.0.0"]

View File

@@ -1,5 +1,6 @@
from typing import Protocol
from typing_extensions import TypeAlias
def byte_ord(c: int | str) -> int: ...
def byte_chr(c: int) -> bytes: ...
def byte_mask(c: int, mask: int) -> bytes: ...
MSG_DISCONNECT: int
MSG_IGNORE: int
@@ -101,14 +102,6 @@ linefeed_byte: bytes
crlf: bytes
cr_byte_value: int
linefeed_byte_value: int
class _SupportsAsBytes(Protocol):
def asbytes(self) -> bytes: ...
_LikeBytes: TypeAlias = bytes | str | _SupportsAsBytes
def asbytes(s: _LikeBytes) -> bytes: ...
xffffffff: int
x80000000: int
o666: int

View File

@@ -1,7 +1,7 @@
from _typeshed import Self
from collections.abc import Iterable
from re import Pattern
from typing import IO, Any
from typing import IO
from paramiko.ssh_exception import ConfigParseError as ConfigParseError, CouldNotCanonicalize as CouldNotCanonicalize
@@ -29,6 +29,5 @@ class LazyFqdn:
def __init__(self, config: SSHConfigDict, host: str | None = ...) -> None: ...
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,14 +1,19 @@
from collections.abc import Iterable
from io import BytesIO
from typing import Any
from typing import Any, Protocol
from typing_extensions import TypeAlias
from .common import _LikeBytes
class _SupportsAsBytes(Protocol):
def asbytes(self) -> bytes: ...
_LikeBytes: TypeAlias = bytes | str | _SupportsAsBytes
class Message:
big_int: int
packet: BytesIO
seqno: int # only when packet.Packetizer.read_message() is used
def __init__(self, content: bytes | None = ...) -> None: ...
def __bytes__(self) -> bytes: ...
def asbytes(self) -> bytes: ...
def rewind(self) -> None: ...
def get_remainder(self) -> bytes: ...

View File

@@ -14,7 +14,7 @@ class PKey:
END_TAG: Pattern[str]
def __init__(self, msg: Message | None = ..., data: str | None = ...) -> None: ...
def asbytes(self) -> bytes: ...
def __cmp__(self, other: object) -> int: ...
def __bytes__(self) -> bytes: ...
def __eq__(self, other: object) -> bool: ...
def get_name(self) -> str: ...
def get_bits(self) -> int: ...

View File

@@ -1,31 +0,0 @@
import builtins as builtins
from collections.abc import Iterable, Sequence
from io import BytesIO as BytesIO, StringIO as StringIO
from typing import Any, TypeVar
_T = TypeVar("_T")
PY2: bool
string_types: type[Any] | Sequence[type[Any]]
text_type: type[Any] | Sequence[type[Any]]
bytes_types: type[Any] | Sequence[type[Any]]
integer_types: type[Any] | Sequence[type[Any]]
long = int
def input(prompt: Any) -> str: ...
def decodebytes(s: bytes) -> bytes: ...
def encodebytes(s: bytes) -> bytes: ...
bytes = builtins.bytes
def byte_ord(c: int | str) -> int: ...
def byte_chr(c: int) -> bytes: ...
def byte_mask(c: int, mask: int) -> bytes: ...
def b(s: bytes | str, encoding: str = ...) -> bytes: ...
def u(s: bytes | str, encoding: str = ...) -> str: ...
def b2s(s: bytes | str) -> str: ...
def is_callable(c: Any) -> bool: ...
def next(c: Iterable[_T]) -> _T: ...
MAXSIZE: int

View File

@@ -1,9 +1,8 @@
from _typeshed import Self
from collections.abc import Callable
from hashlib import _Hash
from logging import Logger, LogRecord
from types import TracebackType
from typing import IO, AnyStr, Protocol, TypeVar
from typing import IO, AnyStr, Protocol
from paramiko.config import SSHConfig, SSHConfigDict
from paramiko.hostkeys import HostKeys
@@ -11,13 +10,7 @@ from paramiko.hostkeys import HostKeys
class SupportsClose(Protocol):
def close(self) -> None: ...
_T = TypeVar("_T")
def inflate_long(s: bytes, always_positive: bool = ...) -> int: ...
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_line(data: bytes) -> str: ...
@@ -36,7 +29,6 @@ class PFilter:
def filter(self, record: LogRecord) -> bool: ...
def get_logger(name: str) -> Logger: ...
def retry_on_signal(function: Callable[[], _T]) -> _T: ...
def constant_time_bytes_eq(a: AnyStr, b: AnyStr) -> bool: ...
class ClosingContextManager:
@@ -46,3 +38,9 @@ class ClosingContextManager:
) -> None: ...
def clamp_value(minimum: int, val: int, maximum: int) -> int: ...
# This function attempts to convert objects to bytes,
# *but* just returns the object unchanged if that was unsuccessful!
def asbytes(s: object) -> object: ...
def b(s: str | bytes, encoding: str = "utf-8") -> bytes: ...
def u(s: str | bytes, encoding: str = "utf-8") -> str: ...