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

Function _check_time_fields

Lib/_pydatetime.py:580–595  ·  view source on GitHub ↗
(hour, minute, second, microsecond, fold)

Source from the content-addressed store, hash-verified

578 return year, month, day
579
580def _check_time_fields(hour, minute, second, microsecond, fold):
581 hour = _index(hour)
582 minute = _index(minute)
583 second = _index(second)
584 microsecond = _index(microsecond)
585 if not 0 <= hour <= 23:
586 raise ValueError(f"hour must be in 0..23, not {hour}")
587 if not 0 <= minute <= 59:
588 raise ValueError(f"minute must be in 0..59, not {minute}")
589 if not 0 <= second <= 59:
590 raise ValueError(f"second must be in 0..59, not {second}")
591 if not 0 <= microsecond <= 999999:
592 raise ValueError(f"microsecond must be in 0..999999, not {microsecond}")
593 if fold not in (0, 1):
594 raise ValueError(f"fold must be either 0 or 1, not {fold}")
595 return hour, minute, second, microsecond, fold
596
597def _check_tzinfo_arg(tz):
598 if tz is not None and not isinstance(tz, tzinfo):

Callers 3

_parse_isoformat_timeFunction · 0.85
__new__Method · 0.85
__new__Method · 0.85

Calls 1

_indexFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…