Perhaps I don’t understand how the modules work typingand mypy, but there seems to be some kind of error happening here. If I do this (the example is adapted from the typing.Type docs section ):
import typing
class User(): pass
class BasicUser(User): pass
def make_new(u: typing.Type[User]) -> User:
return u()
x = make_new(BasicUser)
There is mypyno error . If I do this:
import typing
class A():
pass
MAPPING_X = {
A: 'a',
}
all_mappings = {}
all_mappings.update(MAPPING_X)
The error is also missing. However, this causes an error mypy:
import typing
class A():
pass
class B(A):
pass
MAPPING_X = {
A: 'a',
B: 'b',
}
all_mappings = {}
all_mappings.update(MAPPING_X)
Based on my understanding of the documentation, this error should not occur.