<commit_before>import abc

from framework.auth.decorators import collect_auth
from website.util import api_url_for, web_url_for


class AddonSerializer(object):
    __metaclass__ = abc.ABCMeta

    # TODO take addon_node_settings, addon_user_settings
    def __init__(self, node_settings=None, user_settings=None):
        self.node_settings = node_settings
        self.user_settings = user_settings

    @abc.abstractproperty
    def addon_serialized_urls(self):
        pass

    @abc.abstractproperty
    def serialized_urls(self):
        pass

    @abc.abstractproperty
    def user_is_owner(self):
        pass

    @abc.abstractproperty
    def credentials_owner(self):
        pass

    @property
    def can_share(self):
        '''
        Does the third party service expose a way to share content?

        defaults to False unless overidden in subclass
        '''
        return False

    @property
    def serialized_node_settings(self):
        result = {
            'nodeHasAuth': self.node_settings.has_auth,
            'userIsOwner': self.user_is_owner,
            'urls': self.serialized_urls,
            'canShare': self.can_share,
        }

        if self.user_settings:
            result['userHasAuth'] = self.user_settings.has_auth<commit_msg>Remove canShare  [skip ci]<commit_after>import abc

from framework.auth.decorators import collect_auth
from website.util import api_url_for, web_url_for


class AddonSerializer(object):
    __metaclass__ = abc.ABCMeta

    # TODO take addon_node_settings, addon_user_settings
    def __init__(self, node_settings=None, user_settings=None):
        self.node_settings = node_settings
        self.user_settings = user_settings

    @abc.abstractproperty
    def addon_serialized_urls(self):
        pass

    @abc.abstractproperty
    def serialized_urls(self):
        pass

    @abc.abstractproperty
    def user_is_owner(self):
        pass

    @abc.abstractproperty
    def credentials_owner(self):
        pass

    @property
    def serialized_node_settings(self):
        result = {
            'nodeHasAuth': self.node_settings.has_auth,
            'userIsOwner': self.user_is_owner,
            'urls': self.serialized_urls,
        }

        if self.user_settings:
            result['userHasAuth'] = self.user_settings.has_auth
{'fraction_non_alphanumeric': 0.07426597582037997, 'fraction_numerical': 0.0, 'mean_word_length': 2.7310789049919486, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6867765', 'n_tokens_mistral': 681, 'n_tokens_neox': 673, 'n_words': 141}