<commit_before>import collections

from inselect.lib.inselect_error import InselectError


# Simple representations of Points and rectangles
Point = collections.namedtuple('Point', ['x', 'y'])
Coordinates = collections.namedtuple('Coordinates', ['x0', 'y0', 'x1', 'y1'])


class Rect(collections.namedtuple('Rect', ['left', 'top', 'width', 'height'])):
    def __new__(cls, left, top, width, height):
        if left<0 or top<0 or width<=0 or height<=0:
            raise InselectError('Bad rectangle')
        else:
            return super(Rect, cls).__new__(cls, left, top, width, height)

    @property
    def area(self):
        "The product of width and height"
        return self.width*self.height

    @property
    def coordinates(self):
        "Coordinates(left, top, right, bottom)"
        return Coordinates(self.left, self.top, self.left+self.width,
                           self.top+self.height)

    @property
    def topleft(self):
        "Point(x, y)"
        return Point(self.left, self.top)

    @property
    def bottomright(self):
        "Point(x, y)"
        return Point(self.left+self.width, self.top+self.height)

    @property
    def centre(self):
        "Point(x, y)"
        return Point(self.left+self.width/2, self.top+self.height/2)

    def __eq__(self, other):
        if isinstance(other, Rect):
            return (self.left==other.left and
                    self.top==other.top and
                    self.width==other.width and
                    self.height==other.height)
        else:
            raise NotImplementedError()

    def __neq__(self, other):
      return not self==other<commit_msg>Correct 'not equal to' method name<commit_after>import collections

from inselect.lib.inselect_error import InselectError


# Simple representations of Points and rectangles
Point = collections.namedtuple('Point', ['x', 'y'])
Coordinates = collections.namedtuple('Coordinates', ['x0', 'y0', 'x1', 'y1'])


class Rect(collections.namedtuple('Rect', ['left', 'top', 'width', 'height'])):
    def __new__(cls, left, top, width, height):
        if left<0 or top<0 or width<=0 or height<=0:
            raise InselectError('Bad rectangle')
        else:
            return super(Rect, cls).__new__(cls, left, top, width, height)

    @property
    def area(self):
        "The product of width and height"
        return self.width*self.height

    @property
    def coordinates(self):
        "Coordinates(left, top, right, bottom)"
        return Coordinates(self.left, self.top, self.left+self.width,
                           self.top+self.height)

    @property
    def topleft(self):
        "Point(x, y)"
        return Point(self.left, self.top)

    @property
    def bottomright(self):
        "Point(x, y)"
        return Point(self.left+self.width, self.top+self.height)

    @property
    def centre(self):
        "Point(x, y)"
        return Point(self.left+self.width/2, self.top+self.height/2)

    def __eq__(self, other):
        if isinstance(other, Rect):
            return (self.left==other.left and
                    self.top==other.top and
                    self.width==other.width and
                    self.height==other.height)
        else:
            raise NotImplementedError()

    def __ne__(self, other):
      return not self==other
{'fraction_non_alphanumeric': 0.127633955448525, 'fraction_numerical': 0.006020469596628537, 'mean_word_length': 2.4686847599164925, 'pattern_counts': {'":': 0, '<': 11, '<?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': '5284108', 'n_tokens_mistral': 989, 'n_tokens_neox': 965, 'n_words': 250}