<commit_before>#-*- encoding: utf-8
"""
Cursor object for storing cursor data.
"""

class Cursor:
    def __init__(self, x=0, y=0):
        if type(x) == type((0,)):
            x,y = x
            self.x = x
            self.y = y
        elif isinstance(x, Cursor):
            self.x = x.x
            self.y = x.y
        else:
            self.x = x
            self.y = y
        
    def __getitem__(self, i):
        if i == 0:
            return self.x
        elif i == 1:
            return self.y

    def __setitem__(self, i, v):
        if i == 0:
            self.x = v
        elif i == 1:
            self.y = v

    def __eq__(self, item):
        if isinstance(item, Cursor):
            if item.x == self.x and item.y == self.x:
                return True
        return False

    def __ne__(self, item):
        if isinstance(item, Cursor):
            if item.x != self.x and item.y != self.x:
                return False

    def tuple(self):
        return (self.x, self.y)
<commit_msg>Some comments and a slight fix to method for checking uneqality.<commit_after>#-*- encoding: utf-8
"""
Cursor object for storing cursor data.
"""
    
class Cursor:
    def __init__(self, x=0, y=0):
        # Handle coords as a tuple
        if type(x) == type((0,)):
            x,y = x
            self.x = x
            self.y = y
        # Handle coords from existing Cursor
        elif isinstance(x, Cursor):  # Handle arguments as a cursor
            self.x = x.x
            self.y = x.y
        # Handle coords as plain ints
        else:
            self.x = x
            self.y = y
        
    def __getitem__(self, i):
        """Get coordinates with list indices."""
        if i == 0:
            return self.x
        elif i == 1:
            return self.y

    def __setitem__(self, i, v):
        """Set coordinates with list indices."""
        if i == 0:
            self.x = v
        elif i == 1:
            self.y = v

    def __eq__(self, item):
        """Check for equality."""
        if isinstance(item, Cursor):
            if item.x == self.x and item.y == self.x:
                return True
        return False

    def __ne__(self, item):
        """Check for unequality."""
        if isinstance(item, Cursor):
            if item.x != self.x or item.y != self.x:
                return False

    def tuple(self):
        """Return cursor as a tuple."""
        return (self.x, self.y)

{'fraction_non_alphanumeric': 0.11812961443806398, 'fraction_numerical': 0.006562756357670222, 'mean_word_length': 1.329512893982808, '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': '5054999', 'n_tokens_mistral': 754, 'n_tokens_neox': 732, 'n_words': 247}