Skip to content

Improve classmethods in paramiko stubs #7113

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 2, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions stubs/paramiko/paramiko/config.pyi
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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: ...
Expand Down
3 changes: 2 additions & 1 deletion stubs/paramiko/paramiko/hostkeys.pyi
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from _typeshed import Self
from typing import Iterator, Mapping, MutableMapping

from paramiko.pkey import PKey
Expand Down Expand Up @@ -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: ...
6 changes: 3 additions & 3 deletions stubs/paramiko/paramiko/pkey.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -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: ...
3 changes: 2 additions & 1 deletion stubs/paramiko/paramiko/sftp_attr.pyi
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from _typeshed import Self
from os import stat_result

class SFTPAttributes:
Expand All @@ -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: ...
5 changes: 3 additions & 2 deletions stubs/paramiko/paramiko/sftp_client.pyi
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from _typeshed import Self
from logging import Logger
from typing import IO, Any, Callable, Iterator, Text

Expand All @@ -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]: ...
Expand Down