botocore-stubs 1.34.66__py3-none-any.whl → 1.35.99__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.66.dist-info → botocore_stubs-1.35.99.dist-info}/METADATA +39 -20
  68. botocore_stubs-1.35.99.dist-info/RECORD +73 -0
  69. {botocore_stubs-1.34.66.dist-info → botocore_stubs-1.35.99.dist-info}/WHEEL +2 -1
  70. botocore_stubs-1.35.99.dist-info/top_level.txt +1 -0
  71. botocore_stubs-1.34.66.dist-info/RECORD +0 -72
  72. {botocore_stubs-1.34.66.dist-info → botocore_stubs-1.35.99.dist-info}/LICENSE +0 -0
@@ -1,23 +1,32 @@
1
+ """
2
+ Type annotations for botocore.paginate module.
3
+
4
+ Copyright 2024 Vlad Emelianov
5
+ """
6
+
1
7
  from logging import Logger
2
- from typing import Any, Dict, Iterator
8
+ from typing import Any, Generic, Iterator, TypeVar
3
9
 
4
10
  from botocore.exceptions import PaginationError as PaginationError
11
+ from botocore.model import OperationModel
5
12
  from botocore.utils import merge_dicts as merge_dicts
6
13
  from botocore.utils import set_value_from_jmespath as set_value_from_jmespath
14
+ from jmespath.parser import ParsedResult
7
15
 
16
+ _R = TypeVar("_R")
8
17
  log: Logger = ...
9
18
 
10
19
  class TokenEncoder:
11
- def encode(self, token: Dict[str, Any]) -> str: ...
20
+ def encode(self, token: dict[str, Any]) -> str: ...
12
21
 
13
22
  class TokenDecoder:
14
- def decode(self, token: str) -> Dict[str, Any]: ...
23
+ def decode(self, token: str) -> dict[str, Any]: ...
15
24
 
16
25
  class PaginatorModel:
17
26
  def __init__(self, paginator_config: Any) -> None: ...
18
27
  def get_paginator(self, operation_name: str) -> Any: ...
19
28
 
20
- class PageIterator:
29
+ class PageIterator(Generic[_R]):
21
30
  def __init__(
22
31
  self,
23
32
  method: Any,
@@ -26,34 +35,39 @@ class PageIterator:
26
35
  more_results: Any,
27
36
  result_keys: Any,
28
37
  non_aggregate_keys: Any,
29
- limit_key: Any,
38
+ limit_key: str,
30
39
  max_items: int,
31
40
  starting_token: Any,
32
41
  page_size: int,
33
- op_kwargs: Any,
42
+ op_kwargs: dict[str, Any],
34
43
  ) -> None: ...
35
44
  @property
36
- def result_keys(self) -> Any: ...
45
+ def result_keys(self) -> list[ParsedResult] | None: ...
37
46
  @property
38
- def resume_token(self) -> Any: ...
47
+ def resume_token(self) -> dict[str, Any] | None: ...
39
48
  @resume_token.setter
40
- def resume_token(self, value: Any) -> None: ...
49
+ def resume_token(self, value: dict[str, Any] | None) -> None: ...
41
50
  @property
42
- def non_aggregate_part(self) -> Any: ...
43
- def __iter__(self) -> Iterator[Any]: ...
44
- def search(self, expression: Any) -> Iterator[Any]: ...
45
- def result_key_iters(self) -> Any: ...
46
- def build_full_result(self) -> Any: ...
47
-
48
- class Paginator:
49
- PAGE_ITERATOR_CLS: Any = ...
50
- def __init__(self, method: Any, pagination_config: Any, model: Any) -> None: ...
51
+ def non_aggregate_part(self) -> dict[str, Any]: ...
52
+ def __iter__(self) -> Iterator[_R]: ...
53
+ def search(self, expression: str) -> Iterator[Any]: ...
54
+ def result_key_iters(self) -> list[ResultKeyIterator[_R]]: ...
55
+ def build_full_result(self) -> dict[str, Any]: ...
56
+
57
+ class Paginator(Generic[_R]):
58
+ PAGE_ITERATOR_CLS: type[PageIterator[Any]] = ...
59
+ def __init__(
60
+ self,
61
+ method: str,
62
+ pagination_config: dict[str, Any],
63
+ model: OperationModel,
64
+ ) -> None: ...
51
65
  @property
