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

Function _check_utc_offset

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

Source from the content-addressed store, hash-verified

544# Else offset is checked for being in range.
545# If it is, its integer value is returned. Else ValueError is raised.
546def _check_utc_offset(name, offset):
547 assert name in ("utcoffset", "dst")
548 if offset is None:
549 return
550 if not isinstance(offset, timedelta):
551 raise TypeError(f"tzinfo.{name}() must return None "
552 f"or timedelta, not {type(offset).__name__!r}")
553 if not -timedelta(1) < offset < timedelta(1):
554 raise ValueError("offset must be a timedelta "
555 "strictly between -timedelta(hours=24) and "
556 f"timedelta(hours=24), not {offset!r}")
557
558def _check_date_fields(year, month, day):
559 year = _index(year)

Callers 4

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

Calls 2

isinstanceFunction · 0.85
timedeltaClass · 0.85

Tested by

no test coverage detected