<commit_before>from libcpp.vector cimport vector
from primitiv.config cimport cppstr_to_pystr


cdef class _Shape:

    def __init__(self, dims = None, unsigned batch = 1):
        if dims is None:
            self.wrapped = CppShape()
        else:
            self.wrapped = CppShape(<vector[unsigned]> dims, <unsigned> batch)

    def depth(self):
        return self.wrapped.depth()

    def batch(self):
        return self.wrapped.batch()

    def volume(self):
        return self.wrapped.volume()

    def lower_volume(self, unsigned dim):
        return self.wrapped.lower_volume(dim)

    def size(self):
        return self.wrapped.size()

    def __str__(self):
        return cppstr_to_pystr(self.wrapped.to_string())

    def __repr__(self):
        return "Shape(%s)" % str(self)

    def __getitem__(self, unsigned i):
        return self.wrapped[i]

    def __eq__(_Shape self, _Shape rhs):
        return self.wrapped == rhs.wrapped

    def __ne__(_Shape self, _Shape rhs):
        return self.wrapped != rhs.wrapped

    def has_batch(self):
        return self.wrapped.has_batch()

    def has_compatible_batch(self, _Shape rhs):
        return self.wrapped.has_compatible_batch(rhs.wrapped)<commit_msg>Fix __repr__ output format of Shape<commit_after>from libcpp.vector cimport vector
from primitiv.config cimport cppstr_to_pystr


cdef class _Shape:

    def __init__(self, dims = None, unsigned batch = 1):
        if dims is None:
            self.wrapped = CppShape()
        else:
            self.wrapped = CppShape(<vector[unsigned]> dims, <unsigned> batch)

    def depth(self):
        return self.wrapped.depth()

    def batch(self):
        return self.wrapped.batch()

    def volume(self):
        return self.wrapped.volume()

    def lower_volume(self, unsigned dim):
        return self.wrapped.lower_volume(dim)

    def size(self):
        return self.wrapped.size()

    def __str__(self):
        return cppstr_to_pystr(self.wrapped.to_string())

    def __repr__(self):
        return "Shape([%s], %d)" % (", ".join(str(self[i]) for i in range(self.depth())), self.batch())

    def __getitem__(self, unsigned i):
        return self.wrapped[i]

    def __eq__(_Shape self, _Shape rhs):
        return self.wrapped == rhs.wrapped

    def __ne__(_Shape self, _Shape rhs):
        return self.wrapped != rhs.wrapped

    def has_batch(self):
        return self.wrapped.has_batch()

    def has_compatible_batch(self, _Shape rhs):
        return self.wrapped.has_compatible_batch(rhs.wrapped)
{'fraction_non_alphanumeric': 0.1076923076923077, 'fraction_numerical': 0.0007889546351084812, 'mean_word_length': 2.7738095238095237, 'pattern_counts': {'":': 0, '<': 7, '<?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': '7302187', 'n_tokens_mistral': 831, 'n_tokens_neox': 792, 'n_words': 196}