Invalid Type sniffing with Fluent Design
paulresdat opened this issue · 0 comments
paulresdat commented
Hello,
I think I ran across a bug working with this extension. For the most part it works well but it doesn't work with the fluent design it appears.
class IMyClass(metaclass=ABCMeta):
def __subclasshook__(cls, subclass):
return True
@abstractmethod
def do_something(self) -> IMyClass:
raise NotImplementedError
@abstractmethod
def do_something_else(self) -> str:
raise NotImplemented
class MyClass(IMyClass):
def __init__(self):
pass
def do_something(self) -> IMyClass:
return self
def do_something_else(self) -> str:
return 'hi'
mClass = MyClass()
x: str = ""
x = mClass.do_something().do_something_else()
print(x)
MyPy will say there is an error with the return value of do_something
in regards to x and doesn't appear to take into consideration the chained method.
Let me know if I have this in error, but I think it's an actual bug.
UPDATE
You can close this issue. I jumped the gun too soon and found the issue with the variable name itself which I was overwriting. Your extension appears to work as it should given the example above. That is my fault. Have a good one.