<commit_before>from datetime import date, timedelta

class InvalidDate(Exception):
    pass

class DateWithCalendar(object):
    def __init__(self, calendar_class, date):
        self.calendar = calendar_class
        self.date = date

    def convert_to(self, calendar):
        return calendar.from_date(self.date)

    def __eq__(self, other):
        return self.calendar == other.calendar and self.date == other.date

    def __str__(self):
        return "%s (%s)" % (self.calendar.date_display_string(self.date), self.calendar.display_name)

    def __lt__(self, other):
        other_date = other
        if isinstance(other, DateWithCalendar):
            other_date = other.date
        return self.date < other_date

    def __gt__(self, other):
        other_date = other
        if isinstance(other, DateWithCalendar):
            other_date = other.date
        return self.date > other_date

    @staticmethod
    def make_assertEqual(test_case):
        def assertEqual(a, b, msg):
            if a.__eq__(b):
                return True
            else:
                if msg is None:
                    msg = "%s is not equal to %s" % (a, b)
                raise test_case.failureException(msg)
        return assertEqual
<commit_msg>Don't use isinstance in comparison operators.<commit_after>from datetime import date, timedelta

class InvalidDate(Exception):
    pass

class DateWithCalendar(object):
    def __init__(self, calendar_class, date):
        self.calendar = calendar_class
        self.date = date

    def convert_to(self, calendar):
        return calendar.from_date(self.date)

    def __eq__(self, other):
        return self.calendar == other.calendar and self.date == other.date

    def __str__(self):
        return "%s (%s)" % (self.calendar.date_display_string(self.date), self.calendar.display_name)

    def __lt__(self, other):
        try:
            other_date = other.date
        except:
            other_date = other
        return self.date < other_date

    def __gt__(self, other):
        try:
            other_date = other.date
        except:
            other_date = other
        return self.date > other_date

    @staticmethod
    def make_assertEqual(test_case):
        def assertEqual(a, b, msg):
            if a.__eq__(b):
                return True
            else:
                if msg is None:
                    msg = "%s is not equal to %s" % (a, b)
                raise test_case.failureException(msg)
        return assertEqual

{'fraction_non_alphanumeric': 0.0883054892601432, 'fraction_numerical': 0.0, 'mean_word_length': 2.1087762669962915, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '4702080', 'n_tokens_mistral': 704, 'n_tokens_neox': 680, 'n_words': 191}