Back to index

python3.2  3.2.2
Public Member Functions | Public Attributes
test.datetimetester.USTimeZone Class Reference
Inheritance diagram for test.datetimetester.USTimeZone:
Inheritance graph
[legend]
Collaboration diagram for test.datetimetester.USTimeZone:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def __init__
def __repr__
def tzname
def utcoffset
def dst
def fromutc
def __reduce__

Public Attributes

 stdoffset
 reprname
 stdname
 dstname

Detailed Description

Definition at line 3332 of file datetimetester.py.


Constructor & Destructor Documentation

def test.datetimetester.USTimeZone.__init__ (   self,
  hours,
  reprname,
  stdname,
  dstname 
)

Definition at line 3334 of file datetimetester.py.

03334 
03335     def __init__(self, hours, reprname, stdname, dstname):
03336         self.stdoffset = timedelta(hours=hours)
03337         self.reprname = reprname
03338         self.stdname = stdname
03339         self.dstname = dstname

Here is the caller graph for this function:


Member Function Documentation

def datetime.tzinfo.__reduce__ (   self) [inherited]

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:

Definition at line 3340 of file datetimetester.py.

03340 
03341     def __repr__(self):
03342         return self.reprname

def test.datetimetester.USTimeZone.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 from datetime.tzinfo.

Definition at line 3352 of file datetimetester.py.

03352 
03353     def dst(self, dt):
03354         if dt is None or dt.tzinfo is None:
03355             # An exception instead may be sensible here, in one or more of
03356             # the cases.
03357             return ZERO
03358         assert dt.tzinfo is self
03359 
03360         # Find first Sunday in April.
03361         start = first_sunday_on_or_after(DSTSTART.replace(year=dt.year))
03362         assert start.weekday() == 6 and start.month == 4 and start.day <= 7
03363 
03364         # Find last Sunday in October.
03365         end = first_sunday_on_or_after(DSTEND.replace(year=dt.year))
03366         assert end.weekday() == 6 and end.month == 10 and end.day >= 25
03367 
03368         # Can't compare naive to aware objects, so strip the timezone from
03369         # dt first.
03370         if start <= dt.replace(tzinfo=None) < end:
03371             return HOUR
03372         else:
03373             return ZERO

Here is the call graph for this function:

def datetime.tzinfo.fromutc (   self,
  dt 
) [inherited]

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 test.datetimetester.USTimeZone.tzname (   self,
  dt 
)

Reimplemented from datetime.tzinfo.

Definition at line 3343 of file datetimetester.py.

03343 
03344     def tzname(self, dt):
03345         if self.dst(dt):
03346             return self.dstname
03347         else:
03348             return self.stdname

Here is the call graph for this function:

def test.datetimetester.USTimeZone.utcoffset (   self,
  dt 
)

Reimplemented from datetime.tzinfo.

Definition at line 3349 of file datetimetester.py.

03349 
03350     def utcoffset(self, dt):
03351         return self.stdoffset + self.dst(dt)

Here is the call graph for this function:


Member Data Documentation

Definition at line 3338 of file datetimetester.py.

Definition at line 3336 of file datetimetester.py.

Definition at line 3337 of file datetimetester.py.

Definition at line 3335 of file datetimetester.py.


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