U
    
W[x                     @   sB   d Z ddlmZmZmZ ddgZG dd deZedddZdS )z
Time zone utilities.
    )datetime	timedeltatzinfoFixedOffsetTimeZoneUTCc                   @   sJ   e Zd ZdZdddZedd Zedd Zd	d
 Zdd Z	dd Z
dS )r   a*  
    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.
    Nc                 C   s   || _ || _dS )a  
        Construct a L{FixedOffsetTimeZone} with a fixed offset.

        @param offset: a delta representing the offset from UTC.
        @type offset: L{timedelta}

        @param name: A name to be given for this timezone.
        @type name: L{str} or L{None}
        N)offsetname)selfr   r    r
   :/usr/lib/python3/dist-packages/twisted/python/_tzhelper.py__init__   s    
zFixedOffsetTimeZone.__init__c                 C   sL   d|||f }|dkr$| }| }n|dkr:t d|f | t||d|S )am  
        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.
        @type hours: L{int}

        @param minutes: The number of minutes in the offset
        @type minutes: L{int}

        @return: A time zone with the given offset, and a name describing the
            offset.
        @rtype: L{FixedOffsetTimeZone}
        z%s%02i:%02i-+zInvalid sign for timezone %r)hoursminutes)
ValueErrorr   )clsZsignr   r   r   r
   r
   r   fromSignHoursMinutes+   s    z(FixedOffsetTimeZone.fromSignHoursMinutesc                 C   s   t |t | }| |S )a  
        Create a time zone with a fixed offset corresponding to a time stamp in
        the system's locally configured time zone.

        @param timeStamp: a time stamp
        @type timeStamp: L{int}

        @return: a time zone
        @rtype: L{FixedOffsetTimeZone}
        )r   fromtimestampZutcfromtimestamp)r   Z	timeStampr   r
   r
   r   fromLocalTimeStampI   s
    z&FixedOffsetTimeZone.fromLocalTimeStampc                 C   s   | j S )z9
        Return this timezone's offset from UTC.
        )r   r	   Zdtr
   r
   r   	utcoffset\   s    zFixedOffsetTimeZone.utcoffsetc                 C   s   t dS )z|
        Return a zero C{datetime.timedelta} for the daylight saving time
        offset, since there is never one.
        r   )r   r   r
   r
   r   dstc   s    zFixedOffsetTimeZone.dstc                 C   s&   | j dk	r| j S td| }|dS )z;
        Return a string describing this timezone.
        Nr   zUTC%z)r   r   r   strftimer   r
   r
   r   tznamek   s    
zFixedOffsetTimeZone.tzname)N)__name__
__module____qualname____doc__r   classmethodr   r   r   r   r   r
   r
   r
   r   r      s   



r   N)r   r   r   r   __all__r   r   r   r
   r
   r
   r   <module>   s   e