HEX
Server: Apache/2.4.52 (Ubuntu)
System: Linux spn-python 5.15.0-89-generic #99-Ubuntu SMP Mon Oct 30 20:42:41 UTC 2023 x86_64
User: arjun (1000)
PHP: 8.1.2-1ubuntu2.20
Disabled: NONE
Upload Files
File: //lib/python3/dist-packages/twisted/python/__pycache__/_tzhelper.cpython-312.pyc
�

�b8��l�dZddlmZmZmZddlmZddgZ	Gd�de�Z
e
jddd�Zy)	z
Time zone utilities.
�)�datetime�	timedelta�tzinfo)�Optional�FixedOffsetTimeZone�UTCc	��eZdZdZddedeeddfd�Zedede	d	e	ddfd
��Z
ededdfd��Zd
ee
defd�Zd
ee
defd�Zd
ee
defd�Zy)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.
    N�offset�name�returnc� �||_||_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
rs   �:/usr/lib/python3/dist-packages/twisted/python/_tzhelper.py�__init__zFixedOffsetTimeZone.__init__s�������	��sign�hours�minutesc�x�d|||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)�clsrrrrs     r�fromSignHoursMinutesz(FixedOffsetTimeZone.fromSignHoursMinutes'sX��$��e�W�5�5���3�;��F�E��h�G�
�S�[��9�$��B�C�C��9�5�'�:�D�A�Ar�	timeStampc�h�tj|�tj|�z
}||�S)z�
        Create a time zone with a fixed offset corresponding to a time stamp in
        the system's locally configured time zone.
        )�DateTime�
fromtimestamp�utcfromtimestamp)rrr
s   r�fromLocalTimeStampz&FixedOffsetTimeZone.fromLocalTimeStampAs5���'�'�	�2�X�5N�5N��6
�
���6�{�r�dtc��|jS)z>
        Return the given timezone's offset from UTC.
        )r
�rr"s  r�	utcoffsetzFixedOffsetTimeZone.utcoffsetLs���{�{�rc��td�S)zs
        Return a zero L{TimeDelta} for the daylight saving time
        offset, since there is never one.
        r)rr$s  r�dstzFixedOffsetTimeZone.dstRs��
��|�rc��|j�|jStjd|�}|jd�S)z;
        Return a string describing this timezone.
        rzUTC%z)rrr�strftimer$s  r�tznamezFixedOffsetTimeZone.tznameYs9���9�9� ��9�9��
�
#�
#�A�t�
,���{�{�7�#�#r)N)�__name__�
__module__�__qualname__�__doc__rr�strr�classmethod�intr�floatr!rr%r'r*�rrrrs�����y����
�����B��B�"�B�-0�B�	�B��B�2��5��5J�����H�X�.��9���h�x�(��Y��$��(�+�$��$rrN)
r.rrrrr�TZInfo�typingr�__all__rrrr3rr�<module>r7sJ��
�T�S���	���O$�&�O$�d�.�.�s�A�q�9�r