<commit_before>from scrapy.item.adaptors import AdaptorDict
from scrapy.conf import settings

class ScrapedItem(object):
    """
    This is the base class for all scraped items.
    'guid' attribute is required, and is an attribute
    that identifies uniquely the given scraped item.
    """

    def set_adaptors(self, adaptors_dict, **kwargs):
        """
        Set the adaptors to use for this item. Receives a dict of the adaptors
        desired for each attribute and returns the item itself.
        """
        setattr(self, '_adaptors_dict', AdaptorDict(adaptors_dict))
        return self
    
    def set_attrib_adaptors(self, attrib, adaptors, **kwargs):
        """
        Set the adaptors (from a list or tuple) to be used for a specific attribute.
        """
        self._adaptors_dict[attrib] = adaptors

    def attribute(self, attrname, value, override=False, add=False, debug=False):
        val = self._adaptors_dict.execute(attrname, value, debug)
        if not val is None:
            curr_val = getattr(self, attrname, None)
            if not curr_val:
                setattr(self, attrname, val)
            else:
                if override:
                    setattr(self, attrname, val)
                elif add and all(hasattr(var, '__iter__') for var in (curr_val, val)):
                    newval = []
                    newval.extend(curr_val)
                    newval.extend(val)
                    setattr(self, attrname, newval)

    def __sub__(self, other):
        raise NotImplementedError

class ItemDelta(object):
    pass
<commit_msg>Wrong attribute assignation fixed again<commit_after>from scrapy.item.adaptors import AdaptorDict
from scrapy.conf import settings

class ScrapedItem(object):
    """
    This is the base class for all scraped items.
    'guid' attribute is required, and is an attribute
    that identifies uniquely the given scraped item.
    """

    def set_adaptors(self, adaptors_dict, **kwargs):
        """
        Set the adaptors to use for this item. Receives a dict of the adaptors
        desired for each attribute and returns the item itself.
        """
        setattr(self, '_adaptors_dict', AdaptorDict(adaptors_dict))
        return self
    
    def set_attrib_adaptors(self, attrib, adaptors, **kwargs):
        """
        Set the adaptors (from a list or tuple) to be used for a specific attribute.
        """
        self._adaptors_dict[attrib] = adaptors

    def attribute(self, attrname, value, override=False, add=False, debug=False):
        val = self._adaptors_dict.execute(attrname, value, debug)
        if val or val is False:
            curr_val = getattr(self, attrname, None)
            if not curr_val:
                setattr(self, attrname, val)
            else:
                if override:
                    setattr(self, attrname, val)
                elif add and all(hasattr(var, '__iter__') for var in (curr_val, val)):
                    newval = []
                    newval.extend(curr_val)
                    newval.extend(val)
                    setattr(self, attrname, newval)

    def __sub__(self, other):
        raise NotImplementedError

class ItemDelta(object):
    pass

{'fraction_non_alphanumeric': 0.08084577114427861, 'fraction_numerical': 0.0, 'mean_word_length': 2.1601178781925343, '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': '5267267', 'n_tokens_mistral': 920, 'n_tokens_neox': 879, 'n_words': 293}