How do I add type hints to functions using boto3 without using external libraries like mypy_boto3? This is especially confusing with the boto3.client which returns the object of the type botocore.client.s3 which is unavailable to import.
Example functions to annotate in script below would be get_client and list_objects:
import boto3
def get_client():
return boto3.client('s3')
def list_objects(client):
response = client.list_objects(Bucket="a", Prefix="b")
for content in response.get('Contents', []):
yield content.get('Key')
client = get_client()
for f in list_objects(client):
print(f)
I am getting started in typing module and had a look at different options available in python 3.6+ , but am unclear on what would be the type hints for runtime types like the object returned by boto3.client in this case.