Back to index

python3.2  3.2.2
Public Member Functions | Static Private Attributes
datetime.tzinfo Class Reference
Inheritance diagram for datetime.tzinfo:
Inheritance graph
[legend]

List of all members.

Public Member Functions

def tzname
def utcoffset
def dst
def fromutc
def __reduce__

Static Private Attributes

tuple __slots__ = ()

Detailed Description

Abstract base class for time zone info classes.

Subclasses must override the name(), utcoffset() and dst() methods.

Definition at line 924 of file datetime.py.


Member Function Documentation

Definition at line 975 of file datetime.py.

00975 
00976     def __reduce__(self):
00977         getinitargs = getattr(self, "__getinitargs__", None)
00978         if getinitargs:
00979             args = getinitargs()
00980         else:
00981             args = ()
00982         getstate = getattr(self, "__getstate__", None)
00983         if getstate:
00984             state = getstate()
00985         else:
00986             state = getattr(self, "__dict__", None) or None
00987         if state is None:
00988             return (self.__class__, args)
00989         else:
00990             return (self.__class__, args, state)

Here is the call graph for this function:

def datetime.tzinfo.dst (   self,
  dt 
)
datetime -> DST offset in minutes east of UTC.

Return 0 if DST not in effect.  utcoffset() must include the DST
offset.

Reimplemented in test.datetimetester.USTimeZone, datetime.timezone, tzinfo-examples.USTimeZone, test.datetimetester.FixedOffset, tzinfo-examples.LocalTimezone, tzinfo-examples.FixedOffset, and tzinfo-examples.UTC.

Definition at line 938 of file datetime.py.

00938 
00939     def dst(self, dt):
00940         """datetime -> DST offset in minutes east of UTC.
00941 
00942         Return 0 if DST not in effect.  utcoffset() must include the DST
00943         offset.
00944         """
00945         raise NotImplementedError("tzinfo subclass must override dst()")

Here is the caller graph for this function:

def datetime.tzinfo.fromutc (   self,
  dt 
)

Reimplemented in datetime.timezone.

Definition at line 946 of file datetime.py.

00946 
00947     def fromutc(self, dt):
00948         "datetime in UTC -> datetime in local time."
00949 
00950         if not isinstance(dt, datetime):
00951             raise TypeError("fromutc() requires a datetime argument")
00952         if dt.tzinfo is not self:
00953             raise ValueError("dt.tzinfo is not self")
00954 
00955         dtoff = dt.utcoffset()
00956         if dtoff is None:
00957             raise ValueError("fromutc() requires a non-None utcoffset() "
00958                              "result")
00959 
00960         # See the long comment block at the end of this file for an
00961         # explanation of this algorithm.
00962         dtdst = dt.dst()
00963         if dtdst is None:
00964             raise ValueError("fromutc() requires a non-None dst() result")
00965         delta = dtoff - dtdst
00966         if delta:
00967             dt += delta
00968             dtdst = dt.dst()
00969             if dtdst is None:
00970                 raise ValueError("fromutc(): dt.dst gave inconsistent "
00971                                  "results; cannot convert")
00972         return dt + dtdst

def datetime.tzinfo.tzname (   self,
  dt 
)

Reimplemented in test.datetimetester.USTimeZone, datetime.timezone, tzinfo-examples.USTimeZone, test.datetimetester.FixedOffset, tzinfo-examples.LocalTimezone, tzinfo-examples.FixedOffset, and tzinfo-examples.UTC.

Definition at line 930 of file datetime.py.

00930 
00931     def tzname(self, dt):
00932         "datetime -> string name of time zone."
00933         raise NotImplementedError("tzinfo subclass must override tzname()")

Here is the caller graph for this function:

def datetime.tzinfo.utcoffset (   self,
  dt 
)

Reimplemented in test.datetimetester.USTimeZone, datetime.timezone, tzinfo-examples.USTimeZone, test.datetimetester.FixedOffset, tzinfo-examples.LocalTimezone, tzinfo-examples.FixedOffset, and tzinfo-examples.UTC.

Definition at line 934 of file datetime.py.

00934 
00935     def utcoffset(self, dt):
00936         "datetime -> minutes east of UTC (negative for west of UTC)"
00937         raise NotImplementedError("tzinfo subclass must override utcoffset()")

Here is the caller graph for this function:


Member Data Documentation

tuple datetime.tzinfo.__slots__ = () [static, private]

Reimplemented in datetime.timezone.

Definition at line 929 of file datetime.py.


The documentation for this class was generated from the following file: