botocore-stubs 1.34.65__py3-none-any.whl → 1.35.98__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of botocore-stubs might be problematic. Click here for more details.

Files changed (72) hide show
  1. botocore-stubs/__init__.pyi +8 -2
  2. botocore-stubs/args.pyi +27 -26
  3. botocore-stubs/auth.pyi +38 -29
  4. botocore-stubs/awsrequest.pyi +29 -23
  5. botocore-stubs/client.pyi +44 -35
  6. botocore-stubs/compat.pyi +23 -13
  7. botocore-stubs/compress.pyi +8 -3
  8. botocore-stubs/config.pyi +29 -29
  9. botocore-stubs/configloader.pyi +11 -5
  10. botocore-stubs/configprovider.pyi +40 -28
  11. botocore-stubs/credentials.pyi +105 -93
  12. botocore-stubs/crt/__init__.pyi +6 -2
  13. botocore-stubs/crt/auth.pyi +6 -2
  14. botocore-stubs/discovery.pyi +30 -14
  15. botocore-stubs/docs/__init__.pyi +6 -2
  16. botocore-stubs/docs/bcdoc/__init__.pyi +6 -0
  17. botocore-stubs/docs/bcdoc/docstringparser.pyi +13 -7
  18. botocore-stubs/docs/bcdoc/restdoc.pyi +27 -17
  19. botocore-stubs/docs/bcdoc/style.pyi +13 -7
  20. botocore-stubs/docs/client.pyi +10 -4
  21. botocore-stubs/docs/docstring.pyi +6 -2
  22. botocore-stubs/docs/example.pyi +34 -25
  23. botocore-stubs/docs/method.pyi +23 -16
  24. botocore-stubs/docs/paginator.pyi +9 -2
  25. botocore-stubs/docs/params.pyi +31 -22
  26. botocore-stubs/docs/service.pyi +14 -9
  27. botocore-stubs/docs/shape.pyi +11 -4
  28. botocore-stubs/docs/sharedexample.pyi +19 -5
  29. botocore-stubs/docs/translator.pyi +8 -2
  30. botocore-stubs/docs/utils.pyi +15 -10
  31. botocore-stubs/docs/waiter.pyi +8 -3
  32. botocore-stubs/endpoint.pyi +24 -14
  33. botocore-stubs/endpoint_provider.pyi +41 -40
  34. botocore-stubs/errorfactory.pyi +9 -3
  35. botocore-stubs/eventstream.pyi +22 -16
  36. botocore-stubs/exceptions.pyi +10 -10
  37. botocore-stubs/handlers.pyi +36 -14
  38. botocore-stubs/history.pyi +8 -2
  39. botocore-stubs/hooks.pyi +28 -22
  40. botocore-stubs/httpchecksum.pyi +15 -10
  41. botocore-stubs/httpsession.pyi +23 -17
  42. botocore-stubs/loaders.pyi +19 -13
  43. botocore-stubs/model.pyi +60 -44
  44. botocore-stubs/monitoring.pyi +29 -22
  45. botocore-stubs/paginate.pyi +38 -24
  46. botocore-stubs/parsers.pyi +13 -7
  47. botocore-stubs/regions.pyi +38 -29
  48. botocore-stubs/response.pyi +10 -4
  49. botocore-stubs/retries/adaptive.pyi +7 -1
  50. botocore-stubs/retries/base.pyi +9 -3
  51. botocore-stubs/retries/bucket.pyi +13 -9
  52. botocore-stubs/retries/quota.pyi +11 -5
  53. botocore-stubs/retries/special.pyi +9 -2
  54. botocore-stubs/retries/standard.pyi +32 -24
  55. botocore-stubs/retries/throttling.pyi +6 -0
  56. botocore-stubs/retryhandler.pyi +12 -6
  57. botocore-stubs/serialize.pyi +14 -8
  58. botocore-stubs/session.pyi +53 -55
  59. botocore-stubs/signers.pyi +40 -23
  60. botocore-stubs/stub.pyi +15 -15
  61. botocore-stubs/tokens.pyi +12 -6
  62. botocore-stubs/translate.pyi +12 -5
  63. botocore-stubs/useragent.pyi +11 -5
  64. botocore-stubs/utils.pyi +86 -76
  65. botocore-stubs/validate.pyi +7 -1
  66. botocore-stubs/waiter.pyi +11 -5
  67. {botocore_stubs-1.34.65.dist-info → botocore_stubs-1.35.98.dist-info}/METADATA +39 -20
  68. botocore_stubs-1.35.98.dist-info/RECORD +73 -0
  69. {botocore_stubs-1.34.65.dist-info → botocore_stubs-1.35.98.dist-info}/WHEEL +2 -1
  70. botocore_stubs-1.35.98.dist-info/top_level.txt +1 -0
  71. botocore_stubs-1.34.65.dist-info/RECORD +0 -72
  72. {botocore_stubs-1.34.65.dist-info → botocore_stubs-1.35.98.dist-info}/LICENSE +0 -0
