massive update, probably broken
[dotfiles/.git] / .config / coc / extensions / node_modules / coc-pyright / node_modules / pyright / dist / typeshed-fallback / stdlib / ftplib.pyi
1 import sys
2 from _typeshed import Self, SupportsRead, SupportsReadline
3 from socket import socket
4 from ssl import SSLContext
5 from types import TracebackType
6 from typing import Any, Callable, Iterable, Iterator, TextIO, Tuple, Type
7 from typing_extensions import Literal
8
9 MSG_OOB: int
10 FTP_PORT: int
11 MAXLINE: int
12 CRLF: str
13 B_CRLF: bytes
14
15 class Error(Exception): ...
16 class error_reply(Error): ...
17 class error_temp(Error): ...
18 class error_perm(Error): ...
19 class error_proto(Error): ...
20
21 all_errors: Tuple[Type[Exception], ...]
22
23 class FTP:
24     debugging: int
25     host: str
26     port: int
27     maxline: int
28     sock: socket | None
29     welcome: str | None
30     passiveserver: int
31     timeout: int
32     af: int
33     lastresp: str
34     file: TextIO | None
35     encoding: str
36
37     # The following variable is intentionally left undocumented.
38     # See https://bugs.python.org/issue43285 for relevant discussion
39     # trust_server_pasv_ipv4_address: bool
40     def __enter__(self: Self) -> Self: ...
41     def __exit__(
42         self, exc_type: Type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None
43     ) -> None: ...
44     source_address: tuple[str, int] | None
45     if sys.version_info >= (3, 9):
46         def __init__(
47             self,
48             host: str = ...,
49             user: str = ...,
50             passwd: str = ...,
51             acct: str = ...,
52             timeout: float = ...,
53             source_address: tuple[str, int] | None = ...,
54             *,
55             encoding: str = ...,
56         ) -> None: ...
57     else:
58         def __init__(
59             self,
60             host: str = ...,
61             user: str = ...,
62             passwd: str = ...,
63             acct: str = ...,
64             timeout: float = ...,
65             source_address: tuple[str, int] | None = ...,
66         ) -> None: ...
67     def connect(
68         self, host: str = ..., port: int = ..., timeout: float = ..., source_address: tuple[str, int] | None = ...
69     ) -> str: ...
70     def getwelcome(self) -> str: ...
71     def set_debuglevel(self, level: int) -> None: ...
72     def debug(self, level: int) -> None: ...
73     def set_pasv(self, val: bool | int) -> None: ...
74     def sanitize(self, s: str) -> str: ...
75     def putline(self, line: str) -> None: ...
76     def putcmd(self, line: str) -> None: ...
77     def getline(self) -> str: ...
78     def getmultiline(self) -> str: ...
79     def getresp(self) -> str: ...
80     def voidresp(self) -> str: ...
81     def abort(self) -> str: ...
82     def sendcmd(self, cmd: str) -> str: ...
83     def voidcmd(self, cmd: str) -> str: ...
84     def sendport(self, host: str, port: int) -> str: ...
85     def sendeprt(self, host: str, port: int) -> str: ...
86     def makeport(self) -> socket: ...
87     def makepasv(self) -> tuple[str, int]: ...
88     def login(self, user: str = ..., passwd: str = ..., acct: str = ...) -> str: ...
89     # In practice, `rest` rest can actually be anything whose str() is an integer sequence, so to make it simple we allow integers.
90     def ntransfercmd(self, cmd: str, rest: int | str | None = ...) -> tuple[socket, int]: ...
91     def transfercmd(self, cmd: str, rest: int | str | None = ...) -> socket: ...
92     def retrbinary(
93         self, cmd: str, callback: Callable[[bytes], Any], blocksize: int = ..., rest: int | str | None = ...
94     ) -> str: ...
95     def storbinary(
96         self,
97         cmd: str,
98         fp: SupportsRead[bytes],
99         blocksize: int = ...,
100         callback: Callable[[bytes], Any] | None = ...,
101         rest: int | str | None = ...,
102     ) -> str: ...
103     def retrlines(self, cmd: str, callback: Callable[[str], Any] | None = ...) -> str: ...
104     def storlines(self, cmd: str, fp: SupportsReadline[bytes], callback: Callable[[bytes], Any] | None = ...) -> str: ...
105     def acct(self, password: str) -> str: ...
106     def nlst(self, *args: str) -> list[str]: ...
107     # Technically only the last arg can be a Callable but ...
108     def dir(self, *args: str | Callable[[str], None]) -> None: ...
109     def mlsd(self, path: str = ..., facts: Iterable[str] = ...) -> Iterator[tuple[str, dict[str, str]]]: ...
110     def rename(self, fromname: str, toname: str) -> str: ...
111     def delete(self, filename: str) -> str: ...
112     def cwd(self, dirname: str) -> str: ...
113     def size(self, filename: str) -> int | None: ...
114     def mkd(self, dirname: str) -> str: ...
115     def rmd(self, dirname: str) -> str: ...
116     def pwd(self) -> str: ...
117     def quit(self) -> str: ...
118     def close(self) -> None: ...
119
120 class FTP_TLS(FTP):
121     if sys.version_info >= (3, 9):
122         def __init__(
123             self,
124             host: str = ...,
125             user: str = ...,
126             passwd: str = ...,
127             acct: str = ...,
128             keyfile: str | None = ...,
129             certfile: str | None = ...,
130             context: SSLContext | None = ...,
131             timeout: float = ...,
132             source_address: tuple[str, int] | None = ...,
133             *,
134             encoding: str = ...,
135         ) -> None: ...
136     else:
137         def __init__(
138             self,
139             host: str = ...,
140             user: str = ...,
141             passwd: str = ...,
142             acct: str = ...,
143             keyfile: str | None = ...,
144             certfile: str | None = ...,
145             context: SSLContext | None = ...,
146             timeout: float = ...,
147             source_address: tuple[str, int] | None = ...,
148         ) -> None: ...
149     ssl_version: int
150     keyfile: str | None
151     certfile: str | None
152     context: SSLContext
153     def login(self, user: str = ..., passwd: str = ..., acct: str = ..., secure: bool = ...) -> str: ...
154     def auth(self) -> str: ...
155     def prot_p(self) -> str: ...
156     def prot_c(self) -> str: ...
157     def ccc(self) -> str: ...
158
159 def parse150(resp: str) -> int | None: ...  # undocumented
160 def parse227(resp: str) -> tuple[str, int]: ...  # undocumented
161 def parse229(resp: str, peer: Any) -> tuple[str, int]: ...  # undocumented
162 def parse257(resp: str) -> str: ...  # undocumented
163 def ftpcp(
164     source: FTP, sourcename: str, target: FTP, targetname: str = ..., type: Literal["A", "I"] = ...
165 ) -> None: ...  # undocumented