
    fXf                        d dl mZ d dlZd dlZd dlZej        d          dk    ZereefZ	dZ
n9eZ		 ej        j        Z
n)# e$ r!  ej         ej        d                     Z
Y nw xY w G d d edd                    Z G d de          ZdS )	    )
namedtupleN   c                   "     e Zd ZdZ fdZ xZS )ExtTypez'ExtType represents ext type in msgpack.c                 $   t          |t                    st          d          t          |t                    st          d          d|cxk    rdk    sn t	          d          t          t          |                               | ||          S )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      P/var/www/html/Qu*py/bism/lib/python3.11/site-packages/pip/_vendor/msgpack/ext.pyr   zExtType.__new__   s    $$$ 	0.///$&& 	20111DC1222Wc""**3d;;;    )__name__
__module____qualname____doc__r   __classcell__)r   s   @r   r   r      s>        11< < < < < < < < <r   r   z	code datac                       e Zd ZdZddgZddZd Zd Zd Zd	 Z	e
d
             Zd Ze
d             Zd Ze
d             Zd Zd Ze
d             ZdS )	TimestampaR  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nanosecondsr   c                     t          |t                    st          d          t          |t                    st          d          d|cxk    rdk     sn t          d          || _        || _        dS )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__zTimestamp.__init__-   s     '9-- 	;9:::+y11 	><===[((((5((((Q   &r   c                 B    d                     | j        | j                  S )z#String representation of Timestamp.z'Timestamp(seconds={0}, nanoseconds={1}))formatr   r   r"   s    r   __repr__zTimestamp.__repr__E   s$    8??L$*
 
 	
r   c                 r    t          |          | j        u r | j        |j        k    o| j        |j        k    S dS )z0Check for equality with another Timestamp objectF)typer   r   r   r"   others     r   __eq__zTimestamp.__eq__K   s=    ;;$.((-W$2BeFW2W ur   c                 .    |                      |           S )z(not-equals method (see :func:`__eq__()`))r,   r*   s     r   __ne__zTimestamp.__ne__S   s    ;;u%%%%r   c                 8    t          | j        | j        f          S )N)hashr   r   r&   s    r   __hash__zTimestamp.__hash__W   s    T\4#34555r   c                 l   t          |           dk    rt          j        d|           d         }d}ntt          |           dk    r&t          j        d|           d         }|dz  }|dz	  }n;t          |           dk    rt          j        d	|           \  }}nt          d
          t	          ||          S )a  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      !Ql    "      !IqzFTimestamp type can only be created from 32, 64, or 96-bit byte objects)lenstructunpackr   r   )br   r   data64s       r   
from_byteszTimestamp.from_bytesZ   s     q66Q;;mD!,,Q/GKKVVq[[]4++A.F11G B,KKVVr\\#)=#:#: KX   +...r   c                     | j         dz	  dk    rG| j        dz  | j         z  }|dz  dk    rt          j        d|          }n6t          j        d|          }n t          j        d| j        | j                   }|S )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
        r7   r   l        r4   r6   r9   )r   r   r;   pack)r"   r>   r   s      r   to_byteszTimestamp.to_bytesu   s     LB1$$%+dl:F**a//{400 {400 ;ud&6EEDr   c                 p    t          | dz            }t          | dz  dz            }t          ||          S )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_unixzTimestamp.from_unix   s;     h!m$$8a<5011+...r   c                 &    | j         | j        dz  z   S )znGet the timestamp as a floating-point value.

        :returns: posix timestamp
        :rtype: float
        g    eAr   r   r&   s    r   to_unixzTimestamp.to_unix   s     |d.444r   c                 0    t          t          | d           S )zCreate 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_nanozTimestamp.from_unix_nano   s     &%0011r   c                 &    | j         dz  | j        z   S )z~Get the timestamp as a unixtime in nanoseconds.

        :returns: posix timestamp in nanoseconds
        :rtype: int
        r    rH   r&   s    r   to_unix_nanozTimestamp.to_unix_nano   s     |e#d&666r   c                     t           j                             dt                    t          j        |                                           z   S )zlGet the timestamp as a UTC datetime.

        Python 2 is not supported.

        :rtype: datetime.
        r   )r   )datetimefromtimestamp_utc	timedeltarI   r&   s    r   to_datetimezTimestamp.to_datetime   sC      ..q$77(:LLLNN;
 ;
 ;
 
 	
r   c                 Z    t                               |                                           S )zuCreate a Timestamp from datetime with tzinfo.

        Python 2 is not supported.

        :rtype: Timestamp
        )r   rF   	timestamp)dts    r   from_datetimezTimestamp.from_datetime   s      ""2<<>>222r   N)r   )r   r   r   r   	__slots__r#   r'   r,   r.   r1   staticmethodr?   rB   rF   rI   rM   rO   rU   rY    r   r   r   r   "   s"         M*I' ' ' '0
 
 
  & & &6 6 6 / / \/4  * / / \/5 5 5 2 2 \27 7 7	
 	
 	
 3 3 \3 3 3r   r   )collectionsr   rQ   sysr;   version_infoPY2r
   longr!   rS   timezoneutcAttributeErrorrT   r   objectr   r\   r   r   <module>rf      s(   " " " " " "  



  
qQ 8dIDDI8 $ 8 8 8 x !3!3A!6!6778
< 
< 
< 
< 
<jjK00 
< 
< 
<_3 _3 _3 _3 _3 _3 _3 _3 _3 _3s   = #A#"A#