ok

Mini Shell

Direktori : /lib/python3.6/site-packages/pyrfc3339/__pycache__/
Upload File :
Current File : //lib/python3.6/site-packages/pyrfc3339/__pycache__/generator.cpython-36.pyc

3

i�	[z�@s&ddlZddlmZmZddd�ZdS)�N)�timezone�timedelta_secondsTFcCs�|jdkr<|dkr4|dkr*|jtjd�}q<td
��ntd��|dkrP|jtj�}|jd�}|dkrp||jd�7}|jtjkr�|d	7}n|tt|jj	|���7}|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)�tzinfoz'cannot generate a local timestamp from za naive datetimez(naive datetime and accept_naive is Falsez%Y-%m-%dT%H:%M:%Sz.%f�Zz7cannot generate a local timestamp from a naive datetime)
r�replace�pytz�utc�
ValueErrorZ
astimezoneZstrftimerrZ	utcoffset)ZdtrZaccept_naiveZmicrosecondsZ	timestamp�r
�/usr/lib/python3.6/generator.py�generates (


r)TFF)rZpyrfc3339.utilsrrrr
r
r
r�<module>s

Zerion Mini Shell 1.0