<commit_before>from datetime import timedelta, date as vanilla_date

from base import DateWithCalendar
from ..internal.julian import distant_julian_to_gregorian

class DistantDate(DateWithCalendar):
    def __init__(self, y, m, d):
        self.year = y
        self.month = m
        self.day = d

    @property
    def _date(self):
        return self

    def __str__(self):
        s = "%d/%d/%d CE (Distant Date)"
        return s % (self.year, self.month, self.day)

    def __sub__(self, other):
        try:
            o_year = other.year
            if o_year < 10000:
                a = self - DistantDate(10000, 1, 1)
                b = vanilla_date(9999, 12, 31) - other
                x = a.days + b.days + 1
                return timedelta(days=x)
            if self.year == o_year:
                if self.month == other.month:
                    return timedelta(days=self.day - other.day)
            return timedelta(days=0)
        except AttributeError:
            pass
        try:
            _ = other.days
            return DistantDate(10000, 1, 1)
        except:
            pass
        return None

    def __ge__(self, other):
        if self.year != other.year:
            return self.year > other.year
        if self.month != other.month:
            return self.month > other.month
        return self.day >= other.day

    def __le__(self, other):
        if self.year == other.year and self.month == other.month and self.day == other.day:
            return True<commit_msg>Calculate by working out offset dates with the same gap.<commit_after>from datetime import timedelta, date as vanilla_date

from base import DateWithCalendar
from ..internal.julian import distant_julian_to_gregorian

class DistantDate(DateWithCalendar):
    def __init__(self, y, m, d):
        self.year = y
        self.month = m
        self.day = d

    @property
    def _date(self):
        return self

    def __str__(self):
        s = "%d/%d/%d CE (Distant Date)"
        return s % (self.year, self.month, self.day)

    def __sub__(self, other):
        try:
            o_year = other.year
            if o_year < 10000:
                a = self - DistantDate(10000, 1, 1)
                b = vanilla_date(9999, 12, 31) - other
                x = a.days + b.days + 1
                return timedelta(days=x)
            if self.year == o_year:
                if self.month == other.month:
                    return timedelta(days=self.day - other.day)
                offset = ((self.year - 1600) // 400) * 400
                return vanilla_date(self.year - offset, self.month, self.day) - vanilla_date(other.year - offset, other.month, other.day)
            return timedelta(days=0)
        except AttributeError:
            pass
        try:
            _ = other.days
            return DistantDate(10000, 1, 1)
        except:
            pass
        return None

    def __ge__(self, other):
        if self.year != other.year:
            return self.year > other.year
        if self.month != other.month:
            return self.month > other.month
        return self.day >= other.day

    def __le__(self, other):
        if self.year == other.year and self.month == other.month and self.day == other.day:
            return True
{'fraction_non_alphanumeric': 0.09640024405125076, 'fraction_numerical': 0.020744356314826115, 'mean_word_length': 1.659367396593674, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 9, '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': '5738811', 'n_tokens_mistral': 1031, 'n_tokens_neox': 929, 'n_words': 274}