I have a problem with python type annotations when a type is not declared at the point in file. Especially I have the problem when a class has a function that returns an instance of the class:
class Foo:
def clone(self) -> Foo:
return Foo()
results at runtime (not when checking with mypy) in an error:
NameError: name 'Foo' is not defined