<commit_before>import math

class Vec2D(object):
    __slots__ = ['x', 'y']
    
    def __init__(self, *args):
        """
        Accepts either x and y as a tuple, or two arguments, x and y.
        """
        if len(args) == 1:
            self.x, self.y = args[0]
        elif len(args) == 2:
            self.x, self.y = args[0], args[1]
        else:
            raise ValueError("Invalid Vec2D arguments")
            
    def __len__(self):
        return 2
        
    def __getitem__(self, key):
        if key == 0:
            return self.x
        if key == 1:
            return self.y
        raise IndexError("Invalid subscript %s" % (str(key)))
        
    def __repr__(self):
        return 'Vec2D(%s, %s)' % (str(self.x), str(self.y))
        
    def __eq__(self, o):
        try:
            return self.x == o[0] and self.y == o[1]
        except (IndexError, TypeError):
            return False
    
    def __neq__(self, o):
        try:
            return self.x != o[0] or self.y != o[1]
        except (IndexError, TypeError):
            return True
    
    def __add__(self, o):
        try:
            return Vec2D(self.x + o[0], self.y + o[1])
        except (IndexError, TypeError):
            return NotImplemented
    
    __radd__ = __add__
    
    def __sub__(self, o):
        try:
            return Vec2D(self.x - o[0], self.y - o[1])
        except (IndexError, TypeError):
            return NotImplemented
            
    __isub__ = __sub__

    def __rsub__(self, o):
        try:
            return Vec2D(o[0] - self.x, o[1] - self.y)
        except (IndexError, TypeError):
            return NotImplemented
            
    def __mul__(self, o):
        try:
            return Vec2D(self.x * o[0], self.y * o[0])
        except (IndexError, TypeError):
            pass
        
        if isinstance(o, (int, long, float)):
            return Vec2D(self.x * o, self.y * o)
            
        return NotImplemented<commit_msg>Some Vec2D bugfixes<commit_after>import math

class Vec2D(object):
    __slots__ = ['x', 'y']
    
    def __init__(self, *args):
        """
        Accepts either x and y as a tuple, or two arguments, x and y.
        """
        if len(args) == 1:
            self.x, self.y = args[0]
        elif len(args) == 2:
            self.x, self.y = args[0], args[1]
        else:
            raise ValueError("Invalid Vec2D arguments")
            
    def __len__(self):
        return 2
        
    def __getitem__(self, key):
        if key == 0:
            return self.x
        if key == 1:
            return self.y
        raise IndexError("Invalid subscript %s" % (str(key)))
        
    def __repr__(self):
        return 'Vec2D(%s, %s)' % (str(self.x), str(self.y))
        
    def __eq__(self, o):
        try:
            return self.x == o[0] and self.y == o[1]
        except (IndexError, TypeError):
            return False
    
    def __ne__(self, o):
        return not self.__eq__(o)
    
    def __add__(self, o):
        try:
            return Vec2D(self.x + o[0], self.y + o[1])
        except (IndexError, TypeError):
            return NotImplemented
    
    __radd__ = __add__
    
    def __sub__(self, o):
        try:
            return Vec2D(self.x - o[0], self.y - o[1])
        except (IndexError, TypeError):
            return NotImplemented
            
    __isub__ = __sub__

    def __rsub__(self, o):
        try:
            return Vec2D(o[0] - self.x, o[1] - self.y)
        except (IndexError, TypeError):
            return NotImplemented
            
    def __mul__(self, o):
        try:
            return Vec2D(self.x * o[0], self.y * o[1])
        except (IndexError, TypeError):
            pass
        
        if isinstance(o, (int, long, float)):
            return Vec2D(self.x * o, self.y * o)
            
        return NotImplemented
{'fraction_non_alphanumeric': 0.11958762886597939, 'fraction_numerical': 0.014175257731958763, 'mean_word_length': 1.4641269841269842, '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': '587966', 'n_tokens_mistral': 1255, 'n_tokens_neox': 1244, 'n_words': 336}