python - Tell PyCharm code generated fields of class -
as minimal case have class example works in abstract capacity range of other classes.
class example(object):     def __init__(self, **kwargs):         key, value in kwargs.items():             setattr(self, key, value)              class test(example):     def __init__(self, foo='bar'):         super(test, self).__init__(foo=foo) in real case, example more things.
is there way on test inform pycharm test have 1 field test.foo , better, let know foo expected string?
to clear, consider delegating setting of fields example test not possible.
the closest i've gotten @ivar of epydoc, can't work
as others have mentioned, can't. however, can tell pycharm accept missing attributes @dynamicattrs:
class example(object):    """    @dynamicattrs    """    def __init__(self, **kwargs):       key, value in kwargs.items():          setattr(self, key, value) update: if python3.5 option, see this question using type hints dynamic attributes.
Comments
Post a Comment