Updating mypy to 0.770 raises new errors
KingDarBoja opened this issue · comments
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.
@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.
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.