def get_public_attributes(cls, as_list=True):
    """
    Return class attributes that are neither private nor magic.

    :param cls: class
    :param as_list: [True] set to False to return generator
    :return: only public attributes of class
    """
    attrs = (a for a in dir(cls) if not a.startswith('_'))
    if as_list:
        return list(attrs)
    return attrs
Return class attributes that are neither private nor magic.

    :param cls: class
    :param as_list: [True] set to False to return generator
    :return: only public attributes of class