stdlib: add argument default values (#9501)

This commit is contained in:
Jelle Zijlstra
2023-01-18 00:37:34 -08:00
committed by GitHub
parent 6cb934291f
commit ddfaca3200
272 changed files with 2529 additions and 2467 deletions

View File

@@ -44,14 +44,14 @@ class FTP:
if sys.version_info >= (3, 9):
def __init__(
self,
host: str = ...,
user: str = ...,
passwd: str = ...,
acct: str = ...,
host: str = "",
user: str = "",
passwd: str = "",
acct: str = "",
timeout: float = ...,
source_address: tuple[str, int] | None = ...,
source_address: tuple[str, int] | None = None,
*,
encoding: str = ...,
encoding: str = "utf-8",
) -> None: ...
else:
def __init__(
@@ -65,7 +65,7 @@ class FTP:
) -> None: ...
def connect(
self, host: str = ..., port: int = ..., timeout: float = ..., source_address: tuple[str, int] | None = ...
self, host: str = "", port: int = 0, timeout: float = -999, source_address: tuple[str, int] | None = None
) -> str: ...
def getwelcome(self) -> str: ...
def set_debuglevel(self, level: int) -> None: ...
@@ -85,28 +85,28 @@ class FTP:
def sendeprt(self, host: str, port: int) -> str: ...
def makeport(self) -> socket: ...
def makepasv(self) -> tuple[str, int]: ...
def login(self, user: str = ..., passwd: str = ..., acct: str = ...) -> str: ...
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: int | str | None = ...) -> tuple[socket, int]: ...
def transfercmd(self, cmd: str, rest: int | str | None = ...) -> socket: ...
def ntransfercmd(self, cmd: str, rest: int | str | None = None) -> tuple[socket, int]: ...
def transfercmd(self, cmd: str, rest: int | str | None = None) -> socket: ...
def retrbinary(
self, cmd: str, callback: Callable[[bytes], object], blocksize: int = ..., rest: int | str | None = ...
self, cmd: str, callback: Callable[[bytes], object], blocksize: int = 8192, rest: int | str | None = None
) -> str: ...
def storbinary(
self,
cmd: str,
fp: SupportsRead[bytes],
blocksize: int = ...,
callback: Callable[[bytes], object] | None = ...,
rest: int | str | None = ...,
blocksize: int = 8192,
callback: Callable[[bytes], object] | None = None,
rest: int | str | None = None,
) -> str: ...
def retrlines(self, cmd: str, callback: Callable[[str], object] | None = ...) -> str: ...
def storlines(self, cmd: str, fp: SupportsReadline[bytes], callback: Callable[[bytes], object] | None = ...) -> str: ...
def retrlines(self, cmd: str, callback: Callable[[str], object] | None = None) -> str: ...
def storlines(self, cmd: str, fp: SupportsReadline[bytes], callback: Callable[[bytes], object] | None = 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: str | Callable[[str], object]) -> None: ...
def mlsd(self, path: str = ..., facts: Iterable[str] = ...) -> Iterator[tuple[str, dict[str, str]]]: ...
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: ...
@@ -121,17 +121,17 @@ class FTP_TLS(FTP):
if sys.version_info >= (3, 9):
def __init__(
self,
host: str = ...,
user: str = ...,
passwd: str = ...,
acct: str = ...,
keyfile: str | None = ...,
certfile: str | None = ...,
context: SSLContext | None = ...,
host: str = "",
user: str = "",
passwd: str = "",
acct: str = "",
keyfile: str | None = None,
certfile: str | None = None,
context: SSLContext | None = None,
timeout: float = ...,
source_address: tuple[str, int] | None = ...,
source_address: tuple[str, int] | None = None,
*,
encoding: str = ...,
encoding: str = "utf-8",
) -> None: ...
else:
def __init__(
@@ -150,7 +150,7 @@ class FTP_TLS(FTP):
keyfile: str | None
certfile: str | None
context: SSLContext
def login(self, user: str = ..., passwd: str = ..., acct: str = ..., secure: bool = ...) -> str: ...
def login(self, user: str = "", passwd: str = "", acct: str = "", secure: bool = True) -> str: ...
def auth(self) -> str: ...
def prot_p(self) -> str: ...
def prot_c(self) -> str: ...
@@ -161,5 +161,5 @@ def parse227(resp: str) -> tuple[str, int]: ... # undocumented
def parse229(resp: str, peer: Any) -> tuple[str, int]: ... # undocumented
def parse257(resp: str) -> str: ... # undocumented
def ftpcp(
source: FTP, sourcename: str, target: FTP, targetname: str = ..., type: Literal["A", "I"] = ...
source: FTP, sourcename: str, target: FTP, targetname: str = "", type: Literal["A", "I"] = "I"
) -> None: ... # undocumented