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

Function _check_utc_offset

Lib/_pydatetime.py:555–565  ·  view source on GitHub ↗
(name, offset)

Source from the content-addressed store, hash-verified

553# Else offset is checked for being in range.
554# If it is, its integer value is returned. Else ValueError is raised.
555def _check_utc_offset(name, offset):
556 assert name in ("utcoffset", "dst")
557 if offset is None:
558 return
559 if not isinstance(offset, timedelta):
560 raise TypeError(f"tzinfo.{name}() must return None "
561 f"or timedelta, not {type(offset).__name__!r}")
562 if not -timedelta(1) < offset < timedelta(1):
563 raise ValueError("offset must be a timedelta "
564 "strictly between -timedelta(hours=24) and "
565 f"timedelta(hours=24), not {offset!r}")
566
567def _check_date_fields(year, month, day):
568 year = _index(year)

Callers 4

utcoffsetMethod · 0.85
dstMethod · 0.85
utcoffsetMethod · 0.85
dstMethod · 0.85

Calls 1

timedeltaClass · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…