MCPcopy Index your code
hub / github.com/RustPython/RustPython / _check_date_fields

Function _check_date_fields

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

Source from the content-addressed store, hash-verified

556 f"timedelta(hours=24), not {offset!r}")
557
558def _check_date_fields(year, month, day):
559 year = _index(year)
560 month = _index(month)
561 day = _index(day)
562 if not MINYEAR <= year <= MAXYEAR:
563 raise ValueError(f"year must be in {MINYEAR}..{MAXYEAR}, not {year}")
564 if not 1 <= month <= 12:
565 raise ValueError(f"month must be in 1..12, not {month}")
566 dim = _days_in_month(year, month)
567 if not 1 <= day <= dim:
568 raise ValueError(f"day {day} must be in range 1..{dim} for month {month} in year {year}")
569 return year, month, day
570
571def _check_time_fields(hour, minute, second, microsecond, fold):
572 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