Git Product home page Git Product logo

Comments (4)

vemel avatar vemel commented on July 20, 2024

Hello! THank you for the report.

Looks like this output type is not compatible with the corresponding input type. I will take a look.

from mypy_boto3_builder.

vemel avatar vemel commented on July 20, 2024

Unfortunately, these types are incompatible. Does rewriting code as

new_rule: LifecycleRuleOutputTypeDef = {
    'ID': 'rule_name',
    'Expiration': {'Days': 1},
    'Filter': {'Prefix': 'prefix'},
    'NoncurrentVersionExpiration': {'NoncurrentDays': 1},
    'AbortIncompleteMultipartUpload': {'DaysAfterInitiation': 1},
    'Status': 'Enabled',
}

work for you?

from mypy_boto3_builder.

sodul avatar sodul commented on July 20, 2024

It does not seem to help. We are going to use # type: ignore for now:

rules: list[LifecycleRuleTypeDef]
rules = client.get_bucket_lifecycle_configuration( # type: ignore[assignment]
    Bucket='bucket_name'
)['Rules']

Not in the example above but the next line we have is:

config: BucketLifecycleConfigurationTypeDef = {'Rules': rules}

And mypy was failing with this error:

Incompatible types (expression has type "list[LifecycleRuleOutputTypeDef]", TypedDict item "Rules" has type "Sequence[LifecycleRuleTypeDef]")  [typeddict-item] (1,955:64)

from mypy_boto3_builder.

vemel avatar vemel commented on July 20, 2024

As far as I understand, before you used mypy-boto3-s3 1.34.65. There was a bug fixed in #244 that incompatible output shapes were used instead of separating output and input shapes in case of conflict.

For this particular shape input and output definitions are not compatible. So, type: ignore looks like the easiest solution.

pyright changes the way it compares TypedDicts in https://github.com/microsoft/pyright/releases/tag/1.1.333 release. So, since TypedDicts are invariant, output TypedDict cannot be assigned to an input TypedDict.

I will cross-check again tomorrow.

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.