52
- def result_keys(self) -> Any: ...
53
- def paginate(self, **kwargs: Any) -> Any: ...
66
+ def result_keys(self) -> list[ParsedResult] | None: ...
67
+ def paginate(self, **kwargs: Any) -> PageIterator[_R]: ...
54
68
 
55
- class ResultKeyIterator:
56
- def __init__(self, pages_iterator: Any, result_key: Any) -> None:
57
- self.result_key: Any = ...
69
+ class ResultKeyIterator(Generic[_R]):
70
+ def __init__(self, pages_iterator: PageIterator[_R], result_key: ParsedResult) -> None:
71
+ self.result_key: ParsedResult = ...
58
72
 
59
- def __iter__(self) -> Any: ...
73
+ def __iter__(self) -> Iterator[_R]: ...
@@ -1,5 +1,11 @@
1
+ """
2
+ Type annotations for botocore.parsers module.
3
+
4
+ Copyright 2024 Vlad Emelianov
5
+ """
6
+
1
7
  from logging import Logger
2
- from typing import Any, Callable, Dict, Mapping, Optional, Type
8
+ from typing import Any, Callable, Mapping
3
9
 
4
10
  from botocore.compat import XMLParseError as XMLParseError
5
11
  from botocore.eventstream import EventStream as EventStream
@@ -24,19 +30,19 @@ class ResponseParserError(Exception): ...
24
30
 
25
31
  class ResponseParser:
26
32
  DEFAULT_ENCODING: str = ...
27
- EVENT_STREAM_PARSER_CLS: Optional[Type[ResponseParser]] = ...
33
+ EVENT_STREAM_PARSER_CLS: type[ResponseParser] | None = ...
28
34
  def __init__(
29
35
  self,
30
- timestamp_parser: Optional[Callable[[str], Any]] = ...,
31
- blob_parser: Optional[Callable[[str], Any]] = ...,
36
+ timestamp_parser: Callable[[str], Any] | None = ...,
37
+ blob_parser: Callable[[str], Any] | None = ...,
32
38
  ) -> None: ...
33
39
  def parse(self, response: Mapping[str, Any], shape: Shape) -> Any: ...
34
40
 
35
41
  class BaseXMLResponseParser(ResponseParser):
36
42
  def __init__(
37
43
  self,
38
- timestamp_parser: Optional[Callable[[str], Any]] = ...,
39
- blob_parser: Optional[Callable[[str], Any]] = ...,
44
+ timestamp_parser: Callable[[str], Any] | None = ...,
45
+ blob_parser: Callable[[str], Any] | None = ...,
40
46
  ) -> None: ...
41
47
 
42
48
  class QueryParser(BaseXMLResponseParser): ...
@@ -50,4 +56,4 @@ class BaseRestParser(ResponseParser): ...
50
56
  class RestJSONParser(BaseRestParser, BaseJSONParser): ...
51
57
  class RestXMLParser(BaseRestParser, BaseXMLResponseParser): ...
52
58
 
53
- PROTOCOL_PARSERS: Dict[str, ResponseParser]
59
+ PROTOCOL_PARSERS: dict[str, ResponseParser]
@@ -1,6 +1,13 @@
1
+ """
2
+ Type annotations for botocore.regions module.
3
+
4
+ Copyright 2024 Vlad Emelianov
5
+ """
6
+
7
+ from collections.abc import Iterable
1
8
  from enum import Enum
2
9
  from logging import Logger
3
- from typing import Any, Dict, List, Mapping, Optional, Tuple
10
+ from typing import Any, Mapping
4
11
 
5
12
  from botocore.auth import AUTH_TYPE_MAPS as AUTH_TYPE_MAPS
6
13
  from botocore.compat import HAS_CRT as HAS_CRT
@@ -13,54 +20,56 @@ from botocore.model import OperationModel, ServiceModel
13
20
 
14
21
  LOG: Logger = ...
15
22
  DEFAULT_URI_TEMPLATE: str
16
- DEFAULT_SERVICE_DATA: Dict[str, Dict[str, Any]]
23
+ DEFAULT_SERVICE_DATA: dict[str, dict[str, Any]]
17
24
 
18
25
  class BaseEndpointResolver:
19
- def construct_endpoint(self, service_name: str, region_name: Optional[str] = ...) -> None: ...
20
- def get_available_partitions(self) -> List[str]: ...
26
+ def construct_endpoint(self, service_name: str, region_name: str | None = ...) -> None: ...
27
+ def get_available_partitions(self) -> list[str]: ...
21
28
  def get_available_endpoints(
22
29
  self,
23
30
  service_name: str,
24
31
  partition_name: str = ...,
25
32
  allow_non_regional: bool = ...,
26
- ) -> List[str]: ...
33
+ ) -> list[str]: ...
27
34
 
28
35
  class EndpointResolver(BaseEndpointResolver):
29
36
  def __init__(self, endpoint_data: Mapping[str, Any], uses_builtin_data: bool = ...) -> None: ...
30
37
  def get_service_endpoints_data(self, service_name: str, partition_name: str = ...) -> Any: ...
31
- def get_available_partitions(self) -> List[str]: ...
38
+ def get_available_partitions(self) -> list[str]: ...
32
39
  def get_available_endpoints(
33
40
  self,
34
41
  service_name: str,
35
42
  partition_name: str = ...,
36
43
  allow_non_regional: bool = ...,
37
- endpoint_variant_tags: Any = ...,
38
- ) -> List[str]: ...
44
+ endpoint_variant_tags: Iterable[str] | None = ...,
45
+ ) -> list[str]: ...
39
46
  def get_partition_dns_suffix(
40
- self, partition_name: str, endpoint_variant_tags: Any = ...
47
+ self, partition_name: str, endpoint_variant_tags: Iterable[str] | None = ...
41
48
  ) -> str: ...
42
49
  def construct_endpoint( # type: ignore [override]
43
50
  self,
44
51
  service_name: str,
45
- region_name: Optional[str] = ...,
46
- partition_name: Optional[str] = ...,
52
+ region_name: str | None = ...,
53
+ partition_name: str | None = ...,
47
54
  use_dualstack_endpoint: bool = ...,
48
55
  use_fips_endpoint: bool = ...,
49
- ) -> Optional[Dict[str, Any]]: ...
56
+ ) -> dict[str, Any] | None: ...
50
57
  def get_partition_for_region(self, region_name: str) -> str: ...
51
58
 
52
59
  class EndpointResolverBuiltins(Enum):
53
- AWS_REGION: str
54
- AWS_USE_FIPS: str
55
- AWS_USE_DUALSTACK: str
56
- AWS_STS_USE_GLOBAL_ENDPOINT: str
57
- AWS_S3_USE_GLOBAL_ENDPOINT: str
58
- AWS_S3_ACCELERATE: str
59
- AWS_S3_FORCE_PATH_STYLE: str
60
- AWS_S3_USE_ARN_REGION: str
61
- AWS_S3CONTROL_USE_ARN_REGION: str
62
- AWS_S3_DISABLE_MRAP: str
63
- SDK_ENDPOINT: str
60
+ AWS_REGION = "AWS::Region"
61
+ AWS_USE_FIPS = "AWS::UseFIPS"
62
+ AWS_USE_DUALSTACK = "AWS::UseDualStack"
63
+ AWS_STS_USE_GLOBAL_ENDPOINT = "AWS::STS::UseGlobalEndpoint"
64
+ AWS_S3_USE_GLOBAL_ENDPOINT = "AWS::S3::UseGlobalEndpoint"
65
+ AWS_S3_ACCELERATE = "AWS::S3::Accelerate"
66
+ AWS_S3_FORCE_PATH_STYLE = "AWS::S3::ForcePathStyle"
67
+ AWS_S3_USE_ARN_REGION = "AWS::S3::UseArnRegion"
68
+ AWS_S3CONTROL_USE_ARN_REGION = "AWS::S3Control::UseArnRegion"
69
+ AWS_S3_DISABLE_MRAP = "AWS::S3::DisableMultiRegionAccessPoints"
70
+ SDK_ENDPOINT = "SDK::Endpoint"
71
+ ACCOUNT_ID = "AWS::Auth::AccountId"
72
+ ACCOUNT_ID_ENDPOINT_MODE = "AWS::Auth::AccountIdEndpointMode"
64
73
 
65
74
  class EndpointRulesetResolver:
66
75
  def __init__(
@@ -69,20 +78,20 @@ class EndpointRulesetResolver:
69
78
  partition_data: Mapping[str, Any],
70
79
  service_model: ServiceModel,
71
80
  builtins: EndpointResolverBuiltins,
72
- client_context: Any,
81
+ client_context: Mapping[str, Any],
73
82
  event_emitter: BaseEventHooks,
74
83
  use_ssl: bool = ...,
75
- requested_auth_scheme: Optional[str] = ...,
84
+ requested_auth_scheme: str | None = ...,
76
85
  ) -> None: ...
77
86
  def construct_endpoint(
78
87
  self,
79
88
  operation_model: OperationModel,
80
- call_args: Optional[Mapping[str, Any]],
81
- request_context: Any,
89
+ call_args: Mapping[str, Any] | None,
90
+ request_context: Mapping[str, Any],
82
91
  ) -> RuleSetEndpoint: ...
83
92
  def auth_schemes_to_signing_ctx(
84
- self, auth_schemes: List[Mapping[str, Any]]
85
- ) -> Tuple[str, Dict[str, Any]]: ...
93
+ self, auth_schemes: list[Mapping[str, Any]]
94
+ ) -> tuple[str, dict[str, Any]]: ...
86
95
  def ruleset_error_to_botocore_exception(
87
96
  self, ruleset_exception: Exception, params: Mapping[str, Any]
88
97
  ) -> BotoCoreError: ...
@@ -1,6 +1,12 @@
1
+ """
2
+ Type annotations for botocore.response module.
3
+
4
+ Copyright 2024 Vlad Emelianov
5
+ """
6
+
1
7
  import logging
2
8
  from io import IOBase
3
- from typing import IO, Any, Iterator, List, Optional, Tuple
9
+ from typing import IO, Any, Iterator
4
10
 
5
11
  import requests
6
12
  from botocore.model import OperationModel
@@ -11,9 +17,9 @@ class StreamingBody(IOBase):
11
17
  def __init__(self, raw_stream: IO[bytes], content_length: int) -> None: ...
12
18
  def set_socket_timeout(self, timeout: float) -> None: ...
13
19
  def readable(self) -> bool: ...
14
- def read(self, amt: Optional[int] = ...) -> bytes: ...
20
+ def read(self, amt: int | None = ...) -> bytes: ...
15
21
  # FIXME: Signature of "readlines" incompatible with supertype "IOBase"
16
- def readlines(self) -> List[bytes]: ... # type: ignore [override]
22
+ def readlines(self) -> list[bytes]: ... # type: ignore [override]
17
23
  def __iter__(self) -> Iterator[bytes]: ...
18
24
  def iter_lines(self, chunk_size: int = ..., keepends: bool = ...) -> Iterator[bytes]: ...
19
25
  def iter_chunks(self, chunk_size: int = ...) -> Iterator[bytes]: ...
@@ -23,4 +29,4 @@ class StreamingBody(IOBase):
23
29
 
24
30
  def get_response(
25
31
  operation_model: OperationModel, http_response: requests.Response
26
- ) -> Tuple[requests.Response, Any]: ...
32
+ ) -> tuple[requests.Response, Any]: ...
@@ -1,3 +1,9 @@
1
+ """
2
+ Type annotations for botocore.retries.adaptive module.
3
+
4
+ Copyright 2024 Vlad Emelianov
5
+ """
6
+
1
7
  from logging import Logger
2
8
  from typing import Any
3
9
 
@@ -8,7 +14,7 @@ from botocore.retries import throttling as throttling
8
14
 
9
15
  logger: Logger = ...
10
16
 
