fastai/fastcore

Support patched methods in `py2pyi`

jph00 opened this issue · 0 comments

jph00 commented

Currently py2pyi leaves @patch methods as separate functions outside the method. This isn't compatible with systems like pylance, which don't know about @patch.

Therefore, it would be helpful if py2pyi moved @patch-decorated methods inside the class, in situations where the class is defined in the same file as the decorator. E.g, this input...

class A: ...
@patch
def f(self:A): ...

...would be changed to this in the .pyi:

class A: ...
    def f(self:A): ...