class Quality(object):
REGULAR = 'regular'
CONSCRIPT = 'conscript'
ELITE = 'elite'
HEROIC = 'heroic'
PARAGON = 'paragon'
@classmethod
def to_form(cls):
return filter(lambda x: not x[0].startswith('__'), cls.__dict__.items())
In [1]: import inspect
In [2]: def get_user_attributes(cls):
...: boring = dir(type('dummy', (object,), {}))
...: return [item for item in inspect.getmembers(cls)
...: if item[0] not in boring]
...:
In [3]: class C(object):
...: pass
...:
In [4]: get_user_attributes(C)
Out[4]: []
In [5]: class C(object):
...: first = 1
...: second = 2
...:
In [6]: get_user_attributes(C)
Out[6]: [('first', 1), ('second', 2)]
In [7]: