HOME


Mini Shell 1.0
Redirecting to https://devs.lapieza.net/iniciar-sesion Redirecting to https://devs.lapieza.net/iniciar-sesion.
DIR: /proc/self/root/usr/lib/python3/dist-packages/pyrfc3339/__pycache__/
Upload File :
Current File : //proc/self/root/usr/lib/python3/dist-packages/pyrfc3339/__pycache__/generator.cpython-311.pyc
�

i�	[z��&�ddlZddlmZmZdd�ZdS)�N)�timezone�timedelta_secondsTFc���|j�G|dur4|dur!|�tj���}nt	d���t	d���|dur|�tj��}|�d��}|dur||�d��z
}|jtjur|dz
}n7|tt|j�	|������z
}|S)	a
    Generate an :RFC:`3339`-formatted timestamp from a
    :class:`datetime.datetime`.

    >>> from datetime import datetime
    >>> generate(datetime(2009,1,1,12,59,59,0,pytz.utc))
    '2009-01-01T12:59:59Z'

    The timestamp will use UTC unless `utc=False` is specified, in which case
    it will use the timezone from the :class:`datetime.datetime`'s
    :attr:`tzinfo` parameter.

    >>> eastern = pytz.timezone('US/Eastern')
    >>> dt = eastern.localize(datetime(2009,1,1,12,59,59))
    >>> generate(dt)
    '2009-01-01T17:59:59Z'
    >>> generate(dt, utc=False)
    '2009-01-01T12:59:59-05:00'

    Unless `accept_naive=True` is specified, the `datetime` must not be naive.

    >>> generate(datetime(2009,1,1,12,59,59,0))
    Traceback (most recent call last):
    ...
    ValueError: naive datetime and accept_naive is False

    >>> generate(datetime(2009,1,1,12,59,59,0), accept_naive=True)
    '2009-01-01T12:59:59Z'

    If `accept_naive=True` is specified, the `datetime` is assumed to be UTC.
    Attempting to generate a local timestamp from a naive datetime will result
    in an error.

    >>> generate(datetime(2009,1,1,12,59,59,0), accept_naive=True, utc=False)
    Traceback (most recent call last):
    ...
    ValueError: cannot generate a local timestamp from a naive datetime

    NT)�tzinfoz7cannot generate a local timestamp from a naive datetimez(naive datetime and accept_naive is Falsez%Y-%m-%dT%H:%M:%Sz.%f�Z)
r�replace�pytz�utc�
ValueError�
astimezone�strftimerr�	utcoffset)�dtr
�accept_naive�microseconds�	timestamps     �5/usr/lib/python3/dist-packages/pyrfc3339/generator.py�generaters���P
�y���4����d�{�{��Z�Z�t�x�Z�0�0��� �"4�5�5�5��G�H�H�H�
�d�{�{�
�]�]�4�8�
$�
$�����/�0�0�I��t����R�[�[��'�'�'�	�	�y�D�H����S��	�	��X�/��	�0C�0C�B�0G�0G�H�H�I�I�I�	���)TFF)r	�pyrfc3339.utilsrrr�rr�<module>rsD������7�7�7�7�7�7�7�7�=�=�=�=�=�=r