Ϫfw pdZddlmZmZmZmZddlm Z ddgZ GddeZ e jdddZ y) z Time zone utilities. )datetime timedeltatimezonetzinfo)OptionalFixedOffsetTimeZoneUTCc eZdZdZddedeeddfdZedede d e ddfd Z ed e ddfd Z d ee defdZd ee defdZd ee defdZy)ra* Represents a fixed timezone offset (without daylight saving time). @ivar name: A L{str} giving the name of this timezone; the name just includes how much time this offset represents. @ivar offset: A L{TimeDelta} giving the amount of time this timezone is offset. Noffsetnamereturnc ||_||_y)z Construct a L{FixedOffsetTimeZone} with a fixed offset. @param offset: a delta representing the offset from UTC. @param name: A name to be given for this timezone. N)r r )selfr r s :/usr/lib/python3/dist-packages/twisted/python/_tzhelper.py__init__zFixedOffsetTimeZone.__init__"s  signhoursminutescxd|||fz}|dk(r| }| }n|dk7rtd||t|||S)a  Construct a L{FixedOffsetTimeZone} from an offset described by sign ('+' or '-'), hours, and minutes. @note: For protocol compatibility with AMP, this method never uses 'Z' @param sign: A string describing the positive or negative-ness of the offset. @param hours: The number of hours in the offset. @param minutes: The number of minutes in the offset @return: A time zone with the given offset, and a name describing the offset. z %s%02i:%02i-+zInvalid sign for timezone )rr) ValueError TimeDelta)clsrrrr s rfromSignHoursMinutesz(FixedOffsetTimeZone.fromSignHoursMinutes,sX$eW55 3;FEhG S[9$BC C95':DAAr timeStampctj|tj|tjj dz }||S)z Create a time zone with a fixed offset corresponding to a time stamp in the system's locally configured time zone. N)r)DateTime fromtimestamprutcreplace)rrr s rfromLocalTimeStampz&FixedOffsetTimeZone.fromLocalTimeStampFsG '' 2X5K5K x||6 '' 6{rdtc|jS)z> Return the given timezone's offset from UTC. )r rr$s r utcoffsetzFixedOffsetTimeZone.utcoffsetQs{{rctdS)zs Return a zero L{TimeDelta} for the daylight saving time offset, since there is never one. r)rr&s rdstzFixedOffsetTimeZone.dstWs |rc|j |jStjd|}|jdS)z; Return a string describing this timezone. rzUTC%z)r rr strftimer&s rtznamezFixedOffsetTimeZone.tzname^s9 99 99   # #At ,{{7##r)N)__name__ __module__ __qualname____doc__rrstrr classmethodintrfloatr#rr'r)r,rrrrsy BB"B-0B BB255JHX.9 hx(Y$(+$$rrN)r0rrrrrrTZInfotypingr__all__rrr r5rrr9sM     O$&O$d..sAq9r