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

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -