a [dg@sddlmZddlZddlZddlZejddkZerDeefZ dZ n4eZ z ej j Z Wn"e yve edZ Yn0GdddeddZGdddeZdS) ) namedtupleNcseZdZfddZZS)ExtTypecsVt|tstdt|ts$tdd|kr8dksBntdtt||||S)Nzcode must be intzdata must be bytesrzcode must be 0~127) isinstanceint TypeErrorbytes ValueErrorsuperr__new__)clscodedata __class__A/usr/local/lib/python3.9/site-packages/pip/_vendor/msgpack/ext.pyr s  zExtType.__new__)__name__ __module__ __qualname__r __classcell__rrrrrsrz code datac@seZdZddgZdddZddZdd Zd d Zd d Ze ddZ ddZ e ddZ ddZ e ddZddZddZe ddZdS) Timestampseconds nanosecondsrcCsRt|tstdt|ts$tdd|kr8dksBntd||_||_dS)Nzseconds must be an intergerznanoseconds must be an integerrʚ;z?nanoseconds must be a non-negative integer less than 999999999.)r int_typesrr rr)selfrrrrr__init__-s  zTimestamp.__init__cCsd|j|jS)Nz'Timestamp(seconds={0}, nanoseconds={1}))formatrrrrrr__repr__EszTimestamp.__repr__cCs*t||jur&|j|jko$|j|jkSdS)NF)typerrrrotherrrr__eq__KszTimestamp.__eq__cCs || SN)r%r#rrr__ne__SszTimestamp.__ne__cCst|j|jfSr&)hashrrr rrr__hash__WszTimestamp.__hash__cCst|dkr"td|d}d}nTt|dkrPtd|d}|d@}|d?}n&t|dkrntd |\}}ntd t||S) N!Lr!Ql" !IqzFTimestamp type can only be created from 32, 64, or 96-bit byte objects)lenstructunpackr r)brrdata64rrr from_bytesZs    zTimestamp.from_bytescCs\|jd?dkrF|jd>|jB}|d@dkr8td|}qXtd|}ntd|j|j}|S)Nr.rlr+r-r0)rrr2pack)rr5rrrrto_bytesus zTimestamp.to_bytescCs&t|d}t|dd}t||S)Nr)rr)Zunix_secrrrrr from_unixs zTimestamp.from_unixcCs|j|jdS)NgeArrr rrrto_unixszTimestamp.to_unixcCstt|dSNr)rdivmod)Zunix_nsrrrfrom_unix_nanoszTimestamp.from_unix_nanocCs|jd|jSr=r;r rrr to_unix_nanoszTimestamp.to_unix_nanocCstjdttj|dS)Nr)r)datetimeZ fromtimestamp_utc timedeltar<r rrr to_datetimeszTimestamp.to_datetimecCst|Sr&)rr:Z timestamp)Zdtrrr from_datetimeszTimestamp.from_datetimeN)r)rrr __slots__rr!r%r'r) staticmethodr6r8r:r<r?r@rDrErrrrr"s$      r) collectionsrrAsysr2 version_infoZPY2rlongrrBtimezoneZutcAttributeErrorrCrobjectrrrrrs