(cls, value)
return pseudo_member
Create a composite member iff value contains only members.
Create a composite member iff value contains only members.
Create a composite member iff value contains only members .
def _create_pseudo_member_(cls, value):
        """
        Create a composite member iff value contains only members.
        """
        pseudo_member = cls._value2member_map_.get(value, None)
        if pseudo_member is None:
            need_to_create = [value]
            # get unaccounted for bits
            _, extra_flags = _decompose(cls, value)
            # timer = 10
            while extra_flags:
                # timer -= 1
                bit = _high_bit(extra_flags)
                flag_value = 2 ** bit
                if (flag_value not in cls._value2member_map_ and
                        flag_value not in need_to_create
                        ):
                    need_to_create.append(flag_value)
                if extra_flags == -flag_value:
                    extra_flags = 0
                else:
                    extra_flags ^= flag_value
            for value in reversed(need_to_create):
                # construct singleton pseudo-members
                pseudo_member = int.__new__(cls, value)
                pseudo_member._name_ = None
                pseudo_member._value_ = value
                # use setdefault in case another thread already created a composite
                # with this value
                pseudo_member = cls._value2member_map_.setdefault(value, pseudo_member)
        return pseudo_member
def _create_pseudo_member_ ( cls , value ) : pseudo_member = cls . _value2member_map_ . get ( value , None ) if pseudo_member is None : need_to_create = [ value ] # get unaccounted for bits _ , extra_flags = _decompose ( cls , value ) # timer = 10 while extra_flags : # timer -= 1 bit = _high_bit ( extra_flags ) flag_value = 2 ** bit if ( flag_value not in cls . _value2member_map_ and flag_value not in need_to_create ) : need_to_create . append ( flag_value ) if extra_flags == - flag_value : extra_flags = 0 else : extra_flags ^= flag_value for value in reversed ( need_to_create ) : # construct singleton pseudo-members pseudo_member = int . __new__ ( cls , value ) pseudo_member . _name_ = None pseudo_member . _value_ = value # use setdefault in case another thread already created a composite # with this value pseudo_member = cls . _value2member_map_ . setdefault ( value , pseudo_member ) return pseudo_member