Viewing File: /opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/msgpack/ext.pyo

ó
“tÆ_c@sÝddlmZddlZddlZddlZejddkZerbeefZ	dZnBeZ	yejj
ZWn)ek
r£ejejdƒƒZnXdeddƒfd„ƒYZdefd	„ƒYZdS(
iÿÿÿÿ(t
namedtupleNiitExtTypes	code datacBseZdZd„ZRS(s'ExtType represents ext type in msgpack.cCsƒt|tƒstdƒ‚nt|tƒs<tdƒ‚nd|koSdknsgtdƒ‚ntt|ƒj|||ƒS(Nscode must be intsdata must be bytesiiscode must be 0~127(t
isinstancetintt	TypeErrortbytest
ValueErrortsuperRt__new__(tclstcodetdata((sH/opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/msgpack/ext.pyRs(t__name__t
__module__t__doc__R(((sH/opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/msgpack/ext.pyRst	TimestampcBsªeZdZddgZdd„Zd„Zd„Zd„Zd„Ze	d	„ƒZ
d
„Ze	d„ƒZd„Z
e	d
„ƒZd„Zd„Ze	d„ƒZRS(sRTimestamp 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.
    tsecondstnanosecondsicCs}t|tƒstdƒ‚nt|tƒs<tdƒ‚nd|koSdknsgtdƒ‚n||_||_dS(	sÎ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.
        sseconds must be an intergersnanoseconds must be an integerii
i	s?nanoseconds must be a non-negative integer less than 999999999.NiÊš;(Rt	int_typesRRRR(tselfRR((sH/opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/msgpack/ext.pyt__init__-s
	cCsdj|j|jƒS(s#String representation of Timestamp.s'Timestamp(seconds={0}, nanoseconds={1})(tformatRR(R((sH/opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/msgpack/ext.pyt__repr__EscCs;t|ƒ|jkr7|j|jko6|j|jkStS(s0Check for equality with another Timestamp object(ttypet	__class__RRtFalse(Rtother((sH/opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/msgpack/ext.pyt__eq__Ks"cCs|j|ƒS(s(not-equals method (see :func:`__eq__()`)(R(RR((sH/opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/msgpack/ext.pyt__ne__SscCst|j|jfƒS(N(thashRR(R((sH/opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/msgpack/ext.pyt__hash__WscCs¶t|ƒdkr1tjd|ƒd}d}nxt|ƒdkrptjd|ƒd}|d@}|d?}n9t|ƒdkrtjd	|ƒ\}}ntd
ƒ‚t||ƒS(sUnpack 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
        is!Liis!QIÿÿÿÿi"is!IqsFTimestamp type can only be created from 32, 64, or 96-bit byte objects(tlentstructtunpackRR(tbRRtdata64((sH/opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/msgpack/ext.pyt
from_bytesZs	

	cCs€|jd?dkra|jd>|jB}|d@dkrLtjd|ƒ}q|tjd|ƒ}ntjd|j|jƒ}|S(sÂ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
        i"ilüÿs!Ls!Qs!Iq(RRR tpack(RR#R((sH/opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/msgpack/ext.pytto_bytesuscCs1t|dƒ}t|ddƒ}t||ƒS(sœCreate a Timestamp from posix timestamp in seconds.

        :param unix_float: Posix timestamp in seconds.
        :type unix_float: int or float.
        ii
i	iÊš;(RR(tunix_secRR((sH/opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/msgpack/ext.pyt	from_unixŠscCs|j|jdS(snGet the timestamp as a floating-point value.

        :returns: posix timestamp
        :rtype: float
        geÍÍA(RR(R((sH/opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/msgpack/ext.pytto_unix•scCstt|dƒŒS(s—Create a Timestamp from posix timestamp in nanoseconds.

        :param int unix_ns: Posix timestamp in nanoseconds.
        :rtype: Timestamp
        i
i	iÊš;(Rtdivmod(tunix_ns((sH/opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/msgpack/ext.pytfrom_unix_nanoscCs|jd|jS(s~Get the timestamp as a unixtime in nanoseconds.

        :returns: posix timestamp in nanoseconds
        :rtype: int
        i
i	iÊš;(RR(R((sH/opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/msgpack/ext.pytto_unix_nano¦scCstjj|jƒtƒS(slGet the timestamp as a UTC datetime.

        Python 2 is not supported.

        :rtype: datetime.
        (tdatetimet
fromtimestampR)t_utc(R((sH/opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/msgpack/ext.pytto_datetime®scCstj|jƒƒS(suCreate a Timestamp from datetime with tzinfo.

        Python 2 is not supported.

        :rtype: Timestamp
        (RR(t	timestamp(tdt((sH/opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/msgpack/ext.pyt
from_datetime·s(RR
Rt	__slots__RRRRRtstaticmethodR$R&R(R)R,R-R1R4(((sH/opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/msgpack/ext.pyR"s										(tcollectionsRR.tsysR tversion_infotPY2RtlongRtNoneR0ttimezonetutctAttributeErrort	timedeltaRtobjectR(((sH/opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/msgpack/ext.pyt<module>s	

Back to Directory File Manager