11
- def register_retry_handler(client: BaseClient) -> "ClientRateLimiter": ...
17
+ def register_retry_handler(client: BaseClient) -> ClientRateLimiter: ...
12
18
 
13
19
  class ClientRateLimiter:
14
20
  def __init__(
@@ -1,7 +1,13 @@
1
- from typing import Any
1
+ """
2
+ Type annotations for botocore.retries.base module.
3
+
4
+ Copyright 2024 Vlad Emelianov
5
+ """
6
+
7
+ from botocore.retries.standard import RetryContext
2
8
 
3
9
  class BaseRetryBackoff:
4
- def delay_amount(self, context: Any) -> float: ...
10
+ def delay_amount(self, context: RetryContext) -> float: ...
5
11
 
6
12
  class BaseRetryableChecker:
7
- def is_retryable(self, context: Any) -> bool: ...
13
+ def is_retryable(self, context: RetryContext) -> bool: ...
@@ -1,20 +1,24 @@
1
- from typing import Any
1
+ """
2
+ Type annotations for botocore.retries.bucket module.
3
+
4
+ Copyright 2024 Vlad Emelianov
5
+ """
2
6
 
3
7
  from botocore.exceptions import CapacityNotAvailableError as CapacityNotAvailableError
4
8
 
5
9
  class Clock:
6
10
  def __init__(self) -> None: ...
7
- def sleep(self, amount: Any) -> None: ...
8
- def current_time(self) -> Any: ...
11
+ def sleep(self, amount: float) -> None: ...
12
+ def current_time(self) -> float: ...
9
13
 
10
14
  class TokenBucket:
11
- def __init__(self, max_rate: Any, clock: Any, min_rate: Any = ...) -> None: ...
15
+ def __init__(self, max_rate: float, clock: Clock, min_rate: float = ...) -> None: ...
12
16
  @property
13
- def max_rate(self) -> Any: ...
17
+ def max_rate(self) -> float: ...
14
18
  @max_rate.setter
15
- def max_rate(self, value: Any) -> None: ...
19
+ def max_rate(self, value: float) -> None: ...
16
20
  @property
17
- def max_capacity(self) -> Any: ...
21
+ def max_capacity(self) -> int: ...
18
22
  @property
19
- def available_capacity(self) -> Any: ...
20
- def acquire(self, amount: int = ..., block: bool = ...) -> Any: ...
23
+ def available_capacity(self) -> int: ...
24
+ def acquire(self, amount: int = ..., block: bool = ...) -> bool: ...
@@ -1,9 +1,15 @@
1
- from typing import Any, Optional
1
+ """
2
+ Type annotations for botocore.retries.quota module.
3
+
4
+ Copyright 2024 Vlad Emelianov
5
+ """
6
+
7
+ from threading import Lock
2
8
 
3
9
  class RetryQuota:
4
10
  INITIAL_CAPACITY: int = ...
5
- def __init__(self, initial_capacity: Any = ..., lock: Optional[Any] = ...) -> None: ...
6
- def acquire(self, capacity_amount: Any) -> Any: ...
7
- def release(self, capacity_amount: Any) -> None: ...
11
+ def __init__(self, initial_capacity: int = ..., lock: Lock | None = ...) -> None: ...
12
+ def acquire(self, capacity_amount: int) -> bool: ...
13
+ def release(self, capacity_amount: int) -> None: ...
8
14
  @property
9
- def available_capacity(self) -> Any: ...
15
+ def available_capacity(self) -> int: ...
@@ -1,12 +1,19 @@
1
+ """
2
+ Type annotations for botocore.retries.special module.
3
+
4
+ Copyright 2024 Vlad Emelianov
5
+ """
6
+
1
7
  from logging import Logger
2
8
  from typing import Any
3
9
 
4
10
  from botocore.retries.base import BaseRetryableChecker as BaseRetryableChecker
11
+ from botocore.retries.standard import RetryContext
5
12
 
6
13
  logger: Logger = ...
7
14
 
8
15
  class RetryIDPCommunicationError(BaseRetryableChecker):
9
- def is_retryable(self, context: Any) -> Any: ...
16
+ def is_retryable(self, context: RetryContext) -> Any: ...
10
17
 
11
18
  class RetryDDBChecksumError(BaseRetryableChecker):
12
- def is_retryable(self, context: Any) -> Any: ...
19
+ def is_retryable(self, context: RetryContext) -> Any: ...
@@ -1,5 +1,11 @@
1
+ """
2
+ Type annotations for botocore.retries.standard module.
3
+
4
+ Copyright 2024 Vlad Emelianov
5
+ """
6
+
1
7
  from logging import Logger
2
- from typing import Any, Callable, Optional, Sequence, Type
8
+ from typing import Any, Callable, Sequence
3
9
 
4
10
  from botocore.client import BaseClient
5
11
  from botocore.exceptions import BotoCoreError
@@ -27,30 +33,30 @@ class RetryHandler:
27
33
  retry_event_adapter: RetryEventAdapter,
28
34
  retry_quota: RetryQuota,
29
35
  ) -> None: ...
30
- def needs_retry(self, **kwargs: Any) -> Optional[float]: ...
36
+ def needs_retry(self, **kwargs: Any) -> float | None: ...
31
37
 
32
38
  class RetryEventAdapter:
33
39
  def create_retry_context(self, **kwargs: Any) -> Any: ...
34
- def adapt_retry_response_from_context(self, context: Any) -> None: ...
40
+ def adapt_retry_response_from_context(self, context: RetryContext) -> None: ...
35
41
 
36
42
  class RetryContext:
37
43
  def __init__(
38
44
  self,
39
45
  attempt_number: int,
40
- operation_model: Optional[OperationModel] = ...,
46
+ operation_model: OperationModel | None = ...,
41
47
  parsed_response: Any = ...,
42
48
  http_response: Any = ...,
43
- caught_exception: Optional[Exception] = ...,
49
+ caught_exception: Exception | None = ...,
44
50
  request_context: Any = ...,
45
51
  ) -> None:
46
52
  self.attempt_number: int = ...
47
- self.operation_model: Optional[OperationModel] = ...
53
+ self.operation_model: OperationModel | None = ...
48
54
  self.parsed_response: Any = ...
49
55
  self.http_response: Any = ...
50
- self.caught_exception: Optional[Exception] = ...
56
+ self.caught_exception: Exception | None = ...
51
57
  self.request_context: Any = ...
52
58
 
53
- def get_error_code(self) -> Optional[int]: ...
59
+ def get_error_code(self) -> int | None: ...
54
60
  def add_retry_metadata(self, **kwargs: Any) -> None: ...
55
61
  def get_retry_metadata(self) -> Any: ...
56
62
 
@@ -58,38 +64,38 @@ class RetryPolicy:
58
64
  def __init__(
59
65
  self, retry_checker: BaseRetryableChecker, retry_backoff: BaseRetryBackoff
60
66
  ) -> None: ...
61
- def should_retry(self, context: Any) -> Any: ...
67
+ def should_retry(self, context: RetryContext) -> Any: ...
62
68
  def compute_retry_delay(self, context: Any) -> float: ...
63
69
 
64
70
  class ExponentialBackoff(BaseRetryBackoff):
65
71
  def __init__(self, max_backoff: int = ..., random: Callable[[], float] = ...) -> None: ...
66
- def delay_amount(self, context: Any) -> float: ...
72
+ def delay_amount(self, context: RetryContext) -> float: ...
67
73
 
68
74
  class MaxAttemptsChecker(BaseRetryableChecker):
69
75
  def __init__(self, max_attempts: int) -> None: ...
70
- def is_retryable(self, context: Any) -> bool: ...
76
+ def is_retryable(self, context: RetryContext) -> bool: ...
71
77
 
72
78
  class TransientRetryableChecker(BaseRetryableChecker):
73
79
  def __init__(
74
80
  self,
75
- transient_error_codes: Optional[Sequence[str]] = ...,
76
- transient_status_codes: Optional[Sequence[int]] = ...,
77
- transient_exception_cls: Optional[Sequence[Type[BotoCoreError]]] = ...,
81
+ transient_error_codes: Sequence[str] | None = ...,
82
+ transient_status_codes: Sequence[int] | None = ...,
83
+ transient_exception_cls: Sequence[type[BotoCoreError]] | None = ...,
78
84
  ) -> None: ...
