Big diff: Use new "|" union syntax (#5872)

This commit is contained in:
Akuli
2021-08-08 12:05:21 +03:00
committed by GitHub
parent b9adb7a874
commit ee487304d7
578 changed files with 8080 additions and 8966 deletions

View File

@@ -1,6 +1,6 @@
from stat import S_IMODE as S_IMODE
from types import TracebackType
from typing import IO, Any, Callable, ContextManager, List, Optional, Sequence, Text, Tuple, Type, Union
from typing import IO, Any, Callable, ContextManager, List, Sequence, Text, Tuple, Type, Union
from typing_extensions import Literal
import paramiko
@@ -25,9 +25,9 @@ from pysftp.helpers import (
class CnOpts:
log: bool = ...
compression: bool = ...
ciphers: Optional[Sequence[str]] = ...
ciphers: Sequence[str] | None = ...
hostkeys: paramiko.HostKeys = ...
def __init__(self, knownhosts: Optional[str] = ...) -> None: ...
def __init__(self, knownhosts: str | None = ...) -> None: ...
def get_hostkey(self, host: str) -> paramiko.PKey: ...
_Callback = Callable[[int, int], Any]
@@ -37,29 +37,29 @@ class Connection:
def __init__(
self,
host: str,
username: Optional[str] = ...,
private_key: Optional[Union[str, paramiko.RSAKey, paramiko.AgentKey]] = ...,
password: Optional[str] = ...,
username: str | None = ...,
private_key: str | paramiko.RSAKey | paramiko.AgentKey | None = ...,
password: str | None = ...,
port: int = ...,
private_key_pass: Optional[str] = ...,
ciphers: Optional[Sequence[str]] = ...,
private_key_pass: str | None = ...,
ciphers: Sequence[str] | None = ...,
log: bool = ...,
cnopts: Optional[CnOpts] = ...,
default_path: Optional[_Path] = ...,
cnopts: CnOpts | None = ...,
default_path: _Path | None = ...,
) -> None: ...
@property
def pwd(self) -> str: ...
def get(
self, remotepath: _Path, localpath: Optional[_Path] = ..., callback: Optional[_Callback] = ..., preserve_mtime: bool = ...
self, remotepath: _Path, localpath: _Path | None = ..., callback: _Callback | None = ..., preserve_mtime: bool = ...
) -> None: ...
def get_d(self, remotedir: _Path, localdir: _Path, preserve_mtime: bool = ...) -> None: ...
def get_r(self, remotedir: _Path, localdir: _Path, preserve_mtime: bool = ...) -> None: ...
def getfo(self, remotepath: _Path, flo: IO[bytes], callback: Optional[_Callback] = ...) -> int: ...
def getfo(self, remotepath: _Path, flo: IO[bytes], callback: _Callback | None = ...) -> int: ...
def put(
self,
localpath: _Path,
remotepath: Optional[_Path] = ...,
callback: Optional[_Callback] = ...,
remotepath: _Path | None = ...,
callback: _Callback | None = ...,
confirm: bool = ...,
preserve_mtime: bool = ...,
) -> paramiko.SFTPAttributes: ...
@@ -68,17 +68,17 @@ class Connection:
def putfo(
self,
flo: IO[bytes],
remotepath: Optional[_Path] = ...,
remotepath: _Path | None = ...,
file_size: int = ...,
callback: Optional[_Callback] = ...,
callback: _Callback | None = ...,
confirm: bool = ...,
) -> paramiko.SFTPAttributes: ...
def execute(self, command: str) -> List[str]: ...
def cd(self, remotepath: Optional[_Path] = ...) -> ContextManager[None]: ... # noqa: F811
def cd(self, remotepath: _Path | None = ...) -> ContextManager[None]: ... # noqa: F811
def chdir(self, remotepath: _Path) -> None: ...
def cwd(self, remotepath: _Path) -> None: ...
def chmod(self, remotepath: _Path, mode: int = ...) -> None: ...
def chown(self, remotepath: _Path, uid: Optional[int] = ..., gid: Optional[int] = ...) -> None: ...
def chown(self, remotepath: _Path, uid: int | None = ..., gid: int | None = ...) -> None: ...
def getcwd(self) -> str: ...
def listdir(self, remotepath: _Path = ...) -> List[str]: ...
def listdir_attr(self, remotepath: _Path = ...) -> List[paramiko.SFTPAttributes]: ...
@@ -112,15 +112,15 @@ class Connection:
@property
def security_options(self) -> paramiko.SecurityOptions: ...
@property
def logfile(self) -> Union[str, Literal[False]]: ...
def logfile(self) -> str | Literal[False]: ...
@property
def timeout(self) -> Optional[float]: ...
def timeout(self) -> float | None: ...
@timeout.setter
def timeout(self, val: Optional[float]) -> None: ...
def timeout(self, val: float | None) -> None: ...
@property
def remote_server_key(self) -> paramiko.PKey: ...
def __del__(self) -> None: ...
def __enter__(self) -> "Connection": ...
def __exit__(
self, etype: Optional[Type[BaseException]], value: Optional[BaseException], traceback: Optional[TracebackType]
self, etype: Type[BaseException] | None, value: BaseException | None, traceback: TracebackType | None
) -> None: ...

View File

@@ -1,4 +1,4 @@
from typing import Callable, ContextManager, Iterator, List, Optional
from typing import Callable, ContextManager, Iterator, List
def known_hosts() -> str: ...
def st_mode_to_int(val: int) -> int: ...
@@ -30,4 +30,4 @@ _PathCallback = Callable[[str], None]
def walktree(
localpath: str, fcallback: _PathCallback, dcallback: _PathCallback, ucallback: _PathCallback, recurse: bool = ...
) -> None: ...
def cd(localpath: Optional[str] = ...) -> ContextManager[None]: ...
def cd(localpath: str | None = ...) -> ContextManager[None]: ...