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

Function us_dst_range

Doc/includes/tzinfo_examples.py:96–110  ·  view source on GitHub ↗
(year)

Source from the content-addressed store, hash-verified

94
95
96def us_dst_range(year):
97 # Find start and end times for US DST. For years before 1967, return
98 # start = end for no DST.
99 if 2006 < year:
100 dststart, dstend = DSTSTART_2007, DSTEND_2007
101 elif 1986 < year < 2007:
102 dststart, dstend = DSTSTART_1987_2006, DSTEND_1987_2006
103 elif 1966 < year < 1987:
104 dststart, dstend = DSTSTART_1967_1986, DSTEND_1967_1986
105 else:
106 return (dt.datetime(year, 1, 1), ) * 2
107
108 start = first_sunday_on_or_after(dststart.replace(year=year))
109 end = first_sunday_on_or_after(dstend.replace(year=year))
110 return start, end
111
112
113class USTimeZone(dt.tzinfo):

Callers 2

dstMethod · 0.85
fromutcMethod · 0.85

Calls 3

datetimeMethod · 0.80
first_sunday_on_or_afterFunction · 0.70
replaceMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…