Skip to content

Commit a3e45b5

Browse files
author
Max Rozentsveyg
committed
Add stubs for provider.pyi and utils.pyi
1 parent e938f7f commit a3e45b5

File tree

2 files changed

+310
-1
lines changed

2 files changed

+310
-1
lines changed

third_party/2and3/boto/provider.pyi

Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
from typing import Any, Optional, Text, Union
2+
3+
from boto.exceptions import BotoServerError
4+
from boto.gs.acl import CannedACLStrings as CannedGSACLStrings
5+
from boto.pyami.config import Config
6+
from boto.s3.acl import Acl, Policy
7+
from boto.s3.acl import CannedACLStrings as CannedS3ACLStrings
8+
9+
HEADER_PREFIX_KEY = ... # type: Text
10+
METADATA_PREFIX_KEY = ... # type: Text
11+
AWS_HEADER_PREFIX = ... # type: Text
12+
GOOG_HEADER_PREFIX = ... # type: Text
13+
ACL_HEADER_KEY = ... # type: Text
14+
AUTH_HEADER_KEY = ... # type: Text
15+
COPY_SOURCE_HEADER_KEY = ... # type: Text
16+
COPY_SOURCE_VERSION_ID_HEADER_KEY = ... # type: Text
17+
COPY_SOURCE_RANGE_HEADER_KEY = ... # type: Text
18+
DELETE_MARKER_HEADER_KEY = ... # type: Text
19+
DATE_HEADER_KEY = ... # type: Text
20+
METADATA_DIRECTIVE_HEADER_KEY = ... # type: Text
21+
RESUMABLE_UPLOAD_HEADER_KEY = ... # type: Text
22+
SECURITY_TOKEN_HEADER_KEY = ... # type: Text
23+
STORAGE_CLASS_HEADER_KEY = ... # type: Text
24+
MFA_HEADER_KEY = ... # type: Text
25+
SERVER_SIDE_ENCRYPTION_KEY = ... # type: Text
26+
VERSION_ID_HEADER_KEY = ... # type: Text
27+
RESTORE_HEADER_KEY = ... # type: Text
28+
STORAGE_COPY_ERROR = ... # type: Text
29+
STORAGE_CREATE_ERROR = ... # type: Text
30+
STORAGE_DATA_ERROR = ... # type: Text
31+
STORAGE_PERMISSIONS_ERROR = ... # type: Text
32+
STORAGE_RESPONSE_ERROR = ... # type: Text
33+
NO_CREDENTIALS_PROVIDED = ... # type: object
34+
35+
class ProfileNotFoundError(ValueError): ...
36+
37+
class Provider:
38+
CredentialMap = ... # type: Dict[Text, Tuple[Text, Text, Text, Text]
39+
AclClassMap = ... # type: Dict[Text, Union[Policy, Acl]]
40+
CannedAclsMap = ... # type: Dict[Text, Union[CannedS3ACLStrings, CannedGSACLStrings]]
41+
HostKeyMap = ... # type: Dict[Text, Text]
42+
ChunkedTransferSupport = ... # type: Dict[Text, bool]
43+
MetadataServiceSupport = ... # type: Dict[Text, bool]
44+
HeaderInfoMap = ... # type: Dict[Text, Dict[Text, Optional[Text]]]
45+
ErrorMap = ... # type: Dict[Text, BotoServerError]
46+
47+
host = ... # type: Optional[Text]
48+
port = ... # type: Optional[int]
49+
host_header = ... # type: Optional[Text]
50+
access_key = ... # type: Text
51+
secret_key = ... # type: Text
52+
security_token = ... # type: Optional[Text]
53+
profile_name = ... # type: Optional[Text]
54+
name = ... # type: Text
55+
acl_class = ... # type: Union[Policy, Acl]
56+
canned_acls = ... # type: Union[CannedS3ACLStrings, CannedGSACLStrings]
57+
shared_credentials = ... # type: Any
58+
59+
def __init__(
60+
self,
61+
name: Text,
62+
access_key: Optional[Text] = ...,
63+
secret_key: Optional[Text] = ...,
64+
security_token: Optional[Text] = ...,
65+
profile_name: Optional[Text] = ...,
66+
): ...
67+
def get_access_key(self): ...
68+
def set_access_key(self, value: Text): ...
69+
def get_secret_key(self): ...
70+
def set_secret_key(self, value: Text): ...
71+
def get_security_token(self): ...
72+
def set_security_token(self, value: Text): ...
73+
def get_credentials(
74+
self,
75+
access_key: Optional[Text] = ...,
76+
secret_key: Optional[Text] = ...,
77+
security_token: Optional[Text] = ...,
78+
profile_name: Optional[Text] = ...,
79+
):...
80+
81+
metadata_prefix = ... # type: Text
82+
header_prefix = ... # type: Text
83+
acl_header = ... # type: Text
84+
auth_header = ... # type: Text
85+
copy_source_header = ... # type: Text
86+
copy_source_version_id = ... # type: Text
87+
copy_source_range_header = ... # type: Optional[Text]
88+
date_header = ... # type: Text
89+
delete_marker = ... # type: Text
90+
metadata_directive_header = ... # type: Text
91+
security_token_header = ... # type: Text
92+
resumable_upload_header = ... # type: Optional[Text]
93+
server_side_encryption_header = ... # type: Optional[Text]
94+
storage_class_header = ... # type: Text
95+
version_id = ... # type: Text
96+
mfa_header = ... # type: Optional[Text]
97+
restore_header = ... # type: Optional[Text]
98+
99+
def configure_headers(self): ...
100+
101+
storage_copy_error = ... # type: BotoServerError
102+
storage_create_error = ... # type: BotoServerError
103+
storage_data_error = ... # type: BotoServerError
104+
storage_permissions_error = ... # type: BotoServerError
105+
storage_response_error = ... # type: BotoServerError
106+
107+
def configure_errors(self): ...
108+
def get_provider_name(self) -> Text: ...
109+
def supports_chunked_transfer(self) -> bool: ...
110+
111+
def get_default() -> Provider: ...

