MCPcopy Create free account
hub / github.com/python/cpython / _get_trans_info_fromutc

Method _get_trans_info_fromutc

Lib/zoneinfo/_zoneinfo.py:489–511  ·  view source on GitHub ↗
(self, ts, year)

Source from the content-addressed store, hash-verified

487 return self.dst if isdst else self.std
488
489 def _get_trans_info_fromutc(self, ts, year):
490 start, end = self.transitions(year)
491 start -= self.std.utcoff.total_seconds()
492 end -= self.dst.utcoff.total_seconds()
493
494 if start < end:
495 isdst = start <= ts < end
496 else:
497 isdst = not (end <= ts < start)
498
499 # For positive DST, the ambiguous period is one dst_diff after the end
500 # of DST; for negative DST, the ambiguous period is one dst_diff before
501 # the start of DST.
502 if self.dst_diff > 0:
503 ambig_start = end
504 ambig_end = end + self.dst_diff
505 else:
506 ambig_start = start
507 ambig_end = start - self.dst_diff
508
509 fold = ambig_start <= ts < ambig_end
510
511 return (self.dst if isdst else self.std, fold)
512
513
514def _post_epoch_days_before_year(year):

Callers

nothing calls this directly

Calls 2

transitionsMethod · 0.95
total_secondsMethod · 0.80

Tested by

no test coverage detected