
    9a                     0   S SK Jr  S SKrS SKrS SKr\R
                  S    S:H  r\(       a  \\4r	Sr
O\r	 \R                  R                  r
 " S S\" SS5      5      r " S S\5      rg! \ a%    \R                  " \R                  " S 5      5      r
 NHf = f)	    )
namedtupleN   c                   ,   ^  \ 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[
        [        U ]  XU5      $ )Nzcode must be intzdata must be bytesr      zcode must be 0~127)
isinstanceint	TypeErrorbytes
ValueErrorsuperr   __new__)clscodedata	__class__s      -/usr/lib/python3/dist-packages/msgpack/ext.pyr   ExtType.__new__   sb    $$$.//$&&011DC122Wc*3d;;     )__name__
__module____qualname____firstlineno____doc__r   __static_attributes____classcell__)r   s   @r   r   r      s    1< <r   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 negative seconds + positive ns.
zseconds must be an intergerznanoseconds must be an integerr    ʚ;z?nanoseconds must be a non-negative integer less than 999999999.N)r
   	int_typesr   r   r#   r$   )selfr#   r$   s      r   __init__Timestamp.__init__-   s`     '9--9::+y11<==[*7*Q  &r   c                 N    SR                  U R                  U R                  5      $ )z#String representation of Timestamp.z'Timestamp(seconds={0}, nanoseconds={1}))formatr#   r$   r(   s    r   __repr__Timestamp.__repr__E   s$    8??LL$**
 	
r   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__K   sB    ;$..(-W$2B2BeFWFW2W r   c                 .    U R                  U5      (       + $ )z(not-equals method (see :func:`__eq__()`))r4   r2   s     r   __ne__Timestamp.__ne__S   s    ;;u%%%r   c                 D    [        U R                  U R                  45      $ )N)hashr#   r$   r-   s    r   __hash__Timestamp.__hash__W   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      $ )zUnpack 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      !Ql    r"      !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_bytesZ   s     q6Q;mmD!,Q/GKVq[]]4+A.F11G B,KVr\#)==#: 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$ )zPack this Timestamp object into bytes.

Used for pure-Python msgpack packing.

:returns data: Payload for EXT message with code -1 (timestamp type)
:rtype: bytes
r"   r   l        r?   rA   rC   )r#   r$   rE   pack)r(   rH   r   s      r   to_bytesTimestamp.to_bytesu   s     LLB1$%%+dll:F**a/{{40 	 {{40  ;;ud&6&6EDr   c                 V    [        U S-  5      n[        U S-  S-  5      n[        X5      $ )zCreate a Timestamp from posix timestamp in seconds.

:param unix_float: Posix timestamp in seconds.
:type unix_float: int or float.
   r&   )r   r!   )unix_secr#   r$   s      r   	from_unixTimestamp.from_unix   s0     h!m$8a<723..r   c                 :    U R                   U R                  S-  -   $ )zVGet the timestamp as a floating-point value.

:returns: posix timestamp
:rtype: float
g    eAr#   r$   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     &'233r   c                 :    U R                   S-  U R                  -   $ )zfGet the timestamp as a unixtime in nanoseconds.

:returns: posix timestamp in nanoseconds
:rtype: int
r&   rU   r-   s    r   to_unix_nanoTimestamp.to_unix_nano   s     ||g%(8(888r   c                     [         R                   R                  S[        5      [         R                  " U R	                  5       S9-   $ )zTGet the timestamp as a UTC datetime.

Python 2 is not supported.

:rtype: datetime.
r   )r#   )datetimefromtimestamp_utc	timedeltarV   r-   s    r   to_datetimeTimestamp.to_datetime   s:       ..q$7(:L:LLLN;
 
 	
r   c                 H    [         R                  U R                  5       5      $ )z]Create a Timestamp from datetime with tzinfo.

Python 2 is not supported.

:rtype: Timestamp
)r!   rR   	timestamp)dts    r   from_datetimeTimestamp.from_datetime   s     ""2<<>22r   )r$   r#   N)r   )r   r   r   r   r   	__slots__r)   r.   r4   r7   r;   staticmethodrI   rM   rR   rV   r[   r^   re   rj   r   r   r   r   r!   r!   "   s     M*I'0
&6 / /4* / /5 4 49	
 3 3r   r!   )collectionsr   ra   sysrE   version_infoPY2r   longr'   rc   timezoneutcAttributeErrorrd   r   objectr!   r   r   r   <module>rw      s    "  
  
qQdIDI8  $$

<jK0 
<_3 _3#  8  !3!3A!678s   A* *(BB