third_party/2and3/boto/utils.pyi

Lines changed: 199 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,201 @@
1-
from typing import Text
1+
import logging
2+
import logging.handlers
3+
import datetime
4+
import subprocess
5+
import thread
6+
import time
27

8+
import boto.provider
9+
import boto.connection
10+
import six
11+
from typing import Any, List, Hashable, Optional, Text, Union, Tuple
12+
13+
14+
JSONDecodeError = ... # type: Exception
15+
qsa_of_interest = ... # type: List[Text]
16+
17+
def unquote_v(nv: Text) -> Union[Text, Tuple[Text, Text]]: ...
18+
def canonical_string(
19+
method: Text,
20+
path: Text,
21+
headers: Dict[Text, Text],
22+
expires: Optional[int] = ...,
23+
provider: Optional[boto.provider.Provider] = ...,
24+
): ...
25+
def merge_meta(
26+
headers: Dict[Text, Text],
27+
metadata: Dict[Text, Text],
28+
provider: Optional[boto.provider.Provider] = ...,
29+
): ...
30+
def get_aws_metadata(headers: Dict[Text, Text], provider: Optional[boto.provider.Provider] = ...): ...
31+
def retry_url(
32+
url: Text,
33+
retry_on_404: bool = ...,
34+
num_retries: int = ...,
35+
timeout: Optional[int] = ...,
36+
): ...
37+
38+
class LazyLoadMetadata(dict):
39+
def __init__(
40+
self,
41+
url: Text,
42+
num_retries: int,
43+
timeout: Optional[int] = ...,
44+
) -> None: ...
45+
def __getitem__(self, key: Hashable): ...
46+
def get(self, key: Hashable, default: Optional[Any] = ...) -> Any: ...
47+
def values(self) -> List[Any]: ...
48+
def items(self) -> List[Tuple[Any, Any]]: ...
49+
50+
def get_instance_metadata(
51+
version: Text = ...,
52+
url: Text = ...,
53+
data: Text = ...,
54+
timeout: Optional[int] = ...,
55+
num_retries: int = ...
56+
) -> Optional[LazyLoadMetadata]: ...
57+
def get_instance_identity(
58+
version: Text = ...,
59+
url: Text = ...,
60+
timeout: Optional[int] = ...,
61+
num_retries: int = ...,
62+
) -> Optional[Dict[Text, Any]]: ...
63+
def get_instance_userdata(
64+
version: Text = ...,
65+
sep: Optional[Text] = ...,
66+
url: Text = ...,
67+
timeout: Optional[int] = ...,
68+
num_retries: int = ...,
69+
) -> Dict[Text, Text]: ...
70+
71+
ISO8601 = ... # type: Text
72+
ISO8601_MS = ... # type: Text
73+
RFC1123 = ... # type: Text
74+
LOCALE_LOCK = ... # type: therad.LockType
75+
76+
def setlocale(name: Union[Text, Tuple[Text, Text]]): ...
77+
def get_ts(ts: Optional[time.struct_time] = ...) -> Text: ...
78+
def parse_ts(ts: Text) -> datetime.datetime: ...
79+
def find_class(module_name: Text, class_name: Optional[Text] = ...) -> Optional[Any]: ...
80+
def update_dme(username: Text, password: Text, dme_id: Text, ip_address: Text) -> Text: ...
81+
def fetch_file(
82+
uri: Text,
83+
file: Optional[file] = ...,
84+
username: Optional[Text] = ...,
85+
password: Optional[Text] = ...,
86+
) -> file: ...
87+
88+
class ShellCommand:
89+
exit_code = ... # type: int
90+
command = ... # type: subprocess._CMD
91+
log_fp = ... # type: six.StringIO
92+
wait = ... # type: bool
93+
fail_fast = ... # type: bool
94+
95+
def __init__(
96+
self,
97+
command: subprocess._CMD,
98+
wait: bool = ...,
99+
fail_fast: bool = ...,
100+
cwd: Optional[subprocess._TXT] = ...,
101+
) -> None: ....
102+
103+
process = ... # type: subprocess.Popen
104+
105+
def run(self, cwd: Optional[subprocess._CMD] = ...) -> Optional[int]: ...
106+
def setReadOnly(self, value) -> None: ...
107+
def getStatus(self) -> Optional[int]: ...
108+
109+
status = ... # type: Any
110+
111+
def getOutput(self) -> Text: ...
112+
113+
output = ... # type: Any
114+
115+
class AuthSMTPHandler(logging.handlers.SMTPHandler):
116+
username = ... # type: Text
117+
password = ... # type: Text
118+
def __init__(
119+
self,
120+
mailhost: Text,
121+
username: Text,
122+
password: Text,
123+
fromaddr: Text,
124+
toaddrs: Sequence[Text],
125+
subject: Text,
126+
) -> None: ...
127+
def emit(self, record: logging.Record) -> None: ...
128+
129+
class LRUCache(dict):
130+
class _Item:
131+
previous = ... # type: Optional[_Item]
132+
key = ... # type: Hashable
133+
value = ... # type: Any
134+
def __init__(self, key, value) -> None: ...
135+
136+
capacity = ... # type: int
137+
head = ... # type: Optional[_Item]
138+
tail = ... # type: Optional[_Item]
139+
140+
def __init__(self, capacity: int) -> None: ...
141+
def __contains__(self, key: Hashable) -> bool: ...
142+
def __iter__(self): ...
143+
def __len__(self) -> int: ...
144+
def __getitem__(self, key: Hashable) -> Any: ...
145+
def __setitem__(self, key: Hashable, value: Any): ...
146+
147+
class Password:
148+
hashfunc = ... # type: Callable
149+
str = ... # type: Optional[Text]
150+
151+
def __init__(
152+
self,
153+
str: Optional[Text] = ...,
154+
hashfunc: Optional[Callable] = ...,
155+
) -> None: ...
156+
def set(self, value: Optional[bytes, Text]): ...
157+
def __eq__(self, other: Any) -> bool: ...
158+
def __len__(self) -> bool: ...
159+
160+
def notify(
161+
subject: Text,
162+
body: Optional[Text] = ...,
163+
html_body: Optional[Union[Sequence[Text], Text]] = ...,
164+
to_string: Optional[Text] = ...,
165+
attachments: Optional[Iterable] = ...,
166+
append_instance_id: bool = ...,
167+
): ...
168+
def get_utf8_value(value: Text) -> Text: ...
169+
def mklist(value: Any) -> List: ...
3170
def pythonize_name(name: Text) -> Text: ...
171+
def write_mime_multipart(
172+
content: List[Tuple[Text, Text]],
173+
compress: bool = ...,
174+
deftype: Text = ...,
175+
delimiter: Text = ...,
176+
): ...
177+
def guess_mime_type(content: Text, deftype: Text) -> Text: ...
178+
def compute_md5(
179+
fp: file,
180+
buf_size: int = ...,
181+
size: Optional[int] = ...,
182+
) -> Tuple[Text, Text, int]: ...
183+
def compute_hash(
184+
fp: file,
185+
buf_size: int = ...,
186+
size: Optional[int] = ...,
187+
hash_algorithm: Any = ...,
188+
) -> Tuple[Text, Text, int]: ...
189+
def find_matching_headers(name: Text, headers: Dict[Text, Text]) -> List[Text]: ...
190+
def merge_headers_by_name(name: Text, headers: Dict[Text, Text]) -> Text: ...
191+
192+
class RequestHook:
193+
def handle_request_data(
194+
self,
195+
request: boto.connection.HTTPRequest,
196+
response: boto.connection.HTTPResponse,
197+
error: bool = ...,
198+
): ...
199+
200+
def host_is_ipv6(hostname: Text) -> bool: ...
201+
def parse_host(hostname: Text) -> Text: ...

0 commit comments

Comments
 (0)