79
- def is_retryable(self, context: Any) -> bool: ...
85
+ def is_retryable(self, context: RetryContext) -> bool: ...
80
86
 
81
87
  class ThrottledRetryableChecker(BaseRetryableChecker):
82
- def __init__(self, throttled_error_codes: Optional[Sequence[str]] = ...) -> None: ...
83
- def is_retryable(self, context: Any) -> bool: ...
88
+ def __init__(self, throttled_error_codes: Sequence[str] | None = ...) -> None: ...
89
+ def is_retryable(self, context: RetryContext) -> bool: ...
84
90
 
85
91
  class ModeledRetryableChecker(BaseRetryableChecker):
86
92
  def __init__(self) -> None: ...
87
- def is_retryable(self, context: Any) -> Any: ...
93
+ def is_retryable(self, context: RetryContext) -> Any: ...
88
94
 
89
95
  class ModeledRetryErrorDetector:
90
96
  TRANSIENT_ERROR: str = ...
91
97
  THROTTLING_ERROR: str = ...
92
- def detect_error_type(self, context: Any) -> Any: ...
98
+ def detect_error_type(self, context: RetryContext) -> Any: ...
93
99
 
94
100
  class ThrottlingErrorDetector:
95
101
  def __init__(self, retry_event_adapter: Any) -> None: ...
@@ -97,13 +103,15 @@ class ThrottlingErrorDetector:
97
103
 
98
104
  class StandardRetryConditions(BaseRetryableChecker):
99
105
  def __init__(self, max_attempts: Any = ...) -> None: ...
100
- def is_retryable(self, context: Any) -> Any: ...
106
+ def is_retryable(self, context: RetryContext) -> Any: ...
101
107
 
102
108
  class OrRetryChecker(BaseRetryableChecker):
103
109
  def __init__(self, checkers: Any) -> None: ...
104
- def is_retryable(self, context: Any) -> Any: ...
110
+ def is_retryable(self, context: RetryContext) -> Any: ...
105
111
 
106
112
  class RetryQuotaChecker:
107
- def __init__(self, quota: Any) -> None: ...
108
- def acquire_retry_quota(self, context: Any) -> bool: ...
109
- def release_retry_quota(self, context: Any, http_response: Any, **kwargs: Any) -> None: ...
113
+ def __init__(self, quota: Any) -> None: ... # noqa: F811
114
+ def acquire_retry_quota(self, context: RetryContext) -> bool: ...
115
+ def release_retry_quota(
116
+ self, context: RetryContext, http_response: Any, **kwargs: Any
117
+ ) -> None: ...
@@ -1,3 +1,9 @@
1
+ """
2
+ Type annotations for botocore.retries.throttling module.
3
+
4
+ Copyright 2024 Vlad Emelianov
5
+ """
6
+
1
7
  from typing import Any, NamedTuple
2
8
 
3
9
  class CubicParams(NamedTuple):
@@ -1,5 +1,11 @@
1
+ """
2
+ Type annotations for botocore.retryhandler module.
3
+
4
+ Copyright 2024 Vlad Emelianov
5
+ """
6
+
1
7
  from logging import Logger
2
- from typing import Any, Callable, Dict, Iterable, List, Mapping, Optional, Type
8
+ from typing import Any, Callable, Iterable, Mapping
3
9
 
4
10
  from botocore.config import Config
5
11
  from botocore.exceptions import BotoCoreError
@@ -11,18 +17,18 @@ from botocore.exceptions import ReadTimeoutError as ReadTimeoutError
11
17
 
12
18
  logger: Logger = ...
13
19
 
14
- EXCEPTION_MAP: Dict[str, List[Type[BotoCoreError]]]
20
+ EXCEPTION_MAP: dict[str, list[type[BotoCoreError]]]
15
21
 
16
22
  def delay_exponential(base: float, growth_factor: float, attempts: int) -> float: ...
17
23
  def create_exponential_delay_function(
18
24
  base: float, growth_factor: float
19
25
  ) -> Callable[[int], float]: ...
