(flag, value)
return members, not_covered
Extract all members from the value.
Extract all members from the value.
Extract all members from the value .
def _decompose(flag, value):
    """
    Extract all members from the value.
    """
    # _decompose is only called if the value is not named
    not_covered = value
    negative = value < 0
    members = []
    for member in flag:
        member_value = member.value
        if member_value and member_value & value == member_value:
            members.append(member)
            not_covered &= ~member_value
    if not negative:
        tmp = not_covered
        while tmp:
            flag_value = 2 ** _high_bit(tmp)
            if flag_value in flag._value2member_map_:
                members.append(flag._value2member_map_[flag_value])
                not_covered &= ~flag_value
            tmp &= ~flag_value
    if not members and value in flag._value2member_map_:
        members.append(flag._value2member_map_[value])
    members.sort(key=lambda m: m._value_, reverse=True)
    if len(members) > 1 and members[0].value == value:
        # we have the breakdown, don't need the value member itself
        members.pop(0)
    return members, not_covered
def _decompose ( flag , value ) : # _decompose is only called if the value is not named not_covered = value negative = value < 0 members = [ ] for member in flag : member_value = member . value if member_value and member_value & value == member_value : members . append ( member ) not_covered &= ~ member_value if not negative : tmp = not_covered while tmp : flag_value = 2 ** _high_bit ( tmp ) if flag_value in flag . _value2member_map_ : members . append ( flag . _value2member_map_ [ flag_value ] ) not_covered &= ~ flag_value tmp &= ~ flag_value if not members and value in flag . _value2member_map_ : members . append ( flag . _value2member_map_ [ value ] ) members . sort ( key = lambda m : m . _value_ , reverse = True ) if len ( members ) > 1 and members [ 0 ] . value == value : # we have the breakdown, don't need the value member itself members . pop ( 0 ) return members , not_covered