ó
    ˆóýj  ã                   ó¦   • S SK r S SKrS SKJr  \ R                   " SSS\ R                  R
                  S9r " S S\" SS5      5      r " S	 S
5      rg)é    N)Ú
namedtuplei²  é   )Útzinfoc                   ó,   ^ • \ rS rSrSrU 4S jrSrU =r$ )ÚExtTypeé   z'ExtType represents ext type in msgpack.c                 óØ   >• [        U[        5      (       d  [        S5      e[        U[        5      (       d  [        S5      eSUs=::  a  S::  d  O  [	        S5      e[
        TU ]  XU5      $ )Nzcode must be intzdata must be bytesr   é   zcode must be 0~127)Ú
isinstanceÚintÚ	TypeErrorÚbytesÚ
ValueErrorÚsuperÚ__new__)ÚclsÚcodeÚdataÚ	__class__s      €Ú6/usr/local/lib/python3.13/site-packages/msgpack/ext.pyr   ÚExtType.__new__   s_   ø€ Ü˜$¤×$Ñ$ÜÐ.Ó/Ð/Ü˜$¤×&Ñ&ÜÐ0Ó1Ð1Ø�DÕ˜CÕÜÐ1Ó2Ð2Ü‰w‰˜s¨$Ó/Ð/ó    © )Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r   Ú__static_attributes__Ú__classcell__)r   s   @r   r   r      s   ø† Ù1÷0ó 0r   r   z	code datac                   óš   • \ rS rSrSrSS/rSS jrS rS rS r	S	 r
\S
 5       rS r\S 5       rS r\S 5       rS rS r\S 5       rSrg)Ú	Timestampé   aB  Timestamp represents the Timestamp extension type in msgpack.

When built with Cython, msgpack uses C methods to pack and unpack `Timestamp`.
When using pure-Python msgpack, :func:`to_bytes` and :func:`from_bytes` are used to pack and
unpack `Timestamp`.

This class is immutable: Do not override seconds and nanoseconds.
ÚsecondsÚnanosecondsc                 óÐ   • [        U[        5      (       d  [        S5      e[        U[        5      (       d  [        S5      eSUs=::  a  S:  d  O  [        S5      eXl        X l        g)a†  Initialize a Timestamp object.

:param int seconds:
    Number of seconds since the UNIX epoch (00:00:00 UTC Jan 1 1970, minus leap seconds).
    May be negative.

:param int nanoseconds:
    Number of nanoseconds to add to `seconds` to get fractional time.
    Maximum is 999_999_999.  Default is 0.

Note: Negative times (before the UNIX epoch) are represented as neg. seconds + pos. ns.
zseconds must be an integerznanoseconds must be an integerr   é Êš;z?nanoseconds must be a non-negative integer less than 999999999.N)r   r   r   r   r$   r%   )Úselfr$   r%   s      r   Ú__init__ÚTimestamp.__init__!   sZ   € ô ˜'¤3×'Ñ'ÜÐ8Ó9Ð9Ü˜+¤s×+Ñ+ÜÐ<Ó=Ð=Ø�[Õ( 5Õ(ÜÐ^Ó_Ð_ØŒØ&Õr   c                 ó<   • SU R                    SU R                   S3$ )z#String representation of Timestamp.zTimestamp(seconds=z, nanoseconds=Ú)©r$   r%   ©r(   s    r   Ú__repr__ÚTimestamp.__repr__7   s#   € à# D§L¡L >°À×@PÑ@PÐ?QÐQRÐSÐSr   c                 ó¦   • [        U5      U R                  L a9  U R                  UR                  :H  =(       a    U R                  UR                  :H  $ g)z0Check for equality with another Timestamp objectF)Útyper   r$   r%   ©r(   Úothers     r   Ú__eq__ÚTimestamp.__eq__;   s>   € ä�‹;˜$Ÿ.™.Ò(Ø—<‘< 5§=¡=Ñ0×Z°T×5EÑ5EÈ×IZÑIZÑ5ZÐZØr   c                 ó.   • U R                  U5      (       + $ )z(not-equals method (see :func:`__eq__()`))r5   r3   s     r   Ú__ne__ÚTimestamp.__ne__A   s   € à—;‘;˜uÓ%Ô%Ð%r   c                 óD   • [        U R                  U R                  45      $ )N)Úhashr$   r%   r.   s    r   Ú__hash__ÚTimestamp.__hash__E   s   € Ü�T—\‘\ 4×#3Ñ#3Ð4Ó5Ð5r   c                 ó@  • [        U 5      S:X  a  [        R                  " SU 5      S   nSnOh[        U 5      S:X  a%  [        R                  " SU 5      S   nUS-  nUS-	  nO4[        U 5      S:X  a  [        R                  " S	U 5      u  p!O[        S
5      e[	        X5      $ )zéUnpack bytes into a `Timestamp` object.

Used for pure-Python msgpack unpacking.

:param b: Payload from msgpack ext message with code -1
:type b: bytes

:returns: Timestamp object unpacked from msgpack ext payload
:rtype: Timestamp
é   ú!Lr   r   ú!Ql   ÿÿ é"   é   ú!IqzFTimestamp type can only be created from 32, 64, or 96-bit byte objects)ÚlenÚstructÚunpackr   r"   )Úbr$   r%   Údata64s       r   Ú
from_bytesÚTimestamp.from_bytesH   sš   € ô ˆq‹6�Q‹;Ü—m’m D¨!Ó,¨QÑ/ˆGØ‰KÜ�‹V�q‹[Ü—]’] 4¨Ó+¨AÑ.ˆFØÐ1Ñ1ˆGØ  B™,‰KÜ�‹V�r‹\Ü#)§=¢=°¸Ó#:Ñ ˆK˜äØXóð ô ˜Ó.Ð.r   c                 ó4  • U R                   S-	  S:X  aX  U R                  S-  U R                   -  nUS-  S:X  a  [        R                  " SU5      nU$ [        R                  " SU5      n U$ [        R                  " SU R                  U R                   5      nU$ )z¢Pack this Timestamp object into bytes.

Used for pure-Python msgpack packing.

:returns data: Payload for EXT message with code -1 (timestamp type)
:rtype: bytes
rB   r   l       üÿ r@   rA   rD   )r$   r%   rF   Úpack)r(   rI   r   s      r   Úto_bytesÚTimestamp.to_bytesc   s�   € ð �L‰L˜BÑ 1Ó$Ø×%Ñ%¨Ñ+¨d¯l©lÑ:ˆFØÐ*Ñ*¨aÓ/ä—{’{ 4¨Ó0�ð ˆô	 —{’{ 4¨Ó0‘ð ˆô —;’;˜u d×&6Ñ&6¸¿¹ÓEˆDØˆr   c                 óV   • [        U S-  5      n[        U S-  S-  5      n[        X5      $ )zƒCreate a Timestamp from posix timestamp in seconds.

:param unix_float: Posix timestamp in seconds.
:type unix_float: int or float
r   r'   )r   r"   )Úunix_secr$   r%   s      r   Ú	from_unixÚTimestamp.from_unixx   s0   € ô �h !‘mÓ$ˆÜ˜8 a™<¨5Ñ0Ó1ˆÜ˜Ó.Ð.r   c                 ó:   • U R                   U R                  S-  -   $ )zVGet the timestamp as a floating-point value.

:returns: posix timestamp
:rtype: float
g    eÍÍAr-   r.   s    r   Úto_unixÚTimestamp.to_unixƒ   s   € ð �|‰|˜d×.Ñ.°Ñ4Ñ4Ð4r   c                 ó&   • [        [        U S5      6 $ )zCreate a Timestamp from posix timestamp in nanoseconds.

:param int unix_ns: Posix timestamp in nanoseconds.
:rtype: Timestamp
r'   )r"   Údivmod)Úunix_nss    r   Úfrom_unix_nanoÚTimestamp.from_unix_nano‹   s   € ô œ& ¨%Ó0Ð1Ð1r   c                 ó:   • U R                   S-  U R                  -   $ )zfGet the timestamp as a unixtime in nanoseconds.

:returns: posix timestamp in nanoseconds
:rtype: int
r'   r-   r.   s    r   Úto_unix_nanoÚTimestamp.to_unix_nano”   s   € ð �|‰|˜eÑ# d×&6Ñ&6Ñ6Ð6r   c                 óh   • [         [        R                  " U R                  U R                  S-  S9-   $ )zBGet the timestamp as a UTC datetime.

:rtype: `datetime.datetime`
éè  )r$   Úmicroseconds)Ú_EPOCHÚdatetimeÚ	timedeltar$   r%   r.   s    r   Úto_datetimeÚTimestamp.to_datetimeœ   s2   € ô
 œ×*Ò*Ø—L‘L¨t×/?Ñ/?À4Ñ/Gñ
ñ 
ð 	
r   c                 ó°   • U R                   c  U R                  5       n U [        -
  n[        UR                  S-  UR
                  -   UR                  S-  S9$ )zACreate a Timestamp from datetime with tzinfo.

:rtype: Timestamp
i€Q r`   r-   )r   Ú
astimezonerb   r"   Údaysr$   ra   )ÚdtÚdeltas     r   Úfrom_datetimeÚTimestamp.from_datetime¥   sR   € ð �9‰9Ñà—‘“ˆBØ”V‘ˆÜØ—J‘J Ñ&¨¯©Ñ6Ø×*Ñ*¨TÑ1ñ
ð 	
r   )r%   r$   N)r   )r   r   r   r   r   Ú	__slots__r)   r/   r5   r8   r<   ÚstaticmethodrJ   rN   rR   rU   rZ   r]   re   rl   r   r   r   r   r"   r"      s‘   † ñð ˜MÐ*€Iô'ò,Tòò&ò6ð ñ/ó ð/ò4ð* ñ/ó ð/ò5ð ñ2ó ð2ò7ò
ð ñ
ó ó
r   r"   )	rc   rF   Úcollectionsr   ÚtimezoneÚutcrb   r   r"   r   r   r   Ú<module>rs      sO   ðÛ Û Ý "à	×	Ò	˜4  A¨h×.?Ñ.?×.CÑ.CÑ	D€ô
0‰j˜ KÓ0ô 
0÷c
ò c
r   