<commit_before>
# An extension of `list` that loops indices.

class Ring(list):
    def _getsuper(self, key):
        return super().__getitem__(key)

    def __getitem__(self, key):
        length = len(self)
        if isinstance(key, slice):
            if key.stop - key.start > length:
                raise IndexError
            start = key.start % length
            stop = key.stop % length
            if start >= stop:
                return (self+self)[slice(start,stop+length,key.step)]
            else:
                return self._getsuper(slice(start,stop,key.step))
        else:
            key %= length
            return self._getsuper(key)<commit_msg>Ring should subclass tuple not list<commit_after>
# An extension of `list` that loops indices.

class Ring(tuple):
    def _getsuper(self, key):
        return super().__getitem__(key)

    def __getitem__(self, key):
        length = len(self)
        if isinstance(key, slice):
            if key.stop - key.start > length:
                raise IndexError
            start = key.start % length
            stop = key.stop % length
            if start >= stop:
                return (self+self)[slice(start,stop+length,key.step)]
            else:
                return self._getsuper(slice(start,stop,key.step))
        else:
            key %= length
            return self._getsuper(key)
{'fraction_non_alphanumeric': 0.10211524434719182, 'fraction_numerical': 0.0, 'mean_word_length': 1.8, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, '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': '6291239', 'n_tokens_mistral': 380, 'n_tokens_neox': 368, 'n_words': 100}