(self)
| 2108 | __replace__ = replace |
| 2109 | |
| 2110 | def _local_timezone(self): |
| 2111 | if self.tzinfo is None: |
| 2112 | ts = self._mktime() |
| 2113 | # Detect gap |
| 2114 | ts2 = self.replace(fold=1-self.fold)._mktime() |
| 2115 | if ts2 != ts: # This happens in a gap or a fold |
| 2116 | if (ts2 > ts) == self.fold: |
| 2117 | ts = ts2 |
| 2118 | else: |
| 2119 | ts = (self - _EPOCH) // timedelta(seconds=1) |
| 2120 | localtm = _time.localtime(ts) |
| 2121 | # Extract TZ data |
| 2122 | gmtoff = localtm.tm_gmtoff |
| 2123 | zone = localtm.tm_zone |
| 2124 | return timezone(timedelta(seconds=gmtoff), zone) |
| 2125 | |
| 2126 | def astimezone(self, tz=None): |
| 2127 | if tz is None: |
no test coverage detected