fakegir icon indicating copy to clipboard operation
fakegir copied to clipboard

Doesn't parse "records"

Open realh opened this issue 6 years ago • 4 comments

fakegir seems to miss out "record" items, which is what gi calls structs. structs may have methods. They're quite important in some libraries, so fakegir not supporting them is a big hindrance.

realh avatar Feb 03 '19 12:02 realh

Does PR #29 fix that issue?

kastixx avatar Feb 05 '19 08:02 kastixx

Yes, but only partially, because it doesn't support fields. I'm not sure how best to deal with them. If output classes had a constructor that set those fields with type annotations, would jedi etc be able to introspect them?

realh avatar Feb 05 '19 15:02 realh

Probably it won't. It's not possible to assign a docstring to class attribute, here's an explanation: https://stackoverflow.com/questions/3051241/how-to-document-class-attributes-in-python .

A possible work-around would be adding an empty property for each field:

class Foo:
    @property
    def field_name(self):
        """Docstring for field_name"""
        pass

kastixx avatar Feb 07 '19 14:02 kastixx

That sounds like a good idea. Shall I give it a try and open a new PR?

realh avatar Feb 12 '19 16:02 realh