Skip to content

Commit 90e73d0

Browse files
author
Cavalcante Damascena
committed
merging develop
2 parents 8592194 + 6c7dc6f commit 90e73d0

31 files changed

+65
-100
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
"""Logging utility
22
"""
3+
34
from .logger import Logger
45

56
__all__ = ["Logger"]

aws_lambda_powertools/logging/logger.py

+2-4
Original file line numberDiff line numberDiff line change
@@ -345,8 +345,7 @@ def inject_lambda_context(
345345
log_event: Optional[bool] = None,
346346
correlation_id_path: Optional[str] = None,
347347
clear_state: Optional[bool] = False,
348-
) -> AnyCallableT:
349-
...
348+
) -> AnyCallableT: ...
350349

351350
@overload
352351
def inject_lambda_context(
@@ -355,8 +354,7 @@ def inject_lambda_context(
355354
log_event: Optional[bool] = None,
356355
correlation_id_path: Optional[str] = None,
357356
clear_state: Optional[bool] = False,
358-
) -> Callable[[AnyCallableT], AnyCallableT]:
359-
...
357+
) -> Callable[[AnyCallableT], AnyCallableT]: ...
360358

361359
def inject_lambda_context(
362360
self,

aws_lambda_powertools/metrics/__init__.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
"""CloudWatch Embedded Metric Format utility
22
"""
3+
34
from aws_lambda_powertools.metrics.base import MetricResolution, MetricUnit, single_metric
45
from aws_lambda_powertools.metrics.exceptions import (
56
MetricResolutionError,
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
""" Utilities to enhance middlewares """
2+
23
from .factory import lambda_handler_decorator
34

45
__all__ = ["lambda_handler_decorator"]

aws_lambda_powertools/shared/functions.py

+3-6
Original file line numberDiff line numberDiff line change
@@ -57,18 +57,15 @@ def resolve_max_age(env: str, choice: Optional[int]) -> int:
5757

5858

5959
@overload
60-
def resolve_env_var_choice(env: Optional[str], choice: float) -> float:
61-
...
60+
def resolve_env_var_choice(env: Optional[str], choice: float) -> float: ...
6261

6362

6463
@overload
65-
def resolve_env_var_choice(env: Optional[str], choice: str) -> str:
66-
...
64+
def resolve_env_var_choice(env: Optional[str], choice: str) -> str: ...
6765

6866

6967
@overload
70-
def resolve_env_var_choice(env: Optional[str], choice: Optional[str]) -> str:
71-
...
68+
def resolve_env_var_choice(env: Optional[str], choice: Optional[str]) -> str: ...
7269

7370

7471
def resolve_env_var_choice(

aws_lambda_powertools/tracing/__init__.py

-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
"""Tracing utility
22
"""
33

4-
54
from .extensions import aiohttp_trace_config
65
from .tracer import Tracer
76

aws_lambda_powertools/tracing/tracer.py

+2-4
Original file line numberDiff line numberDiff line change
@@ -345,17 +345,15 @@ def decorate(event, context, **kwargs):
345345

346346
# see #465
347347
@overload
348-
def capture_method(self, method: "AnyCallableT") -> "AnyCallableT":
349-
... # pragma: no cover
348+
def capture_method(self, method: "AnyCallableT") -> "AnyCallableT": ... # pragma: no cover
350349

351350
@overload
352351
def capture_method(
353352
self,
354353
method: None = None,
355354
capture_response: Optional[bool] = None,
356355
capture_error: Optional[bool] = None,
357-
) -> Callable[["AnyCallableT"], "AnyCallableT"]:
358-
... # pragma: no cover
356+
) -> Callable[["AnyCallableT"], "AnyCallableT"]: ... # pragma: no cover
359357

360358
def capture_method(
361359
self,

aws_lambda_powertools/utilities/batch/base.py

+7-4
Original file line numberDiff line numberDiff line change
@@ -339,12 +339,15 @@ def _collect_dynamodb_failures(self):
339339
return failures
340340

341341
@overload
342-
def _to_batch_type(self, record: dict, event_type: EventType, model: "BatchTypeModels") -> "BatchTypeModels":
343-
... # pragma: no cover
342+
def _to_batch_type(
343+
self,
344+
record: dict,
345+
event_type: EventType,
346+
model: "BatchTypeModels",
347+
) -> "BatchTypeModels": ... # pragma: no cover
344348

345349
@overload
346-
def _to_batch_type(self, record: dict, event_type: EventType) -> EventSourceDataClassTypes:
347-
... # pragma: no cover
350+
def _to_batch_type(self, record: dict, event_type: EventType) -> EventSourceDataClassTypes: ... # pragma: no cover
348351

349352
def _to_batch_type(self, record: dict, event_type: EventType, model: Optional["BatchTypeModels"] = None):
350353
if model is not None:

aws_lambda_powertools/utilities/batch/exceptions.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
"""
22
Batch processing exceptions
33
"""
4+
45
from __future__ import annotations
56

67
import traceback

aws_lambda_powertools/utilities/data_classes/common.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ def get_multi_value_query_string_values(
193193
self,
194194
name: str,
195195
default_values: Optional[List[str]] = None,
196-
) ->List[str]:
196+
) -> List[str]:
197197
"""Get multi-value query string parameter values by name
198198
199199
Parameters

aws_lambda_powertools/utilities/data_masking/base.py

+4-8
Original file line numberDiff line numberDiff line change
@@ -85,20 +85,16 @@ def decrypt(
8585
)
8686

8787
@overload
88-
def erase(self, data, fields: None) -> str:
89-
...
88+
def erase(self, data, fields: None) -> str: ...
9089

9190
@overload
92-
def erase(self, data: list, fields: list[str]) -> list[str]:
93-
...
91+
def erase(self, data: list, fields: list[str]) -> list[str]: ...
9492

9593
@overload
96-
def erase(self, data: tuple, fields: list[str]) -> tuple[str]:
97-
...
94+
def erase(self, data: tuple, fields: list[str]) -> tuple[str]: ...
9895

9996
@overload
100-
def erase(self, data: dict, fields: list[str]) -> dict:
101-
...
97+
def erase(self, data: dict, fields: list[str]) -> dict: ...
10298

10399
def erase(self, data: Sequence | Mapping, fields: list[str] | None = None) -> str | list[str] | tuple[str] | dict:
104100
return self._apply_action(data=data, fields=fields, action=self.provider.erase)

aws_lambda_powertools/utilities/data_masking/provider/kms/aws_encryption_sdk.py

-1
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,6 @@ def decrypt(self, data: str, provider_options: dict | None = None, **encryption_
105105

106106

107107
class KMSKeyProvider:
108-
109108
"""
110109
The KMSKeyProvider is responsible for assembling an AWS Key Management Service (KMS)
111110
client, a caching mechanism, and a keyring for secure key management and data encryption.

aws_lambda_powertools/utilities/idempotency/exceptions.py

-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
Idempotency errors
33
"""
44

5-
65
from typing import Optional, Union
76

87
from aws_lambda_powertools.utilities.idempotency.persistence.datarecord import DataRecord

aws_lambda_powertools/utilities/idempotency/idempotency.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
"""
22
Primary interface for idempotent Lambda functions utility
33
"""
4+
45
import functools
56
import logging
67
import os

aws_lambda_powertools/utilities/idempotency/serialization/base.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
"""
22
Serialization for supporting idempotency
33
"""
4+
45
from abc import ABC, abstractmethod
56
from typing import Any, Dict
67

aws_lambda_powertools/utilities/parameters/appconfig.py

-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
AWS App Config configuration retrieval and caching utility
33
"""
44

5-
65
import os
76
from typing import TYPE_CHECKING, Any, Dict, Optional, Union
87

aws_lambda_powertools/utilities/parameters/base.py

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
"""
22
Base for Parameter providers
33
"""
4+
45
from __future__ import annotations
56

67
import base64
@@ -372,8 +373,7 @@ def transform_value(
372373
transform: TransformOptions,
373374
raise_on_transform_error: bool = False,
374375
key: str = "",
375-
) -> Dict[str, Any]:
376-
...
376+
) -> Dict[str, Any]: ...
377377

378378

379379
@overload
@@ -382,8 +382,7 @@ def transform_value(
382382
transform: TransformOptions,
383383
raise_on_transform_error: bool = False,
384384
key: str = "",
385-
) -> Optional[Union[str, bytes, Dict[str, Any]]]:
386-
...
385+
) -> Optional[Union[str, bytes, Dict[str, Any]]]: ...
387386

388387

389388
def transform_value(

aws_lambda_powertools/utilities/parameters/dynamodb.py

-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
Amazon DynamoDB parameter retrieval and caching utility
33
"""
44

5-
65
from typing import TYPE_CHECKING, Dict, Optional
76

87
import boto3

aws_lambda_powertools/utilities/parameters/secrets.py

-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
AWS Secrets Manager parameter retrieval and caching utility
33
"""
44

5-
65
import os
76
from typing import TYPE_CHECKING, Any, Dict, Optional, Union
87

aws_lambda_powertools/utilities/parameters/ssm.py

+13-24
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
"""
22
AWS SSM Parameter retrieval and caching utility
33
"""
4+
45
from __future__ import annotations
56

67
import os
@@ -553,8 +554,7 @@ def get_parameter(
553554
force_fetch: bool = False,
554555
max_age: Optional[int] = None,
555556
**sdk_options,
556-
) -> str:
557-
...
557+
) -> str: ...
558558

559559

560560
@overload
@@ -565,8 +565,7 @@ def get_parameter(
565565
force_fetch: bool = False,
566566
max_age: Optional[int] = None,
567567
**sdk_options,
568-
) -> dict:
569-
...
568+
) -> dict: ...
570569

571570

572571
@overload
@@ -577,8 +576,7 @@ def get_parameter(
577576
force_fetch: bool = False,
578577
max_age: Optional[int] = None,
579578
**sdk_options,
580-
) -> Union[str, dict, bytes]:
581-
...
579+
) -> Union[str, dict, bytes]: ...
582580

583581

584582
@overload
@@ -589,8 +587,7 @@ def get_parameter(
589587
force_fetch: bool = False,
590588
max_age: Optional[int] = None,
591589
**sdk_options,
592-
) -> bytes:
593-
...
590+
) -> bytes: ...
594591

595592

596593
def get_parameter(
@@ -683,8 +680,7 @@ def get_parameters(
683680
max_age: Optional[int] = None,
684681
raise_on_transform_error: bool = False,
685682
**sdk_options,
686-
) -> Dict[str, str]:
687-
...
683+
) -> Dict[str, str]: ...
688684

689685

690686
@overload
@@ -697,8 +693,7 @@ def get_parameters(
697693
max_age: Optional[int] = None,
698694
raise_on_transform_error: bool = False,
699695
**sdk_options,
700-
) -> Dict[str, dict]:
701-
...
696+
) -> Dict[str, dict]: ...
702697

703698

704699
@overload
@@ -711,8 +706,7 @@ def get_parameters(
711706
max_age: Optional[int] = None,
712707
raise_on_transform_error: bool = False,
713708
**sdk_options,
714-
) -> Dict[str, bytes]:
715-
...
709+
) -> Dict[str, bytes]: ...
716710

717711

718712
@overload
@@ -725,8 +719,7 @@ def get_parameters(
725719
max_age: Optional[int] = None,
726720
raise_on_transform_error: bool = False,
727721
**sdk_options,
728-
) -> Union[Dict[str, bytes], Dict[str, dict], Dict[str, str]]:
729-
...
722+
) -> Union[Dict[str, bytes], Dict[str, dict], Dict[str, str]]: ...
730723

731724

732725
def get_parameters(
@@ -825,8 +818,7 @@ def get_parameters_by_name(
825818
decrypt: Optional[bool] = None,
826819
max_age: Optional[int] = None,
827820
raise_on_error: bool = True,
828-
) -> Dict[str, str]:
829-
...
821+
) -> Dict[str, str]: ...
830822

831823

832824
@overload
@@ -836,8 +828,7 @@ def get_parameters_by_name(
836828
decrypt: Optional[bool] = None,
837829
max_age: Optional[int] = None,
838830
raise_on_error: bool = True,
839-
) -> Dict[str, bytes]:
840-
...
831+
) -> Dict[str, bytes]: ...
841832

842833

843834
@overload
@@ -847,8 +838,7 @@ def get_parameters_by_name(
847838
decrypt: Optional[bool] = None,
848839
max_age: Optional[int] = None,
849840
raise_on_error: bool = True,
850-
) -> Dict[str, Dict[str, Any]]:
851-
...
841+
) -> Dict[str, Dict[str, Any]]: ...
852842

853843

854844
@overload
@@ -858,8 +848,7 @@ def get_parameters_by_name(
858848
decrypt: Optional[bool] = None,
859849
max_age: Optional[int] = None,
860850
raise_on_error: bool = True,
861-
) -> Union[Dict[str, str], Dict[str, dict]]:
862-
...
851+
) -> Union[Dict[str, str], Dict[str, dict]]: ...
863852

864853

865854
def get_parameters_by_name(

aws_lambda_powertools/utilities/parser/__init__.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
"""Advanced event_parser utility
22
"""
3+
34
from . import envelopes
45
from .envelopes import BaseEnvelope
56
from .parser import event_parser, parse

aws_lambda_powertools/utilities/parser/parser.py

+2-4
Original file line numberDiff line numberDiff line change
@@ -104,13 +104,11 @@ def handler(event: Order, context: LambdaContext):
104104

105105

106106
@overload
107-
def parse(event: Dict[str, Any], model: Type[Model]) -> Model:
108-
... # pragma: no cover
107+
def parse(event: Dict[str, Any], model: Type[Model]) -> Model: ... # pragma: no cover
109108

110109

111110
@overload
112-
def parse(event: Dict[str, Any], model: Type[Model], envelope: Type[Envelope]) -> Model:
113-
... # pragma: no cover
111+
def parse(event: Dict[str, Any], model: Type[Model], envelope: Type[Envelope]) -> Model: ... # pragma: no cover
114112

115113

116114
def parse(event: Dict[str, Any], model: Type[Model], envelope: Optional[Type[Envelope]] = None):

aws_lambda_powertools/utilities/serialization.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Standalone functions to serialize/deserialize common data structures"""
2+
23
import base64
34
import json
45
from typing import Any, Callable

0 commit comments

Comments
 (0)