-
Notifications
You must be signed in to change notification settings - Fork 828
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
PyCharm warning: Expected type 'ObjectType', got 'Type[Query]' instead #1100
Comments
Hello @denizdogan What PyCharm version do you own? |
@KingDarBoja I use PyCharm 2019.2.4 Professional Edition |
I can confirm such behaviour on my PyCharm too; More info:
|
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Don't automatically close this please |
@denizdogan Looks like the issue got solved but will be released on Graphene v3-alpha versions instead of v2, just saying, the final word is under Graphql-Python Team 😄 |
Still present on 2020.1, any news? |
I can confirm that this is still present in 2020.1 professional. It would be helpful it it gets solved. |
Came across this looking for the same PyCharm warning, but in a different situation. I'm not a user of this repo, so I won't take the time to locate the code and PR the simple fix for it. TL/DR: Whenever you see PyCharm complain with
that's a possible type hinting misunderstanding. See this for more information. In summary: # Wrong
class Schema:
def __init__(self, query: MyClass):
# Right
from typing import Type
class Schema:
def __init__(self, query: Type[MyClass]): |
Thanks for the hint. I changed the type specification and PyCharm does not anymore complain about a type mismatch. Thanks formigone. |
@AndHam89 Where did you change the type specification? In the source of graphene? It's still complaining for me |
@tobiasfeil You need to change your type specification in you Python code as formigone pointed out. If you refer to the type of a class you need to use the syntax Type[MyClass] if you have a parameter which is of type MyClass. |
Fixing a Type Warning that resolves graphql-python#1100 for PyCharm IDE users.
New issue for type hinting is #1454. Will start addressing this soon. |
Related to #814 which was automatically closed due to staleness.
Any ideas?
The text was updated successfully, but these errors were encountered: