+
    oi                     
   R t ^ RIt^ RIt^ RIt^ RIHt ]P                  P                  ^ ]P                  P                  4      t	Rt
Rt]P                  ! R]P                  4      tR tR
R lt ! R R	]P                  4      tR# )zHelpers for :mod:`datetime`.N)timestamp_pb2z%Y-%m-%dT%H:%M:%S.%fZz%Y-%m-%dT%H:%M:%Sah  
    (?P<no_fraction>
        \d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}  # YYYY-MM-DDTHH:MM:SS
    )
    (                                        # Optional decimal part
     \.                                      # decimal point
     (?P<nanos>\d{1,9})                      # nanoseconds, maybe truncated
    )?
    Z                                        # Zulu
c                F    \         \        P                  ! V R7      ,           # )zConvert timestamp in microseconds since the unix epoch to datetime.

Args:
    value (float): The timestamp to convert, in microseconds.

Returns:
    datetime.datetime: The datetime object equivalent to the timestamp in
        UTC.
)microseconds)
_UTC_EPOCHdatetime	timedelta)values   &y/Users/tonyclaw/.openclaw/workspace/scripts/youtube-playlists/venv/lib/python3.14/site-packages/proto/datetime_helpers.py_from_microsecondsr
   ,   s     **>>>    c                    V'       g6   V P                   e(   V P                  RR7      V P                  4       ,
          p V P                  \        4      # )ag  Convert a datetime to an RFC3339 timestamp string.

Args:
    value (datetime.datetime):
        The datetime object to be converted to a string.
    ignore_zone (bool): If True, then the timezone (if any) of the
        datetime object is ignored and the datetime is treated as UTC.

Returns:
    str: The RFC3339 formatted string representing the datetime.
Ntzinfo)r   replace	utcoffsetstrftime_RFC3339_MICROS)r   ignore_zones   &&r	   _to_rfc3339r   9   s;     5<<3T*U__->>>>/**r   c                   |   a a ] tR t^Lt oRtR
tR tV 3R lt]R 4       t	R t
]R 4       tR t]R 4       tR	tVtV ;t# )DatetimeWithNanosecondszmTrack nanosecond in addition to normal datetime attrs.

Nanosecond can be passed only as a keyword argument.
c                    VP                  R ^ 4      pV^ 8  d   RV9   d   \        R4      hVR,          VR&   \        P                  P                  ! V .VO5/ VB pT;'       g    ^ Vn        V# )
nanosecondmicrosecond1Specify only one of 'microsecond' or 'nanosecond'  )pop	TypeErrorr   __new___nanosecond)clsargskwnanosinsts   &*,  r	   r   DatetimeWithNanoseconds.__new__U   sn    |Q'19" STT %B}  ((:t:r: ::Ar   c                F  < RV9   pRV9   pVP                  R^ 4      pV P                  pV'       d   V'       d   \        R4      hV'       d   VR,          VR&   \        SV `  ! V/ VB pV'       d   VP
                  R,          Vn        V# V'       d	   WWn        V# Wgn        V# )a  Return a date with the same value, except for those parameters given
new values by whichever keyword arguments are specified. For example,
if d == date(2002, 12, 31), then
d.replace(day=26) == date(2002, 12, 26).
NOTE: nanosecond and microsecond are mutually exclusive arguments.
r   r   r   r   )r   r   r   superr   r   r   )	selfr!   r"   ms_providedns_providedprovided_ns
prev_nanosr$   	__class__s	   &*,     r	   r   DatetimeWithNanoseconds.replace`   s     $r)"b(ff\1-__
;OPP +t 3B}w++#//$6D  *
   *r   c                P    V P                   ;'       g    V P                  R,          # )z Read-only: nanosecond precision.r   )r   r   )r(   s   &r	   r   "DatetimeWithNanoseconds.nanosecond   s#     ::4#3#3d#::r   c                    V P                   ^ 8X  d   \        V 4      # \        V P                   4      P                  ^	R4      P	                  R4      pRP                  V P                  \        4      V4      # )zhReturn an RFC3339-compliant timestamp.

Returns:
    (str): Timestamp string according to RFC3339 spec.
0z{}.{}Z)r   r   strrjustrstripformatr   _RFC3339_NO_FRACTION)r(   r#   s   & r	   rfc3339DatetimeWithNanoseconds.rfc3339   s`     q t$$D$$%++As3::3?t}}-ABEJJr   c                :   \         P                  V4      pVf*   \        RP                  V\         P                  4      4      h\
        P
                  P                  VP                  R4      \        4      pVP                  R4      pVf   ^ pM+^	\        V4      ,
          p\        V4      ^
V,          ,          pV ! VP                  VP                  VP                  VP                  VP                  VP                   V\
        P"                  P$                  R7      # )a+  Parse RFC3339-compliant timestamp, preserving nanoseconds.

Args:
    stamp (str): RFC3339 stamp, with up to nanosecond precision

Returns:
    :class:`DatetimeWithNanoseconds`:
        an instance matching the timestamp string

Raises:
    ValueError: if `stamp` does not match the expected format
z)Timestamp: {}, does not match pattern: {}no_fractionr#   r   r   )_RFC3339_NANOSmatch
ValueErrorr6   patternr   strptimegroupr7   lenintyearmonthdayhourminutesecondtimezoneutc)r    stamp
with_nanosbarefractionr#   scales   &&     r	   from_rfc3339$DatetimeWithNanoseconds.from_rfc3339   s     $))%0
;BB>11 
   ))]+-A
 ##G,EH%EMRY/EIIJJHHIIKKKK$$((	
 		
r   c                >   V P                   e   T M)V P                  \        P                  P                  R7      pV\
        ,
          p\        VP                  4       4      pV P                  ;'       g    V P                  R,          p\        P                  ! W4R7      # )zqReturn a timestamp message.

Returns:
    (:class:`~google.protobuf.timestamp_pb2.Timestamp`): Timestamp message
r   r   )secondsr#   )r   r   r   rK   rL   r   rD   total_secondsr   r   r   	Timestamp)r(   r$   deltarU   r#   s   &    r	   timestamp_pb$DatetimeWithNanoseconds.timestamp_pb   s     {{& X%6%6%:%:; 	
 z!e))+,  ;;D$4$4t$;&&wDDr   c                ,   \        VP                  R,          4      p\        V4      pV ! VP                  VP                  VP
                  VP                  VP                  VP                  VP                  \        P                  P                  R7      # )zParse RFC3339-compliant timestamp, preserving nanoseconds.

Args:
    stamp (:class:`~google.protobuf.timestamp_pb2.Timestamp`): timestamp message

Returns:
    :class:`DatetimeWithNanoseconds`:
        an instance matching the timestamp message
g    .Ar<   )rD   rU   r
   rE   rF   rG   rH   rI   rJ   r#   r   rK   rL   )r    rM   r   rO   s   &&  r	   from_timestamp_pb)DatetimeWithNanoseconds.from_timestamp_pb   sn     5==3./!,/IIJJHHIIKKKK{{$$((	
 		
r    )r   )__name__
__module____qualname____firstlineno____doc__	__slots__r   r   propertyr   r8   classmethodrR   rY   r\   __static_attributes____classdictcell____classcell__)r-   __classdict__s   @@r	   r   r   L   sj     
 !I D ; ;	K &
 &
PE  
 
 
r   r   )T)rc   calendarr   regoogle.protobufr   fromtimestamprK   rL   r   r   r7   compileVERBOSEr=   r
   r   r   r^   r   r	   <module>rq      s    #   	 ) ,,Q0A0A0E0EF
)* 	 JJ
?+&U
h// U
r   