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

Method _get_trans_info

Lib/zoneinfo/_zoneinfo.py:461–483  ·  view source on GitHub ↗

Get the information about the current transition - tti

(self, ts, year, fold)

Source from the content-addressed store, hash-verified

459 return start, end
460
461 def _get_trans_info(self, ts, year, fold):
462 """Get the information about the current transition - tti"""
463 start, end = self.transitions(year)
464
465 # With fold = 0, the period (denominated in local time) with the
466 # smaller offset starts at the end of the gap and ends at the end of
467 # the fold; with fold = 1, it runs from the start of the gap to the
468 # beginning of the fold.
469 #
470 # So in order to determine the DST boundaries we need to know both
471 # the fold and whether DST is positive or negative (rare), and it
472 # turns out that this boils down to fold XOR is_positive.
473 if fold == (self.dst_diff >= 0):
474 end -= self.dst_diff
475 else:
476 start += self.dst_diff
477
478 if start < end:
479 isdst = start <= ts < end
480 else:
481 isdst = not (end <= ts < start)
482
483 return self.dst if isdst else self.std
484
485 def _get_trans_info_fromutc(self, ts, year):
486 start, end = self.transitions(year)

Callers

nothing calls this directly

Calls 1

transitionsMethod · 0.95

Tested by

no test coverage detected