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

Function _parse_dst_start_end

Lib/zoneinfo/_zoneinfo.py:705–728  ·  view source on GitHub ↗
(dststr)

Source from the content-addressed store, hash-verified

703
704
705def _parse_dst_start_end(dststr):
706 date, *time = dststr.split("/", 1)
707 type = date[:1]
708 if type == "M":
709 n_is_julian = False
710 m = re.fullmatch(r"M(\d{1,2})\.(\d).(\d)", date, re.ASCII)
711 if m is None:
712 raise ValueError(f"Invalid dst start/end date: {dststr}")
713 date_offset = tuple(map(int, m.groups()))
714 offset = _CalendarOffset(*date_offset)
715 else:
716 if type == "J":
717 n_is_julian = True
718 date = date[1:]
719 else:
720 n_is_julian = False
721
722 doy = int(date)
723 offset = _DayOffset(doy, n_is_julian)
724
725 if time:
726 offset.hour, offset.minute, offset.second = _parse_transition_time(time[0])
727
728 return offset
729
730
731def _parse_transition_time(time_str):

Callers 1

_parse_tz_strFunction · 0.85

Calls 5

_CalendarOffsetClass · 0.85
_DayOffsetClass · 0.85
_parse_transition_timeFunction · 0.85
splitMethod · 0.45
groupsMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…