Server : LiteSpeed
System : Linux server51.dnsbootclub.com 4.18.0-553.62.1.lve.el8.x86_64 #1 SMP Mon Jul 21 17:50:35 UTC 2025 x86_64
User : nandedex ( 1060)
PHP Version : 8.1.33
Disable Function : NONE
Directory :  /opt/cppython/lib/python3.8/site-packages/proto/marshal/rules/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]


Current File : //opt/cppython/lib/python3.8/site-packages/proto/marshal/rules/__pycache__/dates.cpython-38.pyc
U

O��g?�@slddlmZddlmZddlmZddlmZddlmZddlmZmZGdd�d�Z	Gd	d
�d
�Z
dS)�)�datetime)�	timedelta)�timezone)�duration_pb2)�
timestamp_pb2)�datetime_helpers�utilsc@s8eZdZdZdd�eejd�dd�Zej	d�dd	�Z
dS)
�
TimestampRulea&A marshal between Python datetimes and protobuf timestamps.

    Note: Python datetimes are less precise than protobuf datetimes
    (microsecond vs. nanosecond level precision). If nanosecond-level
    precision matters, it is recommended to interact with the internal
    proto directly.
    N��absent�r�returncCs$t|tj�r |rdStj�|�S|S)N)�
isinstancer�	Timestampr�DatetimeWithNanosecondsZfrom_timestamp_pb��self�valuer�r�F/opt/cppython/lib/python3.8/site-packages/proto/marshal/rules/dates.py�	to_python!s
zTimestampRule.to_python�r
cCs`t|tj�r|��St|t�r:tjt|���|j	dd�St|t
�r\t��}|j|d�|S|S)N����seconds�nanos�r)rrrZtimestamp_pbrrr�int�	timestamp�microsecond�str�FromJsonString)rrZtimestamp_valuerrr�to_proto*s

�
zTimestampRule.to_proto)�__name__�
__module__�__qualname__�__doc__�boolrrrrrr"rrrrr	s	��	r	c@s6eZdZdZdd�eed�dd�Zejd�dd	�Z	dS)
�DurationRulea'A marshal between Python timedeltas and protobuf durations.

    Note: Python timedeltas are less precise than protobuf durations
    (microsecond vs. nanosecond level precision). If nanosecond-level
    precision matters, it is recommended to interact with the internal
    proto directly.
    Nr
rcCs0t|tj�r,t|jd|jd|jdd�S|S)N�Qr)�daysr�microseconds)rr�DurationrrrrrrrrBs�zDurationRule.to_pythonrcCsPt|t�r*tj|jd|j|jdd�St|t�rLt��}|j|d�|S|S)Nr)rrr)	rrrr,r*rr+r r!)rrZduration_valuerrrr"Ks
�
zDurationRule.to_proto)
r#r$r%r&r'rrrr,r"rrrrr(9s	r(N)rrrZgoogle.protobufrr�protorrr	r(rrrr�<module>s!

F1le Man4ger