mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-08 13:04:46 +08:00
Improve classmethods in paramiko stubs (#7113)
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
from _typeshed import Self
|
||||
from typing import IO, Any, Iterable, Pattern
|
||||
|
||||
from paramiko.ssh_exception import ConfigParseError as ConfigParseError, CouldNotCanonicalize as CouldNotCanonicalize
|
||||
@@ -9,11 +10,11 @@ class SSHConfig:
|
||||
TOKENS_BY_CONFIG_KEY: dict[str, list[str]]
|
||||
def __init__(self) -> None: ...
|
||||
@classmethod
|
||||
def from_text(cls, text: str) -> SSHConfig: ...
|
||||
def from_text(cls: type[Self], text: str) -> Self: ...
|
||||
@classmethod
|
||||
def from_path(cls, path: str) -> SSHConfig: ...
|
||||
def from_path(cls: type[Self], path: str) -> Self: ...
|
||||
@classmethod
|
||||
def from_file(cls, flo: IO[str]) -> SSHConfig: ...
|
||||
def from_file(cls: type[Self], flo: IO[str]) -> Self: ...
|
||||
def parse(self, file_obj: IO[str]) -> None: ...
|
||||
def lookup(self, hostname: str) -> SSHConfigDict: ...
|
||||
def canonicalize(self, hostname: str, options: SSHConfigDict, domains: Iterable[str]) -> str: ...
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
from _typeshed import Self
|
||||
from typing import Iterator, Mapping, MutableMapping
|
||||
|
||||
from paramiko.pkey import PKey
|
||||
@@ -41,5 +42,5 @@ class HostKeyEntry:
|
||||
key: PKey
|
||||
def __init__(self, hostnames: list[str] | None = ..., key: PKey | None = ...) -> None: ...
|
||||
@classmethod
|
||||
def from_line(cls, line: str, lineno: int | None = ...) -> HostKeyEntry | None: ...
|
||||
def from_line(cls: type[Self], line: str, lineno: int | None = ...) -> Self | None: ...
|
||||
def to_line(self) -> str | None: ...
|
||||
|
||||
@@ -36,10 +36,10 @@ class PublicBlob:
|
||||
comment: str
|
||||
def __init__(self, type_: str, blob: bytes, comment: str | None = ...) -> None: ...
|
||||
@classmethod
|
||||
def from_file(cls, filename: str) -> PublicBlob: ...
|
||||
def from_file(cls: type[Self], filename: str) -> Self: ...
|
||||
@classmethod
|
||||
def from_string(cls, string: str) -> PublicBlob: ...
|
||||
def from_string(cls: type[Self], string: str) -> Self: ...
|
||||
@classmethod
|
||||
def from_message(cls, message: Message) -> PublicBlob: ...
|
||||
def from_message(cls: type[Self], message: Message) -> Self: ...
|
||||
def __eq__(self, other: object) -> bool: ...
|
||||
def __ne__(self, other: object) -> bool: ...
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
from _typeshed import Self
|
||||
from os import stat_result
|
||||
|
||||
class SFTPAttributes:
|
||||
@@ -17,5 +18,5 @@ class SFTPAttributes:
|
||||
attr: dict[str, str]
|
||||
def __init__(self) -> None: ...
|
||||
@classmethod
|
||||
def from_stat(cls, obj: stat_result, filename: str | None = ...) -> SFTPAttributes: ...
|
||||
def from_stat(cls: type[Self], obj: stat_result, filename: str | None = ...) -> Self: ...
|
||||
def asbytes(self) -> bytes: ...
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
from _typeshed import Self
|
||||
from logging import Logger
|
||||
from typing import IO, Any, Callable, Iterator, Text
|
||||
|
||||
@@ -20,8 +21,8 @@ class SFTPClient(BaseSFTP, ClosingContextManager):
|
||||
def __init__(self, sock: Channel) -> None: ...
|
||||
@classmethod
|
||||
def from_transport(
|
||||
cls, t: Transport, window_size: int | None = ..., max_packet_size: int | None = ...
|
||||
) -> SFTPClient | None: ...
|
||||
cls: type[Self], t: Transport, window_size: int | None = ..., max_packet_size: int | None = ...
|
||||
) -> Self | None: ...
|
||||
def close(self) -> None: ...
|
||||
def get_channel(self) -> Channel | None: ...
|
||||
def listdir(self, path: str = ...) -> list[str]: ...
|
||||
|
||||
Reference in New Issue
Block a user