strycore / fakegir

fakegir: Bring autocompletion to your PyGObject code
GNU General Public License v3.0
89 stars 16 forks source link

Support static methods #27

Closed realh closed 5 years ago

realh commented 5 years ago

Some GObject classes have static methods, represented in .gir files with <function> tags, but these were missing from fakegir's output. I've changed extract_methods() to recognise <function> tags within <class>.

I'm not sure whether <function> and <method> tags are used exclusively for static and instance methods exclusively, so I've used the presence (or not) of a 'self' parameter to decide whether to add the @staticmethod annotation. It would probably be OK to check only the first parameter instead of using any() as I have done.