From 66ab3de2bf9a87e384d75f735b43102bda534f93 Mon Sep 17 00:00:00 2001 From: Vlad Emelianov Date: Thu, 21 Nov 2024 03:42:04 +0300 Subject: [PATCH] Add missing s3 injected methods --- .../type_maps/service_stub_map/__init__.py | 1 + .../type_maps/service_stub_map/s3.py | 16 ++++++++++++++++ 2 files changed, 17 insertions(+) diff --git a/mypy_boto3_builder/type_maps/service_stub_map/__init__.py b/mypy_boto3_builder/type_maps/service_stub_map/__init__.py index dffbf694..46326296 100644 --- a/mypy_boto3_builder/type_maps/service_stub_map/__init__.py +++ b/mypy_boto3_builder/type_maps/service_stub_map/__init__.py @@ -42,6 +42,7 @@ CLIENT: s3.CLIENT_METHODS, "Bucket": s3.BUCKET_METHODS, "Object": s3.OBJECT_METHODS, + "ObjectSummary": s3.OBJECT_SUMMARY_METHODS, }, } diff --git a/mypy_boto3_builder/type_maps/service_stub_map/s3.py b/mypy_boto3_builder/type_maps/service_stub_map/s3.py index f74bac8b..29c11f0d 100644 --- a/mypy_boto3_builder/type_maps/service_stub_map/s3.py +++ b/mypy_boto3_builder/type_maps/service_stub_map/s3.py @@ -127,6 +127,20 @@ docstring="Upload a file-like object to S3.", ) +bucket_load_method = Method( + name="load", + arguments=[Argument.self()], + return_type=Type.none, + docstring="Calls s3.Client.list_buckets() to update the attributes of the Bucket resource.", +) + +object_summary_load_method = Method( + name="load", + arguments=[Argument.self()], + return_type=Type.none, + docstring="Calls s3.Client.head_object to update the attributes of the ObjectSummary resource.", +) + CLIENT_METHODS = ( copy_method, @@ -137,6 +151,7 @@ upload_fileobj_method, ) BUCKET_METHODS = ( + bucket_load_method, copy_method.copy().remove_argument("Bucket"), download_file_method.copy().remove_argument("Bucket"), download_fileobj_method.copy().remove_argument("Bucket"), @@ -150,3 +165,4 @@ upload_file_method.copy().remove_argument("Bucket", "Key"), upload_fileobj_method.copy().remove_argument("Bucket", "Key"), ) +OBJECT_SUMMARY_METHODS = (object_summary_load_method,)