mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-08 13:04:46 +08:00
Switch to PEP-604 syntax in python2 stubs (#5915)
Signed-off-by: oleg.hoefling <oleg.hoefling@gmail.com>
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
from _typeshed import SupportsRead, SupportsReadline
|
||||
from socket import socket
|
||||
from ssl import SSLContext
|
||||
from typing import Any, BinaryIO, Callable, List, Optional, Text, Tuple, Type, TypeVar, Union
|
||||
from typing import Any, BinaryIO, Callable, List, Text, Tuple, Type, TypeVar, Union
|
||||
from typing_extensions import Literal
|
||||
|
||||
_T = TypeVar("_T")
|
||||
@@ -29,14 +29,14 @@ class FTP:
|
||||
|
||||
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[BinaryIO]
|
||||
file: BinaryIO | None
|
||||
def __init__(
|
||||
self, host: Text = ..., user: Text = ..., passwd: Text = ..., acct: Text = ..., timeout: float = ...
|
||||
) -> None: ...
|
||||
@@ -44,7 +44,7 @@ class FTP:
|
||||
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: Text) -> str: ...
|
||||
def putline(self, line: Text) -> None: ...
|
||||
def putcmd(self, line: Text) -> None: ...
|
||||
@@ -61,29 +61,29 @@ class FTP:
|
||||
def makepasv(self) -> Tuple[str, int]: ...
|
||||
def login(self, user: Text = ..., passwd: Text = ..., acct: Text = ...) -> 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: Text, rest: Optional[_IntOrStr] = ...) -> Tuple[socket, int]: ...
|
||||
def transfercmd(self, cmd: Text, rest: Optional[_IntOrStr] = ...) -> socket: ...
|
||||
def ntransfercmd(self, cmd: Text, rest: _IntOrStr | None = ...) -> Tuple[socket, int]: ...
|
||||
def transfercmd(self, cmd: Text, rest: _IntOrStr | None = ...) -> socket: ...
|
||||
def retrbinary(
|
||||
self, cmd: Text, callback: Callable[[bytes], Any], blocksize: int = ..., rest: Optional[_IntOrStr] = ...
|
||||
self, cmd: Text, callback: Callable[[bytes], Any], blocksize: int = ..., rest: _IntOrStr | None = ...
|
||||
) -> str: ...
|
||||
def storbinary(
|
||||
self,
|
||||
cmd: Text,
|
||||
fp: SupportsRead[bytes],
|
||||
blocksize: int = ...,
|
||||
callback: Optional[Callable[[bytes], Any]] = ...,
|
||||
rest: Optional[_IntOrStr] = ...,
|
||||
callback: Callable[[bytes], Any] | None = ...,
|
||||
rest: _IntOrStr | None = ...,
|
||||
) -> str: ...
|
||||
def retrlines(self, cmd: Text, callback: Optional[Callable[[str], Any]] = ...) -> str: ...
|
||||
def storlines(self, cmd: Text, fp: SupportsReadline[bytes], callback: Optional[Callable[[bytes], Any]] = ...) -> str: ...
|
||||
def retrlines(self, cmd: Text, callback: Callable[[str], Any] | None = ...) -> str: ...
|
||||
def storlines(self, cmd: Text, fp: SupportsReadline[bytes], callback: Callable[[bytes], Any] | None = ...) -> str: ...
|
||||
def acct(self, password: Text) -> str: ...
|
||||
def nlst(self, *args: Text) -> 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 rename(self, fromname: Text, toname: Text) -> str: ...
|
||||
def delete(self, filename: Text) -> str: ...
|
||||
def cwd(self, dirname: Text) -> str: ...
|
||||
def size(self, filename: Text) -> Optional[int]: ...
|
||||
def size(self, filename: Text) -> int | None: ...
|
||||
def mkd(self, dirname: Text) -> str: ...
|
||||
def rmd(self, dirname: Text) -> str: ...
|
||||
def pwd(self) -> str: ...
|
||||
@@ -97,15 +97,15 @@ class FTP_TLS(FTP):
|
||||
user: Text = ...,
|
||||
passwd: Text = ...,
|
||||
acct: Text = ...,
|
||||
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: Text = ..., passwd: Text = ..., acct: Text = ..., secure: bool = ...) -> str: ...
|
||||
def auth(self) -> str: ...
|
||||
@@ -113,13 +113,13 @@ class FTP_TLS(FTP):
|
||||
def prot_c(self) -> str: ...
|
||||
|
||||
class Netrc:
|
||||
def __init__(self, filename: Optional[Text] = ...) -> None: ...
|
||||
def __init__(self, filename: Text | None = ...) -> None: ...
|
||||
def get_hosts(self) -> List[str]: ...
|
||||
def get_account(self, host: Text) -> Tuple[Optional[str], Optional[str], Optional[str]]: ...
|
||||
def get_account(self, host: Text) -> Tuple[str | None, str | None, str | None]: ...
|
||||
def get_macros(self) -> List[str]: ...
|
||||
def get_macro(self, macro: Text) -> Tuple[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
|
||||
|
||||
Reference in New Issue
Block a user