20
- def create_retry_handler(config: Config, operation_name: Optional[str] = ...) -> RetryHandler: ...
26
+ def create_retry_handler(config: Config, operation_name: str | None = ...) -> RetryHandler: ...
21
27
  def create_retry_action_from_config(
22
- config: Config, operation_name: Optional[str] = ...
28
+ config: Config, operation_name: str | None = ...
23
29
  ) -> Callable[[int], float]: ...
24
30
  def create_checker_from_retry_config(
25
- config: Config, operation_name: Optional[str] = ...
31
+ config: Config, operation_name: str | None = ...
26
32
  ) -> MaxAttemptsDecorator: ...
27
33
 
28
34
  class RetryHandler:
@@ -41,7 +47,7 @@ class MaxAttemptsDecorator(BaseChecker):
41
47
  self,
42
48
  checker: BaseChecker,
43
49
  max_attempts: int,
44
- retryable_exceptions: Optional[Iterable[Type[Exception]]] = ...,
50
+ retryable_exceptions: Iterable[type[Exception]] | None = ...,
45
51
  ) -> None: ...
46
52
  # FIXME: Signature of "__call__" incompatible with supertype "BaseChecker"
47
53
  def __call__( # type: ignore [override]
@@ -1,4 +1,10 @@
1
- from typing import Any, Dict, Mapping, Pattern, Type
1
+ """
2
+ Type annotations for botocore.serialize module.
3
+
4
+ Copyright 2024 Vlad Emelianov
5
+ """
6
+
7
+ from typing import Any, Mapping, Pattern
2
8
 
3
9
  from botocore.compat import formatdate as formatdate
4
10
  from botocore.model import OperationModel
@@ -15,17 +21,17 @@ def create_serializer(protocol_name: str, include_validation: bool = ...) -> Any
15
21
 
16
22
  class Serializer:
17
23
  DEFAULT_METHOD: str = ...
18
- MAP_TYPE: Type[Dict[str, Any]] = ...
24
+ MAP_TYPE: type[dict[str, Any]] = ...
19
25
  DEFAULT_ENCODING: str = ...
20
26
  def serialize_to_request(
21
27
  self, parameters: Mapping[str, Any], operation_model: OperationModel
22
- ) -> Dict[str, Any]: ...
28
+ ) -> dict[str, Any]: ...
23
29
 
24
30
  class QuerySerializer(Serializer):
25
31
  TIMESTAMP_FORMAT: str = ...
26
32
  def serialize_to_request(
27
33
  self, parameters: Mapping[str, Any], operation_model: OperationModel
28
- ) -> Dict[str, Any]: ...
34
+ ) -> dict[str, Any]: ...
29
35
 
30
36
  class EC2Serializer(QuerySerializer): ...
31
37
 
@@ -33,19 +39,19 @@ class JSONSerializer(Serializer):
33
39
  TIMESTAMP_FORMAT: str = ...
34
40
  def serialize_to_request(
35
41
  self, parameters: Mapping[str, Any], operation_model: OperationModel
36
- ) -> Dict[str, Any]: ...
42
+ ) -> dict[str, Any]: ...
37
43
 
38
44
  class BaseRestSerializer(Serializer):
39
45
  QUERY_STRING_TIMESTAMP_FORMAT: str = ...
40
46
  HEADER_TIMESTAMP_FORMAT: str = ...
41
- KNOWN_LOCATIONS: Any = ...
47
+ KNOWN_LOCATIONS: list[str] = ...
42
48
  def serialize_to_request(
43
49
  self, parameters: Mapping[str, Any], operation_model: OperationModel
44
- ) -> Dict[str, Any]: ...
50
+ ) -> dict[str, Any]: ...
45
51
 
46
52
  class RestJSONSerializer(BaseRestSerializer, JSONSerializer): ...
47
53
 
48
54
  class RestXMLSerializer(BaseRestSerializer):
49
55
  TIMESTAMP_FORMAT: str = ...
50
56
 
51
- SERIALIZERS: Dict[str, Serializer]
57
+ SERIALIZERS: dict[str, Serializer]