Fix small issues in ftplib (#6154)

This commit is contained in:
Kevin Rose
2021-10-12 20:51:52 -05:00
committed by GitHub
parent 39867f1096
commit 3c8c2519b4

View File

@@ -1,3 +1,4 @@
import sys
from _typeshed import Self, SupportsRead, SupportsReadline
from socket import socket
from ssl import SSLContext
@@ -32,20 +33,37 @@ class FTP:
lastresp: str
file: TextIO | None
encoding: str
# The following variable is intentionally left undocumented.
# See https://bugs.python.org/issue43285 for relevant discussion
# trust_server_pasv_ipv4_address: bool
def __enter__(self: Self) -> Self: ...
def __exit__(
self, exc_type: Type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None
) -> None: ...
source_address: Tuple[str, int] | None
def __init__(
self,
host: str = ...,
user: str = ...,
passwd: str = ...,
acct: str = ...,
timeout: float = ...,
source_address: Tuple[str, int] | None = ...,
) -> None: ...
if sys.version_info >= (3, 9):
def __init__(
self,
host: str = ...,
user: str = ...,
passwd: str = ...,
acct: str = ...,
timeout: float = ...,
source_address: Tuple[str, int] | None = ...,
*,
encoding: str = ...,
) -> None: ...
else:
def __init__(
self,
host: str = ...,
user: str = ...,
passwd: str = ...,
acct: str = ...,
timeout: float = ...,
source_address: Tuple[str, int] | None = ...,
) -> None: ...
def connect(
self, host: str = ..., port: int = ..., timeout: float = ..., source_address: Tuple[str, int] | None = ...
) -> str: ...
@@ -100,18 +118,34 @@ class FTP:
def close(self) -> None: ...
class FTP_TLS(FTP):
def __init__(
self,
host: str = ...,
user: str = ...,
passwd: str = ...,
acct: str = ...,
keyfile: str | None = ...,
certfile: str | None = ...,
context: SSLContext | None = ...,
timeout: float = ...,
source_address: Tuple[str, int] | None = ...,
) -> None: ...
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 = ...,
timeout: float = ...,
source_address: Tuple[str, int] | None = ...,
*,
encoding: str = ...,
) -> None: ...
else:
def __init__(
self,
host: str = ...,
user: str = ...,
passwd: str = ...,
acct: str = ...,
keyfile: str | None = ...,
certfile: str | None = ...,
context: SSLContext | None = ...,
timeout: float = ...,
source_address: Tuple[str, int] | None = ...,
) -> None: ...
ssl_version: int
keyfile: str | None
certfile: str | None