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

Class _DayOffset

Lib/zoneinfo/_zoneinfo.py:520–544  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

518
519
520class _DayOffset:
521 __slots__ = ["d", "julian", "hour", "minute", "second"]
522
523 def __init__(self, d, julian, hour=2, minute=0, second=0):
524 min_day = 0 + julian # convert bool to int
525 if not min_day <= d <= 365:
526 raise ValueError(f"d must be in [{min_day}, 365], not: {d}")
527
528 self.d = d
529 self.julian = julian
530 self.hour = hour
531 self.minute = minute
532 self.second = second
533
534 def year_to_epoch(self, year):
535 days_before_year = _post_epoch_days_before_year(year)
536
537 d = self.d
538 if self.julian and d >= 59 and calendar.isleap(year):
539 d += 1
540
541 epoch = (days_before_year + d) * 86400
542 epoch += self.hour * 3600 + self.minute * 60 + self.second
543
544 return epoch
545
546
547class _CalendarOffset:

Callers 1

_parse_dst_start_endFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…