;ς Σ±bFc@sdZdklZlZlZdklZdklZdkZgZ hZ d„Z ei dƒZ hde (sselfszone(sself((s?/mnt/gmirror/ports/devel/py-pytz/work/pytz-2007f/pytz/tzinfo.pys__repr__cscCsti|iffSdS(N(spytzs_psselfszone(sself((s?/mnt/gmirror/ports/devel/py-pytz/work/pytz-2007f/pytz/tzinfo.pys __reduce__fs( s__name__s __module__s__doc__sfromutcs utcoffsetsdststznamesFalseslocalizes normalizes__repr__s __reduce__(((s?/mnt/gmirror/ports/devel/py-pytz/work/pytz-2007f/pytz/tzinfo.pys StaticTzInfoAs        s DstTzInfocBs†tZdZeZeZeZeZeZeed„Z d„Z d„Z e d„Z d„Zd„Zd„Zd„Zd „ZRS( sΰA timezone that has a variable offset from UTC The offset might change if daylight savings time comes into effect, or at a point in history when the region decides to change their timezone definition. cCs²|o%||_|\|_|_|_nƒh}||_|id\|_|_|_|||id>> from pytz import timezone >>> utc = timezone('UTC') >>> eastern = timezone('US/Eastern') >>> fmt = '%Y-%m-%d %H:%M:%S %Z (%z)' We next create a datetime right on an end-of-DST transition point, the instant when the wallclocks are wound back one hour. >>> utc_dt = datetime(2002, 10, 27, 6, 0, 0, tzinfo=utc) >>> loc_dt = utc_dt.astimezone(eastern) >>> loc_dt.strftime(fmt) '2002-10-27 01:00:00 EST (-0500)' Now, if we subtract a few minutes from it, note that the timezone information has not changed. >>> before = loc_dt - timedelta(minutes=10) >>> before.strftime(fmt) '2002-10-27 00:50:00 EST (-0500)' But we can fix that by calling the normalize method >>> before = eastern.normalize(before) >>> before.strftime(fmt) '2002-10-27 01:50:00 EDT (-0400)' sNaive time - no tzinfo setstzinfoN( sdtstzinfosNones ValueErrors _utcoffsetsoffsetsreplacesselfsfromutc(sselfsdtsoffset((s?/mnt/gmirror/ports/devel/py-pytz/work/pytz-2007f/pytz/tzinfo.pys normalize’s#   c Csk|itj o td‚ntƒ}x\|iiƒD]K}|i |i d|ƒƒ} | i dtƒ|jo|i | ƒq6q6Wt |ƒdjo|iƒSn|tjot|ƒ‚ngi}|D]-}t|iiƒ|jo||ƒqΡqΡ~}t |ƒdjo |dSnt |ƒdjot|ƒ}nd„}|i|ƒ|dSdS(sZConvert naive time to local time. This method should be used to construct localtimes, rather than passing a tzinfo argument to a datetime constructor. is_dst is used to determine the correct timezone in the ambigous period at the end of daylight savings time. >>> from pytz import timezone >>> fmt = '%Y-%m-%d %H:%M:%S %Z (%z)' >>> amdam = timezone('Europe/Amsterdam') >>> dt = datetime(2004, 10, 31, 2, 0, 0) >>> loc_dt1 = amdam.localize(dt, is_dst=True) >>> loc_dt2 = amdam.localize(dt, is_dst=False) >>> loc_dt1.strftime(fmt) '2004-10-31 02:00:00 CEST (+0200)' >>> loc_dt2.strftime(fmt) '2004-10-31 02:00:00 CET (+0100)' >>> str(loc_dt2 - loc_dt1) '1:00:00' Use is_dst=None to raise an AmbiguousTimeError for ambiguous times at the end of daylight savings >>> try: ... loc_dt1 = amdam.localize(dt, is_dst=None) ... except AmbiguousTimeError: ... print 'Oops' Oops >>> loc_dt1 = amdam.localize(dt, is_dst=None) Traceback (most recent call last): [...] AmbiguousTimeError: 2004-10-31 02:00:00 is_dst defaults to False >>> amdam.localize(dt) == amdam.localize(dt, False) True s*Not naive datetime (tzinfo is already set)stzinfoiicCs=t|idtƒ|ii|idtƒ|iiƒSdS(Nstzinfo(scmpsasreplacesNonestzinfos _utcoffsetsb(sasb((s?/mnt/gmirror/ports/devel/py-pytz/work/pytz-2007f/pytz/tzinfo.pysmycmpsN(sdtstzinfosNones ValueErrorsSetspossible_loc_dtsselfs_tzinfossvaluess normalizesreplacesloc_dtsaddslenspopsis_dstsAmbiguousTimeErrorsappends_[1]spsbools_dstsfiltered_possible_loc_dtslistsmycmpssort( sselfsdtsis_dstspossible_loc_dtsmycmpsfiltered_possible_loc_dts_[1]spstzinfosloc_dt((s?/mnt/gmirror/ports/devel/py-pytz/work/pytz-2007f/pytz/tzinfo.pyslocalizeΐs*)   D   cCs |iSdS(sSee datetime.tzinfo.utcoffsetN(sselfs _utcoffset(sselfsdt((s?/mnt/gmirror/ports/devel/py-pytz/work/pytz-2007f/pytz/tzinfo.pys utcoffsetscCs |iSdS(sSee datetime.tzinfo.dstN(sselfs_dst(sselfsdt((s?/mnt/gmirror/ports/devel/py-pytz/work/pytz-2007f/pytz/tzinfo.pysdst!scCs |iSdS(sSee datetime.tzinfo.tznameN(sselfs_tzname(sselfsdt((s?/mnt/gmirror/ports/devel/py-pytz/work/pytz-2007f/pytz/tzinfo.pystzname%scCsl|io d}nd}|itjo!d|i|i|i|fSnd|i|i|i|fSdS(NsDSTsSTDss(sselfs_dstsdsts _utcoffsets_notimeszones_tzname(sselfsdst((s?/mnt/gmirror/ports/devel/py-pytz/work/pytz-2007f/pytz/tzinfo.pys__repr__)s   !cCs5ti|it|iƒt|iƒ|iffSdS(N(spytzs_psselfszones _to_secondss _utcoffsets_dsts_tzname(sself((s?/mnt/gmirror/ports/devel/py-pytz/work/pytz-2007f/pytz/tzinfo.pys __reduce__7s(s__name__s __module__s__doc__sNones_utc_transition_timess_transition_infoszones_tzinfoss_dsts__init__sfromutcs normalizesFalseslocalizes utcoffsetsdststznames__repr__s __reduce__(((s?/mnt/gmirror/ports/devel/py-pytz/work/pytz-2007f/pytz/tzinfo.pys DstTzInfols   . ]    sAmbiguousTimeErrorcBstZdZRS(sXException raised when attempting to create an ambiguous wallclock time. At the end of a DST transition period, a particular wallclock time will occur twice (once before the clocks are set back, once after). Both possibilities may be correct, unless further information is supplied. See DstTzInfo.normalize() for more info (s__name__s __module__s__doc__(((s?/mnt/gmirror/ports/devel/py-pytz/work/pytz-2007f/pytz/tzinfo.pysAmbiguousTimeErrorBs cCsζti|ƒ}|tjo|Snt|ƒ}t|ƒ}y|i|||fSWnt j onXx?|ii ƒD].}|i |jo |i|jo|SqzqzW|||f}|i||iƒ|i|<|i|SdS(s)Factory function for unpickling pytz tzinfo instances. This is shared for both StaticTzInfo and DstTzInfo instances, because database changes could cause a zones implementation to switch between these two base classes and we can't break pickles on a pytz version upgrade. N(spytzstimezoneszonestzs utcoffsetsNonesmemorized_timedeltas dstoffsets_tzinfosstznamesKeyErrorsvaluess localized_tzs _utcoffsets_dstsinfs __class__(szones utcoffsets dstoffsetstznamestzs localized_tzsinf((s?/mnt/gmirror/ports/devel/py-pytz/work/pytz-2007f/pytz/tzinfo.pys unpicklerMs"     (s__doc__sdatetimes timedeltastzinfosbisects bisect_rightssetssSetspytzs__all__s_timedelta_cachesmemorized_timedeltasutcfromtimestamps_epochs_datetime_cachesmemorized_datetimes _ttinfo_cachesmemorized_ttinfos_notimes _to_secondss BaseTzInfos StaticTzInfos DstTzInfos ExceptionsAmbiguousTimeErrorsNones unpickler(s DstTzInfosdatetimes _ttinfo_cachesmemorized_timedeltas__all__s unpicklers_epochsmemorized_datetimestzinfos timedeltas _to_secondss_timedelta_cachespytzs bisect_rights_datetime_cachesmemorized_ttinfos BaseTzInfosSets StaticTzInfos_notimesAmbiguousTimeError((s?/mnt/gmirror/ports/devel/py-pytz/work/pytz-2007f/pytz/tzinfo.pys?s&        +Φ