--- /dev/null
+# Stubs for ftplib (Python 2.7/3)\r
+import sys\r
+from typing import Optional, BinaryIO, Tuple, TextIO, Iterable, Callable, List, Union, Iterator, Dict, Text, Type, TypeVar, Generic, Any\r
+from types import TracebackType\r
+from socket import socket\r
+from ssl import SSLContext\r
+\r
+_T = TypeVar('_T')\r
+_IntOrStr = Union[int, Text]\r
+\r
+MSG_OOB = ... # type: int\r
+FTP_PORT = ... # type: int\r
+MAXLINE = ... # type: int\r
+CRLF = ... # type: str\r
+if sys.version_info >= (3,):\r
+ B_CRLF = ... # type: bytes\r
+\r
+class Error(Exception): ...\r
+class error_reply(Error): ...\r
+class error_temp(Error): ...\r
+class error_perm(Error): ...\r
+class error_proto(Error): ...\r
+\r
+all_errors = Tuple[Exception, ...]\r
+\r
+class FTP:\r
+ debugging = ... # type: int\r
+\r
+ # Note: This is technically the type that's passed in as the host argument. But to make it easier in Python 2 we\r
+ # accept Text but return str.\r
+ host = ... # type: str\r
+\r
+ port = ... # type: int\r
+ maxline = ... # type: int\r
+ sock = ... # type: Optional[socket]\r
+ welcome = ... # type: Optional[str]\r
+ passiveserver = ... # type: int\r
+ timeout = ... # type: int\r
+ af = ... # type: int\r
+ lastresp = ... # type: str\r
+\r
+ if sys.version_info >= (3,):\r
+ file = ... # type: Optional[TextIO]\r
+ encoding = ... # type: str\r
+ def __enter__(self: _T) -> _T: ...\r
+ def __exit__(self, exc_type: Optional[Type[BaseException]], exc_val: Optional[BaseException],\r
+ exc_tb: Optional[TracebackType]) -> bool: ...\r
+ else:\r
+ file = ... # type: Optional[BinaryIO]\r
+\r
+ if sys.version_info >= (3, 3):\r
+ source_address = ... # type: Optional[Tuple[str, int]]\r
+ def __init__(self, host: Text = ..., user: Text = ..., passwd: Text = ..., acct: Text = ...,\r
+ timeout: float = ..., source_address: Optional[Tuple[str, int]] = ...) -> None: ...\r
+ def connect(self, host: Text = ..., port: int = ..., timeout: float = ...,\r
+ source_address: Optional[Tuple[str, int]] = ...) -> str: ...\r
+ else:\r
+ def __init__(self, host: Text = ..., user: Text = ..., passwd: Text = ..., acct: Text = ...,\r
+ timeout: float = ...) -> None: ...\r
+ def connect(self, host: Text = ..., port: int = ..., timeout: float = ...) -> str: ...\r
+\r
+ def getwelcome(self) -> str: ...\r
+ def set_debuglevel(self, level: int) -> None: ...\r
+ def debug(self, level: int) -> None: ...\r
+ def set_pasv(self, val: Union[bool, int]) -> None: ...\r
+ def sanitize(self, s: Text) -> str: ...\r
+ def putline(self, line: Text) -> None: ...\r
+ def putcmd(self, line: Text) -> None: ...\r
+ def getline(self) -> str: ...\r
+ def getmultiline(self) -> str: ...\r
+ def getresp(self) -> str: ...\r
+ def voidresp(self) -> str: ...\r
+ def abort(self) -> str: ...\r
+ def sendcmd(self, cmd: Text) -> str: ...\r
+ def voidcmd(self, cmd: Text) -> str: ...\r
+ def sendport(self, host: Text, port: int) -> str: ...\r
+ def sendeprt(self, host: Text, port: int) -> str: ...\r
+ def makeport(self) -> socket: ...\r
+ def makepasv(self) -> Tuple[str, int]: ...\r
+ def login(self, user: Text = ..., passwd: Text = ..., acct: Text = ...) -> str: ...\r
+\r
+ # In practice, `rest` rest can actually be anything whose str() is an integer sequence, so to make it simple we allow integers.\r
+ def ntransfercmd(self, cmd: Text, rest: Optional[_IntOrStr] = ...) -> Tuple[socket, int]: ...\r
+ def transfercmd(self, cmd: Text, rest: Optional[_IntOrStr] = ...) -> socket: ...\r
+ def retrbinary(self, cmd: Text, callback: Callable[[bytes], Any], blocksize: int = ..., rest: Optional[_IntOrStr] = ...) -> str: ...\r
+ def storbinary(self, cmd: Text, fp: BinaryIO, blocksize: int = ..., callback: Optional[Callable[[bytes], Any]] = ..., rest: Optional[_IntOrStr] = ...) -> str: ...\r
+\r
+ def retrlines(self, cmd: Text, callback: Optional[Callable[[str], Any]] = ...) -> str: ...\r
+ def storlines(self, cmd: Text, fp: BinaryIO, callback: Optional[Callable[[bytes], Any]] = ...) -> str: ...\r
+\r
+ def acct(self, password: Text) -> str: ...\r
+ def nlst(self, *args: Text) -> List[str]: ...\r
+\r
+ # Technically only the last arg can be a Callable but ...\r
+ def dir(self, *args: Union[str, Callable[[str], None]]) -> None: ...\r
+\r
+ if sys.version_info >= (3, 3):\r
+ def mlsd(self, path: Text = ..., facts: Iterable[str] = ...) -> Iterator[Tuple[str, Dict[str, str]]]: ...\r
+ def rename(self, fromname: Text, toname: Text) -> str: ...\r
+ def delete(self, filename: Text) -> str: ...\r
+ def cwd(self, dirname: Text) -> str: ...\r
+ def size(self, filename: Text) -> str: ...\r
+ def mkd(self, dirname: Text) -> str: ...\r
+ def rmd(self, dirname: Text) -> str: ...\r
+ def pwd(self) -> str: ...\r
+ def quit(self) -> str: ...\r
+ def close(self) -> None: ...\r
+\r
+class FTP_TLS(FTP):\r
+ def __init__(self, host: Text = ..., user: Text = ..., passwd: Text = ..., acct: Text = ...,\r
+ keyfile: Optional[str] = ..., certfile: Optional[str] = ...,\r
+ context: Optional[SSLContext] = ..., timeout: float = ...,\r
+ source_address: Optional[Tuple[str, int]] = ...) -> None: ...\r
+\r
+ ssl_version = ... # type: int\r
+ keyfile = ... # type: Optional[str]\r
+ certfile = ... # type: Optional[str]\r
+ context = ... # type: SSLContext\r
+\r
+ def login(self, user: Text = ..., passwd: Text = ..., acct: Text = ..., secure: bool = ...) -> str: ...\r
+ def auth(self) -> str: ...\r
+ def prot_p(self) -> str: ...\r
+ def prot_c(self) -> str: ...\r
+\r
+ if sys.version_info >= (3, 3):\r
+ def ccc(self) -> str: ...\r
+\r
+if sys.version_info < (3,):\r
+ class Netrc:\r
+ def __init__(self, filename: Optional[Text] = ...) -> None: ...\r
+ def get_hosts(self) -> List[str]: ...\r
+ def get_account(self, host: Text) -> Tuple[Optional[str], Optional[str], Optional[str]]: ...\r
+ def get_macros(self) -> List[str]: ...\r
+ def get_macro(self, macro: Text) -> Tuple[str, ...]: ...\r