Autocomplete/suggestions for generated methods on a decorated class.

I see that PyCharm can offer suggestions/autocomplete for generated class members, like the signature of the __init__ function generated by the dataclass decorator, but I'm not sure how to get that for methods/functions generated by my own decorators.


My decorator takes a class and appends functions and attributes to it based on an external mapping to create a facade over config-based icon lookups.  The generated code works fine, and even has a simple __doc__ string including attribute declarations for the generated property attributes, however PyCharm does not offer suggestions, and shows warnings for usage of generated methods/attributes.

Decorated class:

class Icons:



Icon Registry

    globe (int): Icon ID for the 'globe' icon.


dir(Icons) (excluding default object elements)

[..., '_destroy', '_get_globe', '_init', 'globe']


The current code draft including the decorator


Removing the return type hint from the decorator function gets rid of the warnings, but only because PyCharm has no idea what the type is and assumes Any