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

@@ -2,7 +2,7 @@ from _typeshed import Self, SupportsRead, SupportsReadline
from socket import socket
from ssl import SSLContext
from types import TracebackType
from typing import Any, Callable, Dict, Iterable, Iterator, List, Optional, TextIO, Tuple, Type, Union
from typing import Any, Callable, Dict, Iterable, Iterator, List, TextIO, Tuple, Type
from typing_extensions import Literal
MSG_OOB: int
@@ -24,19 +24,19 @@ class FTP:
host: str
port: int
maxline: int
sock: Optional[socket]
welcome: Optional[str]
sock: socket | None
welcome: str | None
passiveserver: int
timeout: int
af: int
lastresp: str
file: Optional[TextIO]
file: TextIO | None
encoding: str
def __enter__(self: Self) -> Self: ...
def __exit__(
self, exc_type: Optional[Type[BaseException]], exc_val: Optional[BaseException], exc_tb: Optional[TracebackType]
self, exc_type: Type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None
) -> None: ...
source_address: Optional[Tuple[str, int]]
source_address: Tuple[str, int] | None
def __init__(
self,
host: str = ...,
@@ -44,15 +44,15 @@ class FTP:
passwd: str = ...,
acct: str = ...,
timeout: float = ...,
source_address: Optional[Tuple[str, int]] = ...,
source_address: Tuple[str, int] | None = ...,
) -> None: ...
def connect(
self, host: str = ..., port: int = ..., timeout: float = ..., source_address: Optional[Tuple[str, int]] = ...
self, host: str = ..., port: int = ..., timeout: float = ..., source_address: Tuple[str, int] | None = ...
) -> str: ...
def getwelcome(self) -> str: ...
def set_debuglevel(self, level: int) -> None: ...
def debug(self, level: int) -> None: ...
def set_pasv(self, val: Union[bool, int]) -> None: ...
def set_pasv(self, val: bool | int) -> None: ...
def sanitize(self, s: str) -> str: ...
def putline(self, line: str) -> None: ...
def putcmd(self, line: str) -> None: ...
@@ -69,30 +69,30 @@ class FTP:
def makepasv(self) -> Tuple[str, int]: ...
def login(self, user: str = ..., passwd: str = ..., acct: str = ...) -> str: ...
# In practice, `rest` rest can actually be anything whose str() is an integer sequence, so to make it simple we allow integers.
def ntransfercmd(self, cmd: str, rest: Optional[Union[int, str]] = ...) -> Tuple[socket, int]: ...
def transfercmd(self, cmd: str, rest: Optional[Union[int, str]] = ...) -> socket: ...
def ntransfercmd(self, cmd: str, rest: int | str | None = ...) -> Tuple[socket, int]: ...
def transfercmd(self, cmd: str, rest: int | str | None = ...) -> socket: ...
def retrbinary(
self, cmd: str, callback: Callable[[bytes], Any], blocksize: int = ..., rest: Optional[Union[int, str]] = ...
self, cmd: str, callback: Callable[[bytes], Any], blocksize: int = ..., rest: int | str | None = ...
) -> str: ...
def storbinary(
self,
cmd: str,
fp: SupportsRead[bytes],
blocksize: int = ...,
callback: Optional[Callable[[bytes], Any]] = ...,
rest: Optional[Union[int, str]] = ...,
callback: Callable[[bytes], Any] | None = ...,
rest: int | str | None = ...,
) -> str: ...
def retrlines(self, cmd: str, callback: Optional[Callable[[str], Any]] = ...) -> str: ...
def storlines(self, cmd: str, fp: SupportsReadline[bytes], callback: Optional[Callable[[bytes], Any]] = ...) -> str: ...
def retrlines(self, cmd: str, callback: Callable[[str], Any] | None = ...) -> str: ...
def storlines(self, cmd: str, fp: SupportsReadline[bytes], callback: Callable[[bytes], Any] | None = ...) -> str: ...
def acct(self, password: str) -> str: ...
def nlst(self, *args: str) -> List[str]: ...
# Technically only the last arg can be a Callable but ...
def dir(self, *args: Union[str, Callable[[str], None]]) -> None: ...
def dir(self, *args: str | Callable[[str], None]) -> None: ...
def mlsd(self, path: str = ..., facts: Iterable[str] = ...) -> Iterator[Tuple[str, Dict[str, str]]]: ...
def rename(self, fromname: str, toname: str) -> str: ...
def delete(self, filename: str) -> str: ...
def cwd(self, dirname: str) -> str: ...
def size(self, filename: str) -> Optional[int]: ...
def size(self, filename: str) -> int | None: ...
def mkd(self, dirname: str) -> str: ...
def rmd(self, dirname: str) -> str: ...
def pwd(self) -> str: ...
@@ -106,15 +106,15 @@ class FTP_TLS(FTP):
user: str = ...,
passwd: str = ...,
acct: str = ...,
keyfile: Optional[str] = ...,
certfile: Optional[str] = ...,
context: Optional[SSLContext] = ...,
keyfile: str | None = ...,
certfile: str | None = ...,
context: SSLContext | None = ...,
timeout: float = ...,
source_address: Optional[Tuple[str, int]] = ...,
source_address: Tuple[str, int] | None = ...,
) -> None: ...
ssl_version: int
keyfile: Optional[str]
certfile: Optional[str]
keyfile: str | None
certfile: str | None
context: SSLContext
def login(self, user: str = ..., passwd: str = ..., acct: str = ..., secure: bool = ...) -> str: ...
def auth(self) -> str: ...
@@ -122,7 +122,7 @@ class FTP_TLS(FTP):
def prot_c(self) -> str: ...
def ccc(self) -> str: ...
def parse150(resp: str) -> Optional[int]: ... # undocumented
def parse150(resp: str) -> int | None: ... # undocumented
def parse227(resp: str) -> Tuple[str, int]: ... # undocumented
def parse229(resp: str, peer: Any) -> Tuple[str, int]: ... # undocumented
def parse257(resp: str) -> str: ... # undocumented