(type_, onlyValues=False)
Useful for getting members from types (e.g. in enums)

    >>> [_ for _ in getPublicTypeMembers(OS, True)]
    ['Linux', 'Windows']
Useful for getting members from types (e.g. in enums)
Useful for getting members from types ( e . g . in enums )
def getPublicTypeMembers(type_, onlyValues=False):
    """
    Useful for getting members from types (e.g. in enums)

    >>> [_ for _ in getPublicTypeMembers(OS, True)]
    ['Linux', 'Windows']
    """

    for name, value in inspect.getmembers(type_):
        if not name.startswith('__'):
            if not onlyValues:
                yield (name, value)
            else:
                yield value
def getPublicTypeMembers ( type_ , onlyValues = False ) : for name , value in inspect . getmembers ( type_ ) : if not name . startswith ( '__' ) : if not onlyValues : yield ( name , value ) else : yield value