You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
refactor(typing): enable boto3 implicit type annotations (aws-powertools#4692)
* chore(deps-dev): enable mypy-boto3 implicit type annotations
Add boto3-stubs and botocore-stubs to enable implicit type annotations
with mypy_boto3_* packages. See
https://youtype.github.io/boto3_stubs_docs/mypy_boto3_s3/usage/#implicit-type-annotations
This enables removing very few unneeded explicit type annotations and
helps detect some new errors automatically.
No need to do
boto3_config = boto3_config or Config()
before passing the boto3_config to the boto3_session client or resource
methods, as None is an accepted value.
Refactor the aws_lambda_powertools.utilities.parameters.base.BaseProvider
class: move the instantiation of clients in _build_boto3_client and
_build_boto3_resource_client to the subclasses and the user_agent method
calls to the constructor. Keeping correct typing information with the
original implementation was going to be too complex and hopefully the
refactor even made the code tidier.
Keep imports consistent: use boto3.session.Session, mypy_boto3_*.client,
mypy_boto3_*.service_resource and mypy_boto3_*.type_defs
as documented at
https://boto3.amazonaws.com/v1/documentation/api/latest/reference/core/session.html
and
https://youtype.github.io/boto3_stubs_docs/mypy_boto3_s3/usage/#explicit-type-annotations
* Ignore mypy arg-type error with ConditionalCheckFailedException
* Reassign to boto3_session instead of inlined expression
0 commit comments