8000 Updating mypy to 0.770 raises new errors · Issue #276 · graphql-python/graphql-core-legacy · GitHub
[go: up one dir, main page]

Skip to content

Updating mypy to 0.770 raises new errors #276

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
KingDarBoja opened this issue Mar 23, 2020 · 2 comments · Fixed by #278
Closed

Updating mypy to 0.770 raises new errors #276

KingDarBoja opened this issue Mar 23, 2020 · 2 comments · Fixed by #278

Comments

@KingDarBoja
Copy link
Contributor

If bumping mypy to 0.770, these erros will show up:

graphql\execution\executors\asyncio.py:56: error: Incompatible types in assignment (expression has type "AbstractEventLoop", variable has type "Optional[_UnixSelectorEventLoop]")
graphql\execution\executors\asyncio.py:67: error: Item "None" of "Optional[_UnixSelectorEventLoop]" has no attribute "run_until_complete"
graphql\utils\type_comparators.py:39: error: Argument 2 to "is_type_sub_type_of" has incompatible type "Union[GraphQLList, GraphQLObjectType, GraphQLScalarType, GraphQLInputObjectType, GraphQLInterfaceType]"; expected "GraphQLScalarType"
graphql\utils\type_comparators.py:39: error: Argument 3 to "is_type_sub_type_of" has incompatible type "Union[GraphQLList, GraphQLObjectType, GraphQLScalarType, GraphQLInputObjectType, GraphQLInterfaceType]"; expected "GraphQLScalarType"
graphql\utils\type_comparators.py:43: error: Argument 2 to "is_type_sub_type_of" has incompatible type "Union[GraphQLList, GraphQLObjectType, GraphQLScalarType, GraphQLInputObjectType, GraphQLInterfaceType]"; expected "GraphQLScalarType"
graphql\utils\type_comparators.py:57: error: Argument 1 to "is_possible_type" of "GraphQLSchema" has incompatible type "GraphQLScalarType"; expected "Union[GraphQLInterfaceType, GraphQLUnionType]"
graphql\utils\type_comparators.py:57: error: Argument 1 to "is_possible_type" of "GraphQLTypeMap" has incompatible type "GraphQLScalarType"; expected "Union[GraphQLInterfaceType, GraphQLUnionType]"
graphql\validation\rules\overlapping_fields_can_be_merged.py:708: error: Argument 1 to "do_types_conflict" has incompatible type "Union[GraphQLList, GraphQLObjectType, GraphQLScalarType, GraphQLInputObjectType, GraphQLInterfaceType]"; expected "GraphQLScalarType"
graphql\validation\rules\overlapping_fields_can_be_merged.py:708: error: Argument 2 to "do_types_conflict" has incompatible type "Union[GraphQLList, GraphQLObjectType, GraphQLScalarType, GraphQLInputObjectType, GraphQLInterfaceType]"; expected "GraphQLScalarType"
graphql\validation\rules\overlapping_fields_can_be_merged.py:713: error: Argument 1 to "do_types_conflict" has incompatible type "Union[GraphQLList, GraphQLObjectType, GraphQLScalarType, GraphQLInputObjectType, GraphQLInterfaceType]"; expected "GraphQLScalarType"
graphql\validation\rules\overlapping_fields_can_be_merged.py:713: error: Argument 2 to "do_types_conflict" has incompatible type "Union[GraphQLList, GraphQLObjectType, GraphQLScalarType, GraphQLInputObjectType, GraphQLInterfaceType]"; expected "GraphQLScalarType"

I will address these errors in a PR.

@KingDarBoja
Copy link
Contributor Author

@Cito Those errors seem to be cause by the use of type as function argument (__init__) which confuses mypy with the builtin type. Renaming to _type solves this.

@Cito
Copy link
Member
Cito commented Mar 23, 2020
73FC

In core 3 I'm using type_ in such cases, and a prefix like _type to denote an unused argument. I think it's ok to rename this and make v2 and v3 more similar in that regard.

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

Successfully merging a pull request may close this issue.

2 participants
0