Git Product home page Git Product logo

Comments (5)

vemel avatar vemel commented on July 20, 2024

Unfortunately, right now there is no way to tell if the key in output shape is optional or not. I am still investigating it.

By the way, you are getting key error because method name is incorrect: list_object_versionslist_object_versions

from mypy_boto3_builder.

guilhem-dvr avatar guilhem-dvr commented on July 20, 2024

By the way, you are getting key error because method name is incorrect: list_object_versionslist_object_versions

corrected, but this doesn't change my issue: the key is optional from the S3 response but the type checker misses that.

from mypy_boto3_builder.

vemel avatar vemel commented on July 20, 2024

I will try to fix it. If you have time you can also take a look at botocore shapes and help me figure out how optional/required keys are marked for output shapes.

One solution would be to use the same key totality as for input shapes. But it is also not an ideal solution, because almost all keys are optional in input shapes.

Another solution would be to somehow figure out which keys are required in output shapes, but I still have no idea how to do it.

from mypy_boto3_builder.

vemel avatar vemel commented on July 20, 2024

If I use the same rules as for input shapes, this is what I get :

ListObjectVersionsOutputTypeDef = TypedDict(
    "ListObjectVersionsOutputTypeDef",
    {
        "ResponseMetadata": ResponseMetadataTypeDef,
        "IsTruncated": NotRequired[bool],
        "KeyMarker": NotRequired[str],
        "VersionIdMarker": NotRequired[str],
        "NextKeyMarker": NotRequired[str],
        "NextVersionIdMarker": NotRequired[str],
        "Versions": NotRequired[List[ObjectVersionTypeDef]],
        "DeleteMarkers": NotRequired[List[DeleteMarkerEntryTypeDef]],
        "Name": NotRequired[str],
        "Prefix": NotRequired[str],
        "Delimiter": NotRequired[str],
        "MaxKeys": NotRequired[int],
        "CommonPrefixes": NotRequired[List[CommonPrefixTypeDef]],
        "EncodingType": NotRequired[Literal["url"]],
        "RequestCharged": NotRequired[Literal["requester"]],
    },
)

As you see, all keys are marked as not required. I do not think that this is a proper solution.

from mypy_boto3_builder.

vemel avatar vemel commented on July 20, 2024

The issue has finally been fixed in mypy_boto3_builder 7.24.0 release. I have also released mypy-boto3-s3 1.34.91 with the fix included. Please update and let me know if it works as it should.

from mypy_boto3_builder.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.