3 ƺ[Q @sLddlmZddlmZmZddlmZGdddeZddZdd Z d S) )division) timedeltatzinfo)deepcopyc@s@eZdZdZddZddZddZdd Zd d Zd d Z dS) FixedOffseta Represent a timezone with a fixed offset from UTC and no adjustment for DST. >>> FixedOffset(4,0) >>> FixedOffset(-4,0) >>> FixedOffset(4,30) >>> tz = FixedOffset(-5,0) >>> tz.dst(None) datetime.timedelta(0) The class tries to do the right thing with the sign of the time zone offset: >>> FixedOffset(-9,30) >>> FixedOffset(-9,-30) Traceback (most recent call last): ... ValueError: minutes must not be negative Offsets must thus be normalized so that the minute value is positive: >>> FixedOffset(-8,30) cCsPtj||dkrtd|dkr*|d9}t||d|_dtt|j|_dS)zK Create a new FixedOffset instance with the given offset. rzminutes must not be negative)hoursminutesZUTCN)r__init__ ValueErrorr_FixedOffset__offsettimezonetimedelta_seconds_FixedOffset__name)selfrr r/usr/lib/python3.6/utils.pyr (s  zFixedOffset.__init__cCstdS)zG Return offset for DST. Always returns timedelta(0). r)r)rdtrrrdst6szFixedOffset.dstcCs|jS)z* Return offset from UTC. )r )rrrrr utcoffset=szFixedOffset.utcoffsetcCs|jS)z+ Return name of timezone. )r)rrrrrtznameDszFixedOffset.tznamecCsdj|jdS)Nz<{0}>)formatr)rrrr__repr__KszFixedOffset.__repr__cCsJ|j}|j|}||t|<x(|jjD]\}}t||t||q(W|S)N) __class____new__id__dict__itemssetattrr)rmemoclsresultkvrrr __deepcopy__Ns   zFixedOffset.__deepcopy__N) __name__ __module__ __qualname____doc__r rrrrr%rrrrrsrc CsTytt|jStk rN|j}|j}|j}tt|d||dSXdS)a Return the offset stored by a :class:`datetime.timedelta` object as an integer number of seconds. Microseconds, if present, are rounded to the nearest second. Delegates to :meth:`timedelta.total_seconds() ` if available. >>> timedelta_seconds(timedelta(hours=1)) 3600 >>> timedelta_seconds(timedelta(hours=-1)) -3600 >>> timedelta_seconds(timedelta(hours=1, minutes=30)) 5400 >>> timedelta_seconds(timedelta(hours=1, minutes=30, ... microseconds=300000)) 5400 >>> timedelta_seconds(timedelta(hours=1, minutes=30, ... microseconds=900000)) 5401 iQi@BN)introundZ total_secondsAttributeErrordaysseconds microseconds)Ztdr-r.r/rrrrWsrcCsJtt|d\}}tt|d}|dkr0d}nd}dj|t|t|S)z Return a string representing the timezone offset. Remaining seconds are rounded to the nearest minute. >>> timezone(3600) '+01:00' >>> timezone(5400) '+01:30' >>> timezone(-28800) '-08:00' i<r+-z{0}{1:02d}:{2:02d})divmodabsr+floatrr*)rrr.r Zsignrrrrzs rN) Z __future__rZdatetimerrcopyrrrrrrrrs  P#