from .dates_add_days import is_leap_year as _kernel_is_leap_year def is_leap_year(year: int) -> bool: """Whether a year is a Gregorian leap year. The rule lives in dates.add-days; this adds the range check so a year of 0 or 10000 fails loudly rather than answering for a year no ISO date can name. """ if isinstance(year, bool) or not isinstance(year, int): raise TypeError("year must be an integer, received %r" % (year,)) if year < 1 or year > 9999: raise ValueError("year %s is outside the supported range 1 to 9999" % (year,)) return _kernel_is_leap_year(year)