MCPcopy Index your code
hub / github.com/python/cpython / _check_date_fields

Function _check_date_fields

Lib/_pydatetime.py:567–578  ·  view source on GitHub ↗
(year, month, day)

Source from the content-addressed store, hash-verified

565 f"timedelta(hours=24), not {offset!r}")
566
567def _check_date_fields(year, month, day):
568 year = _index(year)
569 month = _index(month)
570 day = _index(day)
571 if not MINYEAR <= year <= MAXYEAR:
572 raise ValueError(f"year must be in {MINYEAR}..{MAXYEAR}, not {year}")
573 if not 1 <= month <= 12:
574 raise ValueError(f"month must be in 1..12, not {month}")
575 dim = _days_in_month(year, month)
576 if not 1 <= day <= dim:
577 raise ValueError(f"day {day} must be in range 1..{dim} for month {month} in year {year}")
578 return year, month, day
579
580def _check_time_fields(hour, minute, second, microsecond, fold):
581 hour = _index(hour)

Callers 2

__new__Method · 0.85
__new__Method · 0.85

Calls 2

_indexFunction · 0.85
_days_in_monthFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…