Current File : //proc/self/root/lib/python3/dist-packages/pyrfc3339/__pycache__/utils.cpython-312.pyc
�

ƺ[Q
��N�ddlmZddlmZmZddlmZGd�de�Zd�Zd�Z	y)	�)�division)�	timedelta�tzinfo)�deepcopyc�4�eZdZdZd�Zd�Zd�Zd�Zd�Zd�Z	y)	�FixedOffseta�
    Represent a timezone with a fixed offset from UTC and no adjustment for
    DST.

    >>> FixedOffset(4,0)
    <UTC+04:00>
    >>> FixedOffset(-4,0)
    <UTC-04:00>
    >>> FixedOffset(4,30)
    <UTC+04: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)
    <UTC-09: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)
    <UTC-08:30>

    c���tj|�|dkrtd��|dkr|dz}t||��|_dtt
|j��z|_y)zK
        Create a new FixedOffset instance with the given offset.

        rzminutes must not be negative���)�hours�minutes�UTCN)r�__init__�
ValueErrorr�_FixedOffset__offset�timezone�timedelta_seconds�_FixedOffset__name)�selfrrs   �1/usr/lib/python3/dist-packages/pyrfc3339/utils.pyrzFixedOffset.__init__(s_��
	������Q�;��;�<�<��1�9��r�M�G�!��*1�3��
��h�'8����'G�H�H���c��td�S)zG
        Return offset for DST.  Always returns timedelta(0).

        r)r�r�dts  r�dstzFixedOffset.dst6s��
��|�rc��|jS)z*
        Return offset from UTC.

        )rrs  r�	utcoffsetzFixedOffset.utcoffset=s��
�}�}�rc��|jS)z+
        Return name of timezone.

        )rrs  r�tznamezFixedOffset.tznameDs��
�{�{�rc�B�dj|jd��S)Nz<{0}>)�formatr)rs r�__repr__zFixedOffset.__repr__Ks���~�~�d�k�k�$�/�0�0rc	���|j}|j|�}||t|�<|jj	�D]\}}t||t
||���|S)N)�	__class__�__new__�id�__dict__�items�setattrr)r�memo�cls�result�k�vs      r�__deepcopy__zFixedOffset.__deepcopy__Ns^���n�n�����S�!����R��X���M�M�'�'�)�	2�D�A�q��F�A�x��4�0�1�	2��
rN)
�__name__�
__module__�__qualname__�__doc__rrrrr!r.�rrrrs'���@I����1�rrc���	tt|j���S#t$rG|j}|j
}|j}tt|dz|z|dzz��cYSwxYw)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() <datetime.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

    i�Qi@B)�int�round�
total_seconds�AttributeError�days�seconds�microseconds)�tdr9r:r;s    rrrWsp��2O��5��)�)�+�,�-�-���O��w�w���*�*�������5�$��,�'�1�\�G�5K�L�M�N�N�O�s�!$�A
A4�3A4c��tt|�d�\}}tt|�dz�}|dk\rd}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})�divmod�absr6�floatr r5)rrr:r�signs     rrrzsY���C�	�N�D�1�N�E�7��E�'�N�R�'�(�G��A�~������&�&�t�S��Z��W��F�FrN)
�
__future__r�datetimerr�copyrrrrr3rr�<module>rHs*���&��M�&�M�` O�FGr