(self, link, provider, link_type, user_repo, value, url, hash_size)
Shorten URL.
Shorten URL.
Shorten URL .
def shorten(self, link, provider, link_type, user_repo, value, url, hash_size):
        """Shorten URL."""

        label = PROVIDER_INFO[provider]['provider']
        prov_class = 'magiclink-%s' % provider
        class_attr = link.get('class', '')
        class_name = class_attr.split(' ') if class_attr else []

        if 'magiclink' not in class_name:
            class_name.append('magiclink')

        if prov_class not in class_name:
            class_name.append(prov_class)

        # Link specific shortening logic
        if link_type is self.DIFF:
            self.shorten_diff(link, class_name, label, user_repo, value, hash_size)
        elif link_type is self.COMMIT:
            self.shorten_commit(link, class_name, label, user_repo, value, hash_size)
        else:
            self.shorten_issue(link, class_name, label, user_repo, value, link_type)
        link.set('class', ' '.join(class_name))
def shorten ( self , link , provider , link_type , user_repo , value , url , hash_size ) : label = PROVIDER_INFO [ provider ] [ 'provider' ] prov_class = 'magiclink-%s' % provider class_attr = link . get ( 'class' , '' ) class_name = class_attr . split ( ' ' ) if class_attr else [ ] if 'magiclink' not in class_name : class_name . append ( 'magiclink' ) if prov_class not in class_name : class_name . append ( prov_class ) # Link specific shortening logic if link_type is self . DIFF : self . shorten_diff ( link , class_name , label , user_repo , value , hash_size ) elif link_type is self . COMMIT : self . shorten_commit ( link , class_name , label , user_repo , value , hash_size ) else : self . shorten_issue ( link , class_name , label , user_repo , value , link_type ) link . set ( 'class' , ' ' . join ( class_name ) )