def __add__(self, other):
        ''' Add: self + other '''
        if isinstance(other, str):
            return str(self) + other

        elif isinstance(other, _PaletteEntry):
            # Make a copy, so codes don't pile up after each addition
            # Render initial values once as string and place as first code:
            newcodes = self._codes + other._codes
            #~ log.debug('codes for new instance: %r', newcodes)  # noisy
            attr = _PaletteEntry(self.parent, self.name,
                                 ';'.join(newcodes))
            same_category = self.parent is other.parent
            #~ log.debug('palette entries match: %s', same_category)  # noisy

            if not same_category:  # different, use end instead of default
                attr.default = ANSI_RESET

            return attr
        else:
            raise TypeError(f'Addition to type {type(other)} not supported.')
def __add__ ( self , other ) : if isinstance ( other , str ) : return str ( self ) + other elif isinstance ( other , _PaletteEntry ) : newcodes = self . _codes + other . _codes attr = _PaletteEntry ( self . parent , self . name , ';' . join ( newcodes ) ) same_category = self . parent is other . parent if not same_category : attr . default = ANSI_RESET return attr else : raise TypeError ( f'Addition to type {type(other)} not supported.' )
Add: self + other