2 import logging.handlers
6 from typing import IO, Any, Callable, ContextManager, Dict, Iterable, Mapping, Sequence, Type, TypeVar
13 if sys.version_info >= (3,):
14 # TODO move _StringIO definition into boto.compat once stubs exist and rename to StringIO
17 _StringIO = io.StringIO
19 from hashlib import _Hash
23 from email.message import Message as _Message
25 # TODO move _StringIO definition into boto.compat once stubs exist and rename to StringIO
28 _StringIO = StringIO.StringIO[Any]
30 from hashlib import _hash
34 # TODO use email.message.Message once stubs exist
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
40 JSONDecodeError: Type[ValueError]
41 qsa_of_interest: list[str]
43 def unquote_v(nv: str) -> str | tuple[str, str]: ...
45 method: str, path: str, headers: Mapping[str, str | None], expires: int | None = ..., provider: _Provider | None = ...
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: ...
53 class LazyLoadMetadata(Dict[_KT, _VT]):
54 def __init__(self, url: str, num_retries: int, timeout: int | None = ...) -> None: ...
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]: ...
69 LOCALE_LOCK: _LockType
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: ...
77 uri: str, file: IO[str] | None = ..., username: str | None = ..., password: str | None = ...
78 ) -> IO[str] | None: ...
82 command: subprocess._CMD
87 self, command: subprocess._CMD, wait: bool = ..., fail_fast: bool = ..., cwd: subprocess._TXT | 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: ...
94 def getOutput(self) -> str: ...
97 class AuthSMTPHandler(logging.handlers.SMTPHandler):
101 self, mailhost: str, username: str, password: str, fromaddr: str, toaddrs: Sequence[str], subject: str
104 class LRUCache(Dict[_KT, _VT]):
106 previous: LRUCache._Item | None
107 next: LRUCache._Item | None
110 def __init__(self, key, value) -> None: ...
111 _dict: dict[_KT, LRUCache._Item]
113 head: LRUCache._Item | None
114 tail: LRUCache._Item | None
115 def __init__(self, capacity: int) -> None: ...
117 # This exists to work around Password.str's name shadowing the str type
121 hashfunc: Callable[[bytes], _HashType]
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: ...
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 = ...,
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 = ...
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: ...
149 def handle_request_data(
150 self, request: boto.connection.HTTPRequest, response: boto.connection.HTTPResponse, error: bool = ...
153 def host_is_ipv6(hostname: str) -> bool: ...
154 def parse_host(hostname: str) -> str: ...