Use TypeAlias where possible for type aliases (#7630)

This commit is contained in:
Alex Waygood
2022-04-16 02:01:00 +01:00
committed by GitHub
parent c0e6dd3f3f
commit 740193a8fc
218 changed files with 760 additions and 625 deletions
+3 -3
View File
@@ -3,7 +3,7 @@ from contextlib import AbstractContextManager
from stat import S_IMODE as S_IMODE
from types import TracebackType
from typing import IO, Any, Callable, Sequence
from typing_extensions import Literal
from typing_extensions import Literal, TypeAlias
import paramiko
from paramiko import AuthenticationException as AuthenticationException
@@ -32,8 +32,8 @@ class CnOpts:
def __init__(self, knownhosts: str | None = ...) -> None: ...
def get_hostkey(self, host: str) -> paramiko.PKey: ...
_Callback = Callable[[int, int], Any]
_Path = str | bytes
_Callback: TypeAlias = Callable[[int, int], Any]
_Path: TypeAlias = str | bytes
class Connection:
def __init__(
+2 -1
View File
@@ -1,5 +1,6 @@
from collections.abc import Callable, Iterator
from contextlib import AbstractContextManager
from typing_extensions import TypeAlias
def known_hosts() -> str: ...
def st_mode_to_int(val: int) -> int: ...
@@ -26,7 +27,7 @@ def path_advance(thepath: str, sep: str = ...) -> Iterator[str]: ...
def path_retreat(thepath: str, sep: str = ...) -> Iterator[str]: ...
def reparent(newparent: str, oldpath: str) -> str: ...
_PathCallback = Callable[[str], None]
_PathCallback: TypeAlias = Callable[[str], None]
def walktree(
localpath: str, fcallback: _PathCallback, dcallback: _PathCallback, ucallback: _PathCallback, recurse: bool = ...