Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not compatible with mypy #20

Open
shadycuz opened this issue Mar 8, 2021 · 2 comments
Open

Not compatible with mypy #20

shadycuz opened this issue Mar 8, 2021 · 2 comments

Comments

@shadycuz
Copy link

shadycuz commented Mar 8, 2021

Not sure the level of effort to get this to work with mypy. I have many examples but this one makes the most sense:

Making API call with filter:

response = client.describe_instance_type_offerings(
        LocationType=location,
        Filters=[{"Name": "instance-type", "Values": [instance_type]}],
    )

mypy error:

error: List item 0 has incompatible type "Dict[str, Sequence[str]]"; expected "Filter"  [list-item]

I have tried many ways to fix it:

filter: botostubs.EC2.Filter = {
        "Name": "instance-type",
        "Values": [instance_type]
    }

but nothing works. Thats because the variable filter is supposed to be an instance of the class Filter. Where really with boto3 a filter is a Dict[str, Any].

I haven't even looked at what it would take to implement but I might give this a look if this is something people are interested in.

@jeshan
Copy link
Owner

jeshan commented Mar 9, 2021

OK I'm taking a look now. Since I have zero experience with mypy, can you show me how I would quickly test a fix? (Dumb it down for me)

@jeshan
Copy link
Owner

jeshan commented Mar 9, 2021

... is supposed to be an instance of the class Filter

Also, tell me how did mypy come to know about the Filter type? It's Dict based on the data from boto3 so there must be something else going on here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants