HEX
Server: LiteSpeed
System: Linux us-phx-web1284.main-hosting.eu 4.18.0-553.109.1.lve.el8.x86_64 #1 SMP Thu Mar 5 20:23:46 UTC 2026 x86_64
User: u300739242 (300739242)
PHP: 8.2.30
Disabled: system, shell_exec, passthru, mysql_list_dbs, ini_alter, dl, symlink, link, chgrp, leak, popen, apache_child_terminate, virtual, mb_send_mail
Upload Files
File: //opt/alt/python37/lib/python3.7/site-packages/jsons/__pycache__/_datetime_impl.cpython-37.pyc
B

�P�e��@s�dZddlmZmZmZmZmZddlmZdZdZ	d�
ee	�Zefeeefee
eed�dd	�Zeeeefe
ed
�dd�Zeeed
�dd�Zee
ed
�dd�Zeed�dd�Zeeed
�dd�Zeeed
�dd�Zeeeed�dd�ZdS)zw
PRIVATE MODULE: do not import (from) it directly.

This module contains functionality for ``datetime`` related stuff.
�)�datetime�timezone�	timedelta�time�date)�Unionz%Y-%m-%dz%H:%M:%Sz{}T{})�dt�strip_microseconds�	fork_inst�pattern�returncCs4t||�}|s"t|dd�r"|d7}|�d�||��S)N�microsecondz.%fz{}{})�get_offset_str�getattr�strftime�format)rr	r
r�offset�r�E/opt/alt/python37/lib/python3.7/site-packages/jsons/_datetime_impl.py�to_strs
r)�objr
rcCs0d}t|t�rt||�}nt|t�r,t|�}|S)z�
    Return the textual offset of the given ``obj``.
    :param obj: a datetime or timedelta instance.
    :param fork_inst: the state holder that is used.
    :return: the offset following RFC3339.
    �)�
isinstancer�_datetime_offset_strr�_timedelta_offset_str)rr
�resultrrrrs	

r)rrrcCs<|ddkrt||�}n d|kr,t||�}nt�||�}|S)z�
    Return a datetime instance with timezone info from the given ``obj``.
    :param obj: the ``obj`` in RFC3339 format.
    :param pattern: the datetime pattern.
    :return: a datetime instance with timezone info.
    ����Z�T)�_datetime_utc_inst�_datetime_offset_instr�strptime)rrrrrr�get_datetime_inst+sr"cCs||j}|sB|�dd�t�tj���j}|tjks>|jtjkrBdSd}|�d�dkrx|�d�pnt	|d|�|��}t
|�}|S)z�
    Return a textual offset (e.g. +01:00 or Z) for the given datetime.
    :param obj: the datetime instance.
    :return: the offset for ``obj``.
    zUThe use of datetimes without timezone is dangerous and can lead to undesired results.zdatetime-without-tzz+00:00rN)�UTCz	UTC+00:00Zadjusted_offset)�tzinfo�_warnr�nowr�utc�
astimezone�tzname�	utcoffsetrr)rr
Ztzoner�tdeltarrrr;s
r)r+rcCsZ|��}t|d�}t|dd�}tt|�t|��}|dkrBdnd}|�d�|��}|S)z�
    Return a textual offset (e.g. +01:00 or Z) for the given timedelta.
    :param tdelta: the timedelta instance.
    :return: the offset for ``tdelta``.
    i�<r�+�-z{}%H:%M)�
total_seconds�intr�absrr)r+Zoffset_sZoffset_hZoffset_mZoffset_t�operatorrrrrrRsrcCs.|dd�}t�||�}t|��|��tj�S)z�
    Return a datetime instance with UTC timezone info.
    :param obj: a datetime in RFC3339 format.
    :param pattern: the datetime pattern that is used.
    :return: a datetime instance with timezone info.
    rr)rr!�
_new_datetimerrrr')rrZ
dattim_str�
dattim_objrrrrasrcCs�|�d�\}}d|krdnd\}}|�|�\}}d�||�}t�||�}	|�d�\}
}t|
�|}t|�|}
tt||
d�d�}t|	��|	�	�|�S)	z�
    Return a datetime instance with timezone info.
    :param obj: a datetime in RFC3339 format.
    :param pattern: the datetime pattern that is used.
    :return: a datetime instance with timezone info.
    rr-)r-�)r.rz{}T{}�:)�hours�minutes)r)
�splitrrr!r0rrr3rr)rrZdat_strZtim_strZsplitter�factorZ
naive_tim_strrZnaive_dattim_strr4Zhrs_strZmins_strZhrsZmins�tzrrrr msr )�	date_inst�	time_instr$rcCst�||�j|d�S)a@
    Return a datetime instance from a date, time and timezone.

    This function was required due to the missing argument for tzinfo under the
    Linux Python distribution.
    :param date_inst: the date.
    :param time_inst: the time.
    :param tzinfo: the Timezone.
    :return: a combined datetime instance.
    )r$)r�combine�replace)r<r=r$rrrr3�sr3N)�__doc__rrrrr�typingrZRFC3339_DATE_PATTERNZRFC3339_TIME_PATTERNrZRFC3339_DATETIME_PATTERN�bool�type�strrrr"rrrr r3rrrr�<module>s "