@@ -1,5 +1,11 @@
1
+ """
2
+ Type annotations for botocore module.
3
+
4
+ Copyright 2024 Vlad Emelianov
5
+ """
6
+
1
7
  import logging
2
- from typing import Any, Callable, Mapping, Tuple
8
+ from typing import Any, Callable, Mapping
3
9
 
4
10
  from botocore.session import Session
5
11
 
@@ -7,7 +13,7 @@ class NullHandler(logging.Handler):
7
13
  def emit(self, record: Any) -> None: ...
8
14
 
9
15
  log: logging.Logger
10
- ScalarTypes: Tuple[str, ...]
16
+ ScalarTypes: tuple[str, ...]
11
17
  BOTOCORE_ROOT: str
12
18
 
13
19
  UNSIGNED: Any
botocore-stubs/args.pyi CHANGED
@@ -1,12 +1,18 @@
1
- import sys
1
+ """
2
+ Type annotations for botocore.args module.
3
+
4
+ Copyright 2024 Vlad Emelianov
5
+ """
6
+
2
7
  from logging import Logger
3
- from typing import Any, Dict, List, Mapping, Optional, Union
8
+ from typing import Any, Mapping, TypedDict
4
9
 
5
10
  from botocore.client import ClientEndpointBridge
6
11
  from botocore.config import Config as Config
7
12
  from botocore.configprovider import ConfigValueStore
8
13
  from botocore.endpoint import Endpoint
9
14
  from botocore.endpoint import EndpointCreator as EndpointCreator
15
+ from botocore.errorfactory import ClientExceptionsFactory
10
16
  from botocore.hooks import BaseEventHooks
11
17
  from botocore.loaders import Loader
12
18
  from botocore.model import ServiceModel
@@ -15,15 +21,10 @@ from botocore.serialize import BaseRestSerializer
15
21
  from botocore.signers import RequestSigner as RequestSigner
16
22
  from botocore.useragent import UserAgentString
17
23
 
18
- if sys.version_info >= (3, 9):
19
- from typing import TypedDict
20
- else:
21
- from typing_extensions import TypedDict
22
-
23
24
  logger: Logger = ...
24
25
 
25
- VALID_REGIONAL_ENDPOINTS_CONFIG: List[str]
26
- LEGACY_GLOBAL_STS_REGIONS: List[str]
26
+ VALID_REGIONAL_ENDPOINTS_CONFIG: list[str]
27
+ LEGACY_GLOBAL_STS_REGIONS: list[str]
27
28
  USERAGENT_APPID_MAXLEN: int
28
29
 
29
30
  class _GetClientArgsTypeDef(TypedDict):
@@ -35,46 +36,46 @@ class _GetClientArgsTypeDef(TypedDict):
35
36
  service_model: ServiceModel
36
37
  loader: Loader
37
38
  client_config: Config
38
- partition: Optional[str]
39
- exceptions_factory: Any
39
+ partition: str | None
40
+ exceptions_factory: ClientExceptionsFactory
40
41
 
41
42
  class ClientArgsCreator:
42
43
  def __init__(
43
44
  self,
44
45
  event_emitter: BaseEventHooks,
45
- user_agent: Any,
46
+ user_agent: str,
46
47
  response_parser_factory: ResponseParserFactory,
47
48
  loader: Loader,
48
- exceptions_factory: Any,
49
+ exceptions_factory: ClientExceptionsFactory,
49
50
  config_store: ConfigValueStore,
50
- user_agent_creator: Optional[UserAgentString] = ...,
51
+ user_agent_creator: UserAgentString | None = ...,
51
52
  ) -> None: ...
52
53
  def get_client_args(
53
54
  self,
54
55
  service_model: ServiceModel,
55
56
  region_name: str,
56
57
  is_secure: bool,
57
- endpoint_url: Optional[str],
58
- verify: Optional[Union[str, bool]],
59
- credentials: Optional[Any],
60
- scoped_config: Optional[Mapping[str, Any]],
61
- client_config: Optional[Config],
58
+ endpoint_url: str | None,
59
+ verify: str | bool | None,
60
+ credentials: Any | None,
61
+ scoped_config: Mapping[str, Any] | None,
62
+ client_config: Config | None,
62
63
  endpoint_bridge: ClientEndpointBridge,
63
- auth_token: Optional[str] = ...,
64
- endpoints_ruleset_data: Optional[Mapping[str, Any]] = ...,
65
- partition_data: Optional[Mapping[str, Any]] = ...,
64
+ auth_token: str | None = ...,
65
+ endpoints_ruleset_data: Mapping[str, Any] | None = ...,
66
+ partition_data: Mapping[str, Any] | None = ...,
66
67
  ) -> _GetClientArgsTypeDef: ...
67
68
  def compute_client_args(
68
69
  self,
69
70
  service_model: ServiceModel,
70
- client_config: Optional[Config],
71
+ client_config: Config | None,
71
72
  endpoint_bridge: ClientEndpointBridge,
72
73
  region_name: str,
73
74
  endpoint_url: str,
74
75
  is_secure: bool,
75
- scoped_config: Optional[Mapping[str, Any]],
76
+ scoped_config: Mapping[str, Any] | None,
76
77
  ) -> Any: ...
77
- def compute_s3_config(self, client_config: Optional[Config]) -> Dict[str, Any]: ...
78
+ def compute_s3_config(self, client_config: Config | None) -> dict[str, Any]: ...
78
79
  def compute_endpoint_resolver_builtin_defaults(
79
80
  self,
80
81
  region_name: str,
@@ -83,4 +84,4 @@ class ClientArgsCreator:
83
84
  endpoint_bridge: ClientEndpointBridge,
84
85
  client_endpoint_url: str,
85
86
  legacy_endpoint_url: str,
86
- ) -> Dict[str, Any]: ...
87
+ ) -> dict[str, Any]: ...
botocore-stubs/auth.pyi CHANGED
@@ -1,6 +1,12 @@
1
+ """
2
+ Type annotations for botocore.auth module.
3
+
4
+ Copyright 2024 Vlad Emelianov
5
+ """
6
+
1
7
  from http.client import HTTPMessage
2
8
  from logging import Logger
3
- from typing import Any, Dict, Iterable, List, Mapping, Optional, Tuple, Type, Union
9
+ from typing import Any, Iterable, Mapping
4
10
  from urllib.parse import SplitResult
5
11
 
6
12
  from botocore.awsrequest import AWSRequest
@@ -12,41 +18,41 @@ from botocore.utils import IdentityCache
12
18
 
13
19
  logger: Logger = ...
14
20
 
15
- _CredentialsUnion = Union[Credentials, ReadOnlyCredentials]
16
-
17
21
  EMPTY_SHA256_HASH: str
18
22
  PAYLOAD_BUFFER: int
19
23
  ISO8601: str
20
24
  SIGV4_TIMESTAMP: str
21
- SIGNED_HEADERS_BLACKLIST: List[str]
25
+ SIGNED_HEADERS_BLACKLIST: list[str]
22
26
  UNSIGNED_PAYLOAD: str
23
27
  STREAMING_UNSIGNED_PAYLOAD_TRAILER: str
24
28
 
25
29
  class BaseSigner:
26
30
  REQUIRES_REGION: bool = ...
27
31
  REQUIRES_TOKEN: bool = ...
28
- def add_auth(self, request: AWSRequest) -> Optional[AWSRequest]: ...
32
+ def add_auth(self, request: AWSRequest) -> AWSRequest | None: ...
29
33
 
30
34
  class TokenSigner(BaseSigner):
31
35
  def __init__(self, auth_token: str) -> None: ...
32
36
 
33
37
  class SigV2Auth(BaseSigner):
34
- def __init__(self, credentials: _CredentialsUnion) -> None:
35
- self.credentials: _CredentialsUnion
38
+ def __init__(self, credentials: Credentials | ReadOnlyCredentials) -> None:
39
+ self.credentials: Credentials | ReadOnlyCredentials
36
40
 
37
- def calc_signature(self, request: AWSRequest, params: Mapping[str, Any]) -> Tuple[str, str]: ...
41
+ def calc_signature(self, request: AWSRequest, params: Mapping[str, Any]) -> tuple[str, str]: ...
38
42
  def add_auth(self, request: AWSRequest) -> AWSRequest: ...
39
43
 
40
44
  class SigV3Auth(BaseSigner):
41
- def __init__(self, credentials: _CredentialsUnion) -> None:
42
- self.credentials: _CredentialsUnion
45
+ def __init__(self, credentials: Credentials | ReadOnlyCredentials) -> None:
46
+ self.credentials: Credentials | ReadOnlyCredentials
43
47
 
44
48
  def add_auth(self, request: AWSRequest) -> None: ...
45
49
 
46
50
  class SigV4Auth(BaseSigner):
47
51
  REQUIRES_REGION: bool = ...
48
- def __init__(self, credentials: _CredentialsUnion, service_name: str, region_name: str) -> None:
49
- self.credentials: _CredentialsUnion
52
+ def __init__(
53
+ self, credentials: Credentials | ReadOnlyCredentials, service_name: str, region_name: str
54
+ ) -> None:
55
+ self.credentials: Credentials | ReadOnlyCredentials
50
56
 
51
57
  def headers_to_sign(self, request: AWSRequest) -> HTTPMessage: ...
52
58
  def canonical_query_string(self, request: AWSRequest) -> str: ...
@@ -67,7 +73,7 @@ class S3ExpressAuth(S3SigV4Auth):
67
73
 
68
74
  def __init__(
69
75
  self,
70
- credentials: _CredentialsUnion,
76
+ credentials: Credentials | ReadOnlyCredentials,
71
77
  service_name: str,
72
78
  region_name: str,
73
79
  *,
@@ -81,7 +87,7 @@ class S3ExpressQueryAuth(S3ExpressAuth):
81
87
 
82
88
  def __init__(
83
89
  self,
84
- credentials: _CredentialsUnion,
90
+ credentials: Credentials | ReadOnlyCredentials,
85
91
  service_name: str,
86
92
  region_name: str,
87
93
  *,
@@ -93,7 +99,7 @@ class SigV4QueryAuth(SigV4Auth):
93
99
  DEFAULT_EXPIRES: int = ...
94
100
  def __init__(
95
101
  self,
96
- credentials: _CredentialsUnion,
102
+ credentials: Credentials | ReadOnlyCredentials,
97
103
  service_name: str,
98
104
  region_name: str,
99
105
  expires: int = ...,
@@ -106,42 +112,42 @@ class S3SigV4PostAuth(SigV4Auth):
106
112
  def add_auth(self, request: AWSRequest) -> None: ...
107
113
 
108
114
  class HmacV1Auth(BaseSigner):
109
- QSAOfInterest: List[str] = ...
115
+ QSAOfInterest: list[str] = ...
110
116
  def __init__(
111
117
  self,
112
- credentials: _CredentialsUnion,
113
- service_name: Optional[str] = ...,
114
- region_name: Optional[str] = ...,
118
+ credentials: Credentials | ReadOnlyCredentials,
119
+ service_name: str | None = ...,
120
+ region_name: str | None = ...,
115
121
  ) -> None:
116
- self.credentials: _CredentialsUnion
122
+ self.credentials: Credentials | ReadOnlyCredentials
117
123
 
118
124
  def sign_string(self, string_to_sign: str) -> str: ...
119
125
  def canonical_standard_headers(self, headers: Mapping[str, Any]) -> str: ...
120
126
  def canonical_custom_headers(self, headers: Mapping[str, Any]) -> str: ...
121
- def unquote_v(self, nv: str) -> Union[Tuple[str, str], str]: ...
122
- def canonical_resource(self, split: SplitResult, auth_path: Optional[str] = ...) -> str: ...
127
+ def unquote_v(self, nv: str) -> tuple[str, str] | str: ...
128
+ def canonical_resource(self, split: SplitResult, auth_path: str | None = ...) -> str: ...
123
129
  def canonical_string(
124
130
  self,
125
131
  method: str,
126
132
  split: SplitResult,
127
133
  headers: Mapping[str, Any],
128
- expires: Optional[int] = ...,
129
- auth_path: Optional[str] = ...,
134
+ expires: int | None = ...,
135
+ auth_path: str | None = ...,
130
136
  ) -> Any: ...
131
137
  def get_signature(
132
138
  self,
133
139
  method: str,
134
140
  split: SplitResult,
135
141
  headers: Mapping[str, Any],
136
- expires: Optional[int] = ...,
137
- auth_path: Optional[str] = ...,
142
+ expires: int | None = ...,
143
+ auth_path: str | None = ...,
138
144
  ) -> Any: ...
139
145
  def add_auth(self, request: AWSRequest) -> None: ...
140
146
 
141
147
  class HmacV1QueryAuth(HmacV1Auth):
142
148
  DEFAULT_EXPIRES: int = ...
143
- def __init__(self, credentials: _CredentialsUnion, expires: int = ...) -> None:
144
- self.credentials: _CredentialsUnion
149
+ def __init__(self, credentials: Credentials | ReadOnlyCredentials, expires: int = ...) -> None:
150
+ self.credentials: Credentials | ReadOnlyCredentials
145
151
 
146
152
  class HmacV1PostAuth(HmacV1Auth):
147
153
  def add_auth(self, request: AWSRequest) -> None: ...
@@ -149,4 +155,7 @@ class HmacV1PostAuth(HmacV1Auth):
149
155
  class BearerAuth(TokenSigner):
150
156
  def add_auth(self, request: AWSRequest) -> None: ...
151
157
 
152
- AUTH_TYPE_MAPS: Dict[str, Type[BaseSigner]]
158
+ def resolve_auth_type(auth_trait: Iterable[str]) -> str: ...
159
+
160
+ AUTH_TYPE_MAPS: dict[str, type[BaseSigner]]
161
+ AUTH_TYPE_TO_SIGNATURE_VERSION: dict[str, str]
@@ -1,6 +1,12 @@
1
+ """
2
+ Type annotations for botocore.awsrequest module.
3
+
4
+ Copyright 2024 Vlad Emelianov
5
+ """
6
+
1
7
  from collections.abc import MutableMapping
2
8
  from logging import Logger
3
- from typing import IO, Any, Dict, Iterator, Mapping, Optional, Type, TypeVar, Union
9
+ from typing import IO, Any, Iterator, Mapping, TypeVar
4
10
 
5
11
  from botocore.compat import HTTPHeaders as HTTPHeaders
6
12
  from botocore.compat import HTTPResponse as HTTPResponse
@@ -20,15 +26,15 @@ class AWSHTTPResponse(HTTPResponse):
20
26
 
21
27
  class AWSConnection:
22
28
  def __init__(self, *args: Any, **kwargs: Any) -> None:
23
- self.response_class: Any
29
+ self.response_class: type[AWSHTTPResponse]
24
30
 
25
31
  def close(self) -> None: ...
26
32
  def request(
27
33
  self,
28
34
  method: str,
29
35
  url: str,
30
- body: Any = ...,
31
- headers: Optional[Mapping[str, Any]] = ...,
36
+ body: str | bytes | bytearray | IO[bytes] | IO[str] | None = ...,
37
+ headers: Mapping[str, Any] | None = ...,
32
38
  *args: Any,
33
39
  **kwargs: Any,
34
40
  ) -> HTTPConnection: ...
@@ -39,16 +45,16 @@ class AWSHTTPConnection(AWSConnection, HTTPConnection): ... # type: ignore [mis
39
45
  class AWSHTTPSConnection(AWSConnection, VerifiedHTTPSConnection): ... # type: ignore [misc]
40
46
 
41
47
  class AWSHTTPConnectionPool(HTTPConnectionPool):
42
- ConnectionCls: Type[AWSHTTPConnection] # type: ignore [misc,assignment]
48
+ ConnectionCls: type[AWSHTTPConnection] # type: ignore [misc,assignment]
43
49
 
44
50
  class AWSHTTPSConnectionPool(HTTPSConnectionPool):
45
- ConnectionCls: Type[AWSHTTPSConnection] # type: ignore [misc,assignment]
51
+ ConnectionCls: type[AWSHTTPSConnection] # type: ignore [misc,assignment]
46
52
 
47
53
  def prepare_request_dict(
48
54
  request_dict: Mapping[str, Any],
49
55
  endpoint_url: str,
50
- context: Optional[Any] = ...,
51
- user_agent: Optional[Any] = ...,
56
+ context: Mapping[str, Any] | None = ...,
57
+ user_agent: str | None = ...,
52
58
  ) -> None: ...
53
59
  def create_request_object(request_dict: Mapping[str, Any]) -> Any: ...
54
60
 
@@ -58,13 +64,13 @@ class AWSPreparedRequest:
58
64
  method: str,
59
65
  url: str,
60
66
  headers: HTTPHeaders,
61
- body: Union[str, bytes, bytearray, IO[bytes], IO[str], None],
67
+ body: str | bytes | bytearray | IO[bytes] | IO[str] | None,
62
68
  stream_output: bool,
63
69
  ) -> None:
64
70
  self.method: str
65
71
  self.url: str
66
72
  self.headers: HTTPHeaders
67
- self.body: Union[str, bytes, bytearray, IO[bytes], IO[str], None]
73
+ self.body: str | bytes | bytearray | IO[bytes] | IO[str] | None
68
74
  self.stream_output: bool
69
75
 
70
76
  def reset_stream(self) -> None: ...
@@ -72,22 +78,22 @@ class AWSPreparedRequest:
72
78
  class AWSRequest:
73
79
  def __init__(
74
80
  self,
75
- method: Optional[str] = ...,
76
- url: Optional[str] = ...,
77
- headers: Optional[Mapping[str, Any]] = ...,
78
- data: Optional[Any] = ...,
79
- params: Optional[Mapping[str, Any]] = ...,
80
- auth_path: Optional[str] = ...,
81
+ method: str | None = ...,
82
+ url: str | None = ...,
83
+ headers: Mapping[str, Any] | None = ...,
84
+ data: Any | None = ...,
85
+ params: Mapping[str, Any] | None = ...,
86
+ auth_path: str | None = ...,
81
87
  stream_output: bool = ...,
82
88
  ) -> None:
83
- self.method: Optional[str]
84
- self.url: Optional[str]
89
+ self.method: str | None
90
+ self.url: str | None
85
91
  self.headers: HTTPHeaders
86
- self.data: Optional[Any]
87
- self.params: Dict[str, Any]
88
- self.auth_path: Optional[str]
92
+ self.data: Any | None
93
+ self.params: dict[str, Any]
94
+ self.auth_path: str | None
89
95
  self.stream_output: bool
90
- self.context: Dict[str, Any]
96
+ self.context: dict[str, Any]
91
97
 
92
98
  def prepare(self) -> AWSPreparedRequest: ...
93
99
  @property
@@ -111,7 +117,7 @@ class AWSResponse:
111
117
  class _HeaderKey:
112
118
  def __init__(self, key: str) -> None: ...
113
119
  def __hash__(self) -> int: ...
114
- def __eq__(self, other: Any) -> bool: ...
120
+ def __eq__(self, other: object) -> bool: ...
115
121
 
116
122
  class HeadersDict(MutableMapping[str, str]):
117
123
  def __init__(self, *args: Any, **kwargs: Any) -> None: ...
botocore-stubs/client.pyi CHANGED
@@ -1,15 +1,23 @@
1
+ """
2
+ Type annotations for botocore.client module.
3
+
4
+ Copyright 2024 Vlad Emelianov
5
+ """
6
+
1
7
  from logging import Logger
2
- from typing import Any, Dict, List, Optional, Union
8
+ from typing import Any, Mapping
3
9
 
4
10
  from botocore.args import ClientArgsCreator as ClientArgsCreator
5
11
  from botocore.auth import AUTH_TYPE_MAPS as AUTH_TYPE_MAPS
6
12
  from botocore.awsrequest import prepare_request_dict as prepare_request_dict
7
13
  from botocore.config import Config as Config
14
+ from botocore.configprovider import ConfigValueStore
8
15
  from botocore.discovery import EndpointDiscoveryHandler as EndpointDiscoveryHandler
9
16
  from botocore.discovery import EndpointDiscoveryManager as EndpointDiscoveryManager
10
17
  from botocore.discovery import (
11
18
  block_endpoint_discovery_required_operations as block_endpoint_discovery_required_operations,
12
19
  )
20
+ from botocore.errorfactory import BaseClientExceptions, ClientExceptionsFactory
13
21
  from botocore.exceptions import ClientError as ClientError
14
22
  from botocore.exceptions import DataNotFoundError as DataNotFoundError
15
23
  from botocore.exceptions import (
@@ -24,6 +32,7 @@ from botocore.hooks import first_non_none_response as first_non_none_response
24
32
  from botocore.loaders import Loader
25
33
  from botocore.model import ServiceModel as ServiceModel
26
34
  from botocore.paginate import Paginator as Paginator
35
+ from botocore.parsers import ResponseParser, ResponseParserFactory
27
36
  from botocore.regions import BaseEndpointResolver, EndpointRulesetResolver
28
37
  from botocore.retries import adaptive as adaptive
29
38
  from botocore.retries import standard as standard
@@ -52,50 +61,50 @@ class ClientCreator:
52
61
  event_emitter: BaseEventHooks,
53
62
  retry_handler_factory: Any,
54
63
  retry_config_translator: Any,
55
- response_parser_factory: Optional[Any] = ...,
56
- exceptions_factory: Optional[Any] = ...,
57
- config_store: Optional[Any] = ...,
58
- user_agent_creator: Optional[UserAgentString] = ...,
64
+ response_parser_factory: ResponseParserFactory | None = ...,
65
+ exceptions_factory: ClientExceptionsFactory | None = ...,
66
+ config_store: ConfigValueStore | None = ...,
67
+ user_agent_creator: UserAgentString | None = ...,
59
68
  ) -> None: ...
60
69
  def create_client(
61
70
  self,
62
71
  service_name: str,
63
72
  region_name: str,
64
73
  is_secure: bool = ...,
65
- endpoint_url: Optional[str] = ...,
66
- verify: Optional[Union[str, bool]] = ...,
67
- credentials: Optional[Any] = ...,
68
- scoped_config: Optional[Any] = ...,
69
- api_version: Optional[str] = ...,
70
- client_config: Optional[Config] = ...,
71
- auth_token: Optional[str] = ...,
74
+ endpoint_url: str | None = ...,
75
+ verify: str | bool | None = ...,
76
+ credentials: Any | None = ...,
77
+ scoped_config: Mapping[str, Any] | None = ...,
78
+ api_version: str | None = ...,
79
+ client_config: Config | None = ...,
80
+ auth_token: str | None = ...,
72
81
  ) -> BaseClient: ...
73
- def create_client_class(self, service_name: str, api_version: Optional[Any] = ...) -> None: ...
82
+ def create_client_class(self, service_name: str, api_version: str | None = ...) -> None: ...
74
83
 
75
84
  class ClientEndpointBridge:
76
85
  DEFAULT_ENDPOINT: str = ...
77
86
  def __init__(
78
87
  self,
79
88
  endpoint_resolver: BaseEndpointResolver,
80
- scoped_config: Optional[Any] = ...,
81
- client_config: Optional[Any] = ...,
82
- default_endpoint: Optional[str] = ...,
83
- service_signing_name: Optional[str] = ...,
84
- config_store: Any = ...,
85
- service_signature_version: Optional[str] = ...,
89
+ scoped_config: Mapping[str, Any] | None = ...,
90
+ client_config: Config | None = ...,
91
+ default_endpoint: str | None = ...,
92
+ service_signing_name: str | None = ...,
93
+ config_store: ConfigValueStore | None = ...,
94
+ service_signature_version: str | None = ...,
86
95
  ) -> None:
87
96
  self.service_signing_name: str
88
97
  self.endpoint_resolver: BaseEndpointResolver
89
- self.scoped_config: Any
90
- self.client_config: Any
98
+ self.scoped_config: Mapping[str, Any]
99
+ self.client_config: Config
91
100
  self.default_endpoint: str
92
- self.config_store: Any
101
+ self.config_store: ConfigValueStore
93
102
 
94
103
  def resolve(
95
104
  self,
96
105
  service_name: str,
97
- region_name: Optional[str] = ...,
98
- endpoint_url: Optional[str] = ...,
106
+ region_name: str | None = ...,
107
+ endpoint_url: str | None = ...,
99
108
  is_secure: bool = ...,
100
109
  ) -> None: ...
101
110
  def resolver_uses_builtin_data(self) -> bool: ...
@@ -105,28 +114,28 @@ class BaseClient:
105
114
  self,
106
115
  serializer: Serializer,
107
116
  endpoint: str,
108
- response_parser: Any,
117
+ response_parser: ResponseParser,
109
118
  event_emitter: BaseEventHooks,
110
119
  request_signer: RequestSigner,
111
120
  service_model: ServiceModel,
112
121
  loader: Loader,
113
122
  client_config: Config,
114
123
  partition: str,
115
- exceptions_factory: Any,
116
- endpoint_ruleset_resolver: Optional[EndpointRulesetResolver] = ...,
117
- user_agent_creator: Optional[UserAgentString] = ...,
124
+ exceptions_factory: ClientExceptionsFactory,
125
+ endpoint_ruleset_resolver: EndpointRulesetResolver | None = ...,
126
+ user_agent_creator: UserAgentString | None = ...,
118
127
  ) -> None:
119
128
  self.meta: ClientMeta
120
129
  # FIXME: it hides `has no attribute` errors on Client type checking
121
130
  # def __getattr__(self, item: str) -> Any: ...
122
131
  def close(self) -> None: ...
123
- def get_paginator(self, operation_name: Any) -> Paginator: ...
132
+ def get_paginator(self, operation_name: str) -> Paginator[Any]: ...
124
133
  def can_paginate(self, operation_name: str) -> bool: ...
125
- def get_waiter(self, waiter_name: Any) -> Waiter: ...
134
+ def get_waiter(self, waiter_name: str) -> Waiter: ...
126
135
  @CachedProperty
127
- def waiter_names(self) -> List[str]: ...
136
+ def waiter_names(self) -> list[str]: ...
128
137
  @property
129
- def exceptions(self) -> Any: ...
138
+ def exceptions(self) -> BaseClientExceptions: ...
130
139
 
131
140
  class ClientMeta:
132
141
  def __init__(
@@ -135,7 +144,7 @@ class ClientMeta:
135
144
  client_config: Config,
136
145
  endpoint_url: str,
137
146
  service_model: ServiceModel,
138
- method_to_api_mapping: Dict[str, str],
147
+ method_to_api_mapping: Mapping[str, str],
139
148
  partition: str,
140
149
  ) -> None:
141
150
  self.events: BaseEventHooks
@@ -147,8 +156,8 @@ class ClientMeta:
147
156
  @property
148
157
  def endpoint_url(self) -> str: ...
149
158
  @property
150
- def config(self) -> Any: ...
159
+ def config(self) -> Config: ...
151
160
  @property
152
- def method_to_api_mapping(self) -> Dict[str, str]: ...
161
+ def method_to_api_mapping(self) -> dict[str, str]: ...
153
162
  @property
154
163
  def partition(self) -> str: ...
botocore-stubs/compat.pyi CHANGED
@@ -1,11 +1,20 @@
1
+ """
2
+ Type annotations for botocore.compat module.
3
+
4
+ Copyright 2024 Vlad Emelianov
5
+ """
6
+
7
+ import datetime
1
8
  from base64 import encodebytes as encodebytes
2
9
  from collections import OrderedDict as OrderedDict
3
10
  from email.utils import formatdate as formatdate
11
+ from hashlib import _Hash
4
12
  from http.client import HTTPMessage
5
13
  from http.client import HTTPResponse as HTTPResponse
14
+ from inspect import FullArgSpec
6
15
  from itertools import zip_longest as zip_longest
7
16
  from logging import Logger
8
- from typing import Any, Iterable, Mapping, Optional, Pattern, Tuple, Type, TypeVar
17
+ from typing import Any, Callable, Iterable, Mapping, Pattern, TypeVar
9
18
  from urllib.parse import parse_qs as parse_qs
10
19
  from urllib.parse import parse_qsl as parse_qsl
11
20
  from urllib.parse import quote as quote
@@ -26,37 +35,38 @@ _R = TypeVar("_R")
26
35
 
27
36
  class HTTPHeaders(HTTPMessage):
28
37
  @classmethod
29
- def from_dict(cls: Type[_R], d: Mapping[str, Any]) -> _R: ...
38
+ def from_dict(cls: type[_R], d: Mapping[str, Any]) -> _R: ...
30
39
  @classmethod
31
- def from_pairs(cls: Type[_R], pairs: Iterable[Tuple[str, Any]]) -> _R: ...
40
+ def from_pairs(cls: type[_R], pairs: Iterable[tuple[str, Any]]) -> _R: ...
32
41
 
33
42
  file_type: Any
43
+ zip: Any
34
44
  unquote_str = unquote_plus
35
45
 
36
46
  def set_socket_timeout(http_response: Any, timeout: Any) -> None: ...
37
- def accepts_kwargs(func: Any) -> Any: ...
38
- def ensure_unicode(s: Any, encoding: Optional[Any] = ..., errors: Optional[Any] = ...) -> Any: ...
39
- def ensure_bytes(s: Any, encoding: str = ..., errors: str = ...) -> Any: ...
47
+ def accepts_kwargs(func: Callable[..., Any]) -> FullArgSpec: ...
48
+ def ensure_unicode(s: str, encoding: str | None = ..., errors: Any | None = ...) -> str: ...
49
+ def ensure_bytes(s: str | bytes, encoding: str = ..., errors: str = ...) -> bytes: ...
40
50
 
41
51
  XMLParseError = ETree.ParseError
42
52
 
43
53
  def filter_ssl_warnings() -> None: ...
44
- def _from_dict(cls: Type[_R], d: Mapping[str, Any]) -> _R: ...
54
+ def _from_dict(cls: type[_R], d: Mapping[str, Any]) -> _R: ...
45
55
 
46
56
  from_dict: Any
47
57
 
48
- def _from_pairs(cls: Type[_R], d: Mapping[str, Any]) -> _R: ...
58
+ def _from_pairs(cls: type[_R], d: Mapping[str, Any]) -> _R: ...
49
59
 
50
60
  from_pairs: Any
51
61
 
52
- def copy_kwargs(kwargs: Any) -> Any: ...
53
- def total_seconds(delta: Any) -> Any: ...
62
+ def copy_kwargs(kwargs: _R) -> _R: ...
63
+ def total_seconds(delta: datetime.timedelta) -> float: ...
54
64
 
55
65
  MD5_AVAILABLE: bool
56
66
 
57
- def get_md5(*args: Any, **kwargs: Any) -> Any: ...
58
- def compat_shell_split(s: Any, platform: Optional[Any] = ...) -> Any: ...
59
- def get_tzinfo_options() -> Any: ...
67
+ def get_md5(*args: Any, **kwargs: Any) -> _Hash: ...
68
+ def compat_shell_split(s: str, platform: str | None = ...) -> list[str]: ...
69
+ def get_tzinfo_options() -> tuple[Any, ...]: ...
60
70
 
61
71
  HAS_CRT: bool
62
72
  disabled: str
@@ -1,8 +1,13 @@
1
+ """
2
+ Type annotations for botocore.compress module.
3
+
4
+ Copyright 2024 Vlad Emelianov
5
+ """
6
+
1
7
  import io
2
8
  from gzip import GzipFile as GzipFile
3
- from gzip import compress as gzip_compress
4
9
  from logging import Logger
5
- from typing import Any, Callable, Dict, Mapping
10
+ from typing import Any, Callable, Mapping
6
11
 
7
12
  from botocore.compat import urlencode as urlencode
8
13
  from botocore.config import Config
@@ -15,4 +20,4 @@ def maybe_compress_request(
15
20
  config: Config, request_dict: Mapping[str, Any], operation_model: OperationModel
16
21
  ) -> None: ...
17
22
 
18
- COMPRESSION_MAPPING: Dict[str, Callable[[io.BytesIO], io.BytesIO]] = ...
23
+ COMPRESSION_MAPPING: dict[str, Callable[[io.BytesIO], io.BytesIO]] = ...