<commit_before># coding: utf-8

class Object(object):
    def __init__(self, data=None):
        self._data = []
        if data is not None:
            self.extend(data)

    @property
    def data(self):
        return self._data

    @property
    def object_class(self):
        return self.data[0][0]

    @object_class.setter
    def object_class(self, new_class):
        self.data[0] = (new_class, self.object_key)

    @property
    def object_key(self):
        return self.data[0][1]

    @object_key.setter
    def object_key(self, new_key):
        self.data[0] = (self.object_class, new_key)

    @property
    def type(self):
        return self.object_class

    @property
    def key(self):
        return self.object_key

    @property
    def primary_key(self):
        return "".join(self[k] for k in self.primary_key_fields)

    @property
    def primary_key_fields(self):
        return [self.object_class]

    def primary_key_object(self):
        return self.__class__(
            [(k, v) for k, v in self.data if k in self.primary_key_fields])

    def extend(self, ex, append_group=False):
        if isinstance(ex, str):
            ex = parse_object(ex.split())
        self._data.extend(map(tuple, ex))

    def __getitem__(self, key):
        if isinstance(key, str):
            key = key.replace("_", "-")
            try:
                return list(self.get(key))[0]
            except IndexError:
                raise KeyError(repr(key))
        elif isinstance(key, (int, slice)):
            return self.data[key]
        raise TypeError(
            "Expected key to be str or int, got {}".format(<commit_msg>fix bug in Object.extend for str instances<commit_after># coding: utf-8

class Object(object):
    def __init__(self, data=None):
        self._data = []
        if data is not None:
            self.extend(data)

    @property
    def data(self):
        return self._data

    @property
    def object_class(self):
        return self.data[0][0]

    @object_class.setter
    def object_class(self, new_class):
        self.data[0] = (new_class, self.object_key)

    @property
    def object_key(self):
        return self.data[0][1]

    @object_key.setter
    def object_key(self, new_key):
        self.data[0] = (self.object_class, new_key)

    @property
    def type(self):
        return self.object_class

    @property
    def key(self):
        return self.object_key

    @property
    def primary_key(self):
        return "".join(self[k] for k in self.primary_key_fields)

    @property
    def primary_key_fields(self):
        return [self.object_class]

    def primary_key_object(self):
        return self.__class__(
            [(k, v) for k, v in self.data if k in self.primary_key_fields])

    def extend(self, ex, append_group=False):
        if isinstance(ex, str):
            ex = parse_object(ex.splitlines())
        self._data.extend(map(tuple, ex))

    def __getitem__(self, key):
        if isinstance(key, str):
            key = key.replace("_", "-")
            try:
                return list(self.get(key))[0]
            except IndexError:
                raise KeyError(repr(key))
        elif isinstance(key, (int, slice)):
            return self.data[key]
        raise TypeError(
            "Expected key to be str or int, got {}".format(
{'fraction_non_alphanumeric': 0.11294188136608747, 'fraction_numerical': 0.004793289394847214, 'mean_word_length': 2.155954631379962, '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': '6839236', 'n_tokens_mistral': 1054, 'n_tokens_neox': 1022, 'n_words': 257}