massive update, probably broken
[dotfiles/.git] / .config / coc / extensions / node_modules / coc-pyright / node_modules / pyright / dist / typeshed-fallback / stubs / boto / boto / utils.pyi
1 import datetime
2 import logging.handlers
3 import subprocess
4 import sys
5 import time
6 from typing import IO, Any, Callable, ContextManager, Dict, Iterable, Mapping, Sequence, Type, TypeVar
7
8 import boto.connection
9
10 _KT = TypeVar("_KT")
11 _VT = TypeVar("_VT")
12
13 if sys.version_info >= (3,):
14     # TODO move _StringIO definition into boto.compat once stubs exist and rename to StringIO
15     import io
16
17     _StringIO = io.StringIO
18
19     from hashlib import _Hash
20
21     _HashType = _Hash
22
23     from email.message import Message as _Message
24 else:
25     # TODO move _StringIO definition into boto.compat once stubs exist and rename to StringIO
26     import StringIO
27
28     _StringIO = StringIO.StringIO[Any]
29
30     from hashlib import _hash
31
32     _HashType = _hash
33
34     # TODO use email.message.Message once stubs exist
35     _Message = Any
36
37 _Provider = Any  # TODO replace this with boto.provider.Provider once stubs exist
38 _LockType = Any  # TODO replace this with _thread.LockType once stubs exist
39
40 JSONDecodeError: Type[ValueError]
41 qsa_of_interest: list[str]
42
43 def unquote_v(nv: str) -> str | tuple[str, str]: ...
44 def canonical_string(
45     method: str, path: str, headers: Mapping[str, str | None], expires: int | None = ..., provider: _Provider | None = ...
46 ) -> str: ...
47 def merge_meta(
48     headers: Mapping[str, str], metadata: Mapping[str, str], provider: _Provider | None = ...
49 ) -> Mapping[str, str]: ...
50 def get_aws_metadata(headers: Mapping[str, str], provider: _Provider | None = ...) -> Mapping[str, str]: ...
51 def retry_url(url: str, retry_on_404: bool = ..., num_retries: int = ..., timeout: int | None = ...) -> str: ...
52
53 class LazyLoadMetadata(Dict[_KT, _VT]):
54     def __init__(self, url: str, num_retries: int, timeout: int | None = ...) -> None: ...
55
56 def get_instance_metadata(
57     version: str = ..., url: str = ..., data: str = ..., timeout: int | None = ..., num_retries: int = ...
58 ) -> LazyLoadMetadata[Any, Any] | None: ...
59 def get_instance_identity(
60     version: str = ..., url: str = ..., timeout: int | None = ..., num_retries: int = ...
61 ) -> Mapping[str, Any] | None: ...
62 def get_instance_userdata(
63     version: str = ..., sep: str | None = ..., url: str = ..., timeout: int | None = ..., num_retries: int = ...
64 ) -> Mapping[str, str]: ...
65
66 ISO8601: str
67 ISO8601_MS: str
68 RFC1123: str
69 LOCALE_LOCK: _LockType
70
71 def setlocale(name: str | tuple[str, str]) -> ContextManager[str]: ...
72 def get_ts(ts: time.struct_time | None = ...) -> str: ...
73 def parse_ts(ts: str) -> datetime.datetime: ...
74 def find_class(module_name: str, class_name: str | None = ...) -> Type[Any] | None: ...
75 def update_dme(username: str, password: str, dme_id: str, ip_address: str) -> str: ...
76 def fetch_file(
77     uri: str, file: IO[str] | None = ..., username: str | None = ..., password: str | None = ...
78 ) -> IO[str] | None: ...
79
80 class ShellCommand:
81     exit_code: int
82     command: subprocess._CMD
83     log_fp: _StringIO
84     wait: bool
85     fail_fast: bool
86     def __init__(
87         self, command: subprocess._CMD, wait: bool = ..., fail_fast: bool = ..., cwd: subprocess._TXT | None = ...
88     ) -> None: ...
89     process: subprocess.Popen[Any]
90     def run(self, cwd: subprocess._CMD | None = ...) -> int | None: ...
91     def setReadOnly(self, value) -> None: ...
92     def getStatus(self) -> int | None: ...
93     status: int | None
94     def getOutput(self) -> str: ...
95     output: str
96
97 class AuthSMTPHandler(logging.handlers.SMTPHandler):
98     username: str
99     password: str
100     def __init__(
101         self, mailhost: str, username: str, password: str, fromaddr: str, toaddrs: Sequence[str], subject: str
102     ) -> None: ...
103
104 class LRUCache(Dict[_KT, _VT]):
105     class _Item:
106         previous: LRUCache._Item | None
107         next: LRUCache._Item | None
108         key = ...
109         value = ...
110         def __init__(self, key, value) -> None: ...
111     _dict: dict[_KT, LRUCache._Item]
112     capacity: int
113     head: LRUCache._Item | None
114     tail: LRUCache._Item | None
115     def __init__(self, capacity: int) -> None: ...
116
117 # This exists to work around Password.str's name shadowing the str type
118 _str = str
119
120 class Password:
121     hashfunc: Callable[[bytes], _HashType]
122     str: _str | None
123     def __init__(self, str: _str | None = ..., hashfunc: Callable[[bytes], _HashType] | None = ...) -> None: ...
124     def set(self, value: bytes | _str) -> None: ...
125     def __eq__(self, other: Any) -> bool: ...
126     def __len__(self) -> int: ...
127
128 def notify(
129     subject: str,
130     body: str | None = ...,
131     html_body: Sequence[str] | str | None = ...,
132     to_string: str | None = ...,
133     attachments: Iterable[_Message] | None = ...,
134     append_instance_id: bool = ...,
135 ) -> None: ...
136 def get_utf8_value(value: str) -> bytes: ...
137 def mklist(value: Any) -> list[Any]: ...
138 def pythonize_name(name: str) -> str: ...
139 def write_mime_multipart(
140     content: list[tuple[str, str]], compress: bool = ..., deftype: str = ..., delimiter: str = ...
141 ) -> str: ...
142 def guess_mime_type(content: str, deftype: str) -> str: ...
143 def compute_md5(fp: IO[Any], buf_size: int = ..., size: int | None = ...) -> tuple[str, str, int]: ...
144 def compute_hash(fp: IO[Any], buf_size: int = ..., size: int | None = ..., hash_algorithm: Any = ...) -> tuple[str, str, int]: ...
145 def find_matching_headers(name: str, headers: Mapping[str, str | None]) -> list[str]: ...
146 def merge_headers_by_name(name: str, headers: Mapping[str, str | None]) -> str: ...
147
148 class RequestHook:
149     def handle_request_data(
150         self, request: boto.connection.HTTPRequest, response: boto.connection.HTTPResponse, error: bool = ...
151     ) -> Any: ...
152
153 def host_is_ipv6(hostname: str) -> bool: ...
154 def parse_host(hostname: str) -> str: ...