HOME


Mini Shell 1.0
DIR: /snap/certbot/4557/lib64/python3.12/site-packages/pyrfc3339/__pycache__/
Upload File :
Current File : //snap/certbot/4557/lib64/python3.12/site-packages/pyrfc3339/__pycache__/parser.cpython-312.pyc
�

N�g�
��4�ddlZddlmZmZmZddlmZdd�Zy)�N)�datetime�	timedelta�timezone)�format_timezonec��tjdtjtjz�}|j	|�}|���|jd�dvr|durd}n�tj}n�|durtd��t|jd��}t|jd��}|d	kr|d
z}t||��}t
|dt|j���d
��}|jd�}	|	�d	}
n ttt|	�dz��}
tt|jd��t|jd��t|jd��t|jd��t|jd��t|jd��|
|��}|r|j!tj�}|Std��)a�
    Parse an :RFC:`3339`-formatted timestamp and return a
    :class:`datetime.datetime`.

    If the timestamp is presented in UTC, then the `tzinfo` parameter of the
    returned `datetime` will be set to :attr:`datetime.timezone.utc`.

    >>> parse('2009-01-01T10:01:02Z')
    datetime.datetime(2009, 1, 1, 10, 1, 2, tzinfo=datetime.timezone.utc)

    Otherwise, a :class:`datetime.timezone` instance is created with the appropriate offset, and
    the `tzinfo` parameter of the returned `datetime` is set to that value.

    >>> parse('2009-01-01T14:01:02-04:00')
    datetime.datetime(2009, 1, 1, 14, 1, 2, tzinfo=datetime.timezone(datetime.timedelta(days=-1, seconds=72000), '<UTC-04:00>'))

    However, if `parse()`  is called with `utc=True`, then the returned
    `datetime` will be normalized to UTC (and its tzinfo parameter set to
    `datetime.timezone.utc`), regardless of the input timezone.

    >>> parse('2009-01-01T06:01:02-04:00', utc=True)
    datetime.datetime(2009, 1, 1, 10, 1, 2, tzinfo=datetime.timezone.utc)

    The input is strictly required to conform to :RFC:`3339`, and appropriate
    exceptions are thrown for invalid input.

    >>> parse('2009-01-01T06:01:02')
    Traceback (most recent call last):
    ...
    ValueError: timestamp does not conform to RFC 3339

    >>> parse('2009-01-01T25:01:02Z')
    Traceback (most recent call last):
    ...
    ValueError: hour must be in 0..23

    aB^(?:(?:(?P<date_fullyear>[0-9]{4})\-(?P<date_month>[0-9]{2})\-(?P<date_mday>[0-9]{2}))T(?:(?:(?P<time_hour>[0-9]{2})\:(?P<time_minute>[0-9]{2})\:(?P<time_second>[0-9]{2})(?P<time_secfrac>(?:\.[0-9]{1,}))?)(?P<time_offset>(?:Z|(?P<time_numoffset>(?P<time_houroffset>(?:\+|\-)[0-9]{2})\:(?P<time_minuteoffset>[0-9]{2}))))))$N�time_offset)�Z�zz+00:00z-00:00Tz6cannot produce a naive datetime from a local timestamp�time_houroffset�time_minuteoffsetr���)�hours�minutesz<UTC�>�time_secfraci@B�
date_fullyear�
date_month�	date_mday�	time_hour�time_minute�time_second)�year�month�day�hour�minute�second�microsecond�tzinfoz&timestamp does not conform to RFC 3339)�re�compile�I�X�match�groupr�utc�
ValueError�intrr�
total_seconds�round�floatr�
astimezone)�	timestampr&�
produce_naive�parse_rer$r�tz_hours�
tz_minutes�td�secfracr�dt_outs            ��/build/snapcraft-certbot-2c33630aaf29c47357e5a1683f659d3d/parts/certbot/install/lib/python3.12/site-packages/pyrfc3339/parser.py�parser6s���N�z�z�	R�
���r�t�t���H�

�N�N�9�%�E����;�;�}�%�)G�G���$���!������$� �L����u�{�{�+<�=�>�� ����-@�!A�B�
��a�<��"�$�J��X�z�B��!�"��_�R�=M�=M�=O�-P�,Q�QR�&S�T���+�+�n�-���?��K��e�E�'�N�W�$<�=�>�K���U�[�[��1�2��e�k�k�,�/�0��E�K�K��,�-��U�[�[��-�.��u�{�{�=�1�2��u�{�{�=�1�2�#��	
����&�&�x�|�|�4�F��
��A�B�B�)FF)r rrr�pyrfc3339.utilsrr6�r7r5�<module>r:s��	�2�2�+�WCr7