mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-22 11:51:28 +08:00
Modernize syntax in various stubs (#7469)
Use `str` and `contextlib.AbstractContextManager` instead of `typing.Text` and `typing.ContextManager`.
This commit is contained in:
@@ -1,7 +1,8 @@
|
||||
from _typeshed import Self
|
||||
from contextlib import AbstractContextManager
|
||||
from stat import S_IMODE as S_IMODE
|
||||
from types import TracebackType
|
||||
from typing import IO, Any, Callable, ContextManager, Sequence, Text, Union
|
||||
from typing import IO, Any, Callable, Sequence, Union
|
||||
from typing_extensions import Literal
|
||||
|
||||
import paramiko
|
||||
@@ -32,7 +33,7 @@ class CnOpts:
|
||||
def get_hostkey(self, host: str) -> paramiko.PKey: ...
|
||||
|
||||
_Callback = Callable[[int, int], Any]
|
||||
_Path = Union[Text, bytes]
|
||||
_Path = Union[str, bytes]
|
||||
|
||||
class Connection:
|
||||
def __init__(
|
||||
@@ -75,7 +76,7 @@ class Connection:
|
||||
confirm: bool = ...,
|
||||
) -> paramiko.SFTPAttributes: ...
|
||||
def execute(self, command: str) -> list[str]: ...
|
||||
def cd(self, remotepath: _Path | None = ...) -> ContextManager[None]: ... # noqa: F811
|
||||
def cd(self, remotepath: _Path | None = ...) -> AbstractContextManager[None]: ... # noqa: F811
|
||||
def chdir(self, remotepath: _Path) -> None: ...
|
||||
def cwd(self, remotepath: _Path) -> None: ...
|
||||
def chmod(self, remotepath: _Path, mode: int = ...) -> None: ...
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
from typing import Callable, ContextManager, Iterator
|
||||
from collections.abc import Callable, Iterator
|
||||
from contextlib import AbstractContextManager
|
||||
|
||||
def known_hosts() -> str: ...
|
||||
def st_mode_to_int(val: int) -> int: ...
|
||||
@@ -30,4 +31,4 @@ _PathCallback = Callable[[str], None]
|
||||
def walktree(
|
||||
localpath: str, fcallback: _PathCallback, dcallback: _PathCallback, ucallback: _PathCallback, recurse: bool = ...
|
||||
) -> None: ...
|
||||
def cd(localpath: str | None = ...) -> ContextManager[None]: ...
|
||||
def cd(localpath: str | None = ...) -> AbstractContextManager[None]: ...
|
||||
|
||||
Reference in New Issue
Block a user