Lines Matching defs:tzinfo

7 __all__ = ("date", "datetime", "time", "timedelta", "timezone", "tzinfo",
494 raise TypeError("tzinfo.tzname() must return None or string, "
508 raise TypeError("tzinfo.%s() must return None "
546 if tz is not None and not isinstance(tz, tzinfo):
547 raise TypeError("tzinfo argument must be None or of a tzinfo subclass")
1009 >>> dt = datetime(2010, 1, 1, tzinfo=timezone.utc)
1011 'datetime.datetime(2010, 1, 1, 0, 0, tzinfo=datetime.timezone.utc)'
1223 class tzinfo:
1232 raise NotImplementedError("tzinfo subclass must override tzname()")
1236 raise NotImplementedError("tzinfo subclass must override utcoffset()")
1244 raise NotImplementedError("tzinfo subclass must override dst()")
1251 if dt.tzinfo is not self:
1252 raise ValueError("dt.tzinfo is not self")
1313 _tzinfo_class = tzinfo
1336 hour, minute, second, microsecond, tzinfo, fold
1340 def __new__(cls, hour=0, minute=0, second=0, microsecond=0, tzinfo=None, *, fold=0):
1347 tzinfo (default to None)
1368 _check_tzinfo_arg(tzinfo)
1374 self._tzinfo = tzinfo
1401 def tzinfo(self):
1512 s = s[:-1] + ", tzinfo=%r" % self._tzinfo + ")"
1612 tzinfo=True, *, fold=None):
1622 if tzinfo is True:
1623 tzinfo = self.tzinfo
1626 return type(self)(hour, minute, second, microsecond, tzinfo, fold=fold)
1643 def __setstate(self, string, tzinfo):
1644 if tzinfo is not None and not isinstance(tzinfo, _tzinfo_class):
1645 raise TypeError("bad tzinfo state arg")
1654 self._tzinfo = tzinfo
1670 """datetime(year, month, day[, hour[, minute[, second[, microsecond[,tzinfo]]]]])
1672 The year, month and day arguments are required. tzinfo may be None, or an
1673 instance of a tzinfo subclass. The remaining arguments may be ints.
1678 microsecond=0, tzinfo=None, *, fold=0):
1698 _check_tzinfo_arg(tzinfo)
1707 self._tzinfo = tzinfo
1734 def tzinfo(self):
1814 def combine(cls, date, time, tzinfo=True):
1820 if tzinfo is True:
1821 tzinfo = time.tzinfo
1824 tzinfo, fold=time.fold)
1927 "Return the time part, with tzinfo None."
1931 "Return the time part, with same tzinfo."
1936 minute=None, second=None, microsecond=None, tzinfo=True,
1953 if tzinfo is True:
1954 tzinfo = self.tzinfo
1958 microsecond, tzinfo, fold=fold)
1961 if self.tzinfo is None:
1975 elif not isinstance(tz, tzinfo):
1976 raise TypeError("tz argument must be an instance of tzinfo")
1978 mytz = self.tzinfo
1985 mytz = self.replace(tzinfo=None)._local_timezone()
1992 utc = (self - myoffset).replace(tzinfo=tz)
2015 If self.tzinfo is not None, the UTC offset is also attached, giving
2049 s = s[:-1] + ", tzinfo=%r" % self._tzinfo + ")"
2197 tzinfo=self._tzinfo))
2258 def __setstate(self, string, tzinfo):
2259 if tzinfo is not None and not isinstance(tzinfo, _tzinfo_class):
2260 raise TypeError("bad tzinfo state arg")
2271 self._tzinfo = tzinfo
2297 class timezone(tzinfo):
2319 self = tzinfo.__new__(cls)
2383 if dt.tzinfo is not self:
2384 raise ValueError("fromutc: dt.tzinfo "
2420 _EPOCH = datetime(1970, 1, 1, tzinfo=timezone.utc)
2435 # 2. If x and y have the same tzinfo member, x.s = y.s.
2437 # sane tzinfo classes.
2440 # This is again a requirement for a sane tzinfo class.
2443 # This follows from #2, and that datetime.timetz+timedelta preserves tzinfo.
2449 # (meaning that the various tzinfo methods exist, and don't blow up or return
2497 # sense then. The docs ask that an Eastern tzinfo class consider such a time to
2512 # x.n + y.s = since z and y are have the same tzinfo member,
2542 # If so, we're done. If not, the tzinfo class is insane, according to the
2554 # -z.s - z.d + z'.s + z'.d = z and z' have same tzinfo
2568 # tzinfo class. In US Eastern, that's 5:MM UTC = 0:MM EST = 1:MM EDT. During
2590 # Note again that z' is not UTC-equivalent as far as the hybrid tzinfo class is
2616 # pretty bizarre, and a tzinfo subclass can override fromutc() if it is.