8000 mypy does not recognize SearchableAPIResource · Issue #871 · stripe/stripe-python · GitHub
[go: up one dir, main page]

Skip to content

mypy does not recognize SearchableAPIResource #871

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

Closed
jtetrault opened this issue Sep 3, 2022 · 2 comments · Fixed by python/typeshed#8696
Closed

mypy does not recognize SearchableAPIResource #871

jtetrault opened this issue Sep 3, 2022 · 2 comments · Fixed by python/typeshed#8696
Assignees
Labels

Comments

@jtetrault
Copy link

Describe the bug

When using mypy to type check code, an error is thrown when trying to access the search method of any resource that subclasses SearchableAPIResource (for example, stripe.Price).

Furthermore, VSCode's built-in Python language features also fail to recognize search.

image
image

To Reproduce

In an Ubuntu shell, run the following commands:

virtualenv venv
. venv/bin/activate
pip install stripe types-stripe mypy
echo "import stripe" > test.py
echo >> test.py
echo "stripe.Price.search" >> test.py
mypy test.py

mypy will output the following error:

test.py:3: error: "Type[Price]" has no attribute "search"

Expected behavior

mypy should not throw an error here.

Code snippets

import stripe

stripe.Price.search

OS

Ubuntu 20.04.4 LTS on WSL2

Language version

3.9.12

Library version

stripe==4.1.0

API version

2022-08-01

Additional context

No response

@yejia-stripe
Copy link
Contributor

Hi @jtetrault, thanks for the report! This should be fixed with types-stripe v3.5.2. I believe VSCode's built-in Python language features also uses the typeshed stubs, but I'm not sure how those are updated.

Closing this out, but please feel free to re-open if this isn't resolved for you!

@jtetrault
Copy link
Author

Awesome, thank you!

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

Successfully merging a pull request may close this issue.

2 participants
0