zmc
2023-12-22 9fdbf60165db0400c2e8e6be2dc6e88138ac719a
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
U
H=®d’ã@s¤ddlmZddlZddlZddlZejddkZerDeefZ    dZ
n6eZ    z ej j Z
Wn$e k
rxe  e d¡¡Z
YnXGdd„deddƒƒZGdd„deƒZdS)    é)Ú
namedtupleNécs eZdZdZ‡fdd„Z‡ZS)ÚExtTypez'ExtType represents ext type in msgpack.csVt|tƒstdƒ‚t|tƒs$tdƒ‚d|kr8dksBntdƒ‚tt|ƒ |||¡S)Nzcode must be intzdata must be bytesrézcode must be 0~127)Ú
isinstanceÚintÚ    TypeErrorÚbytesÚ
ValueErrorÚsuperrÚ__new__)ÚclsÚcodeÚdata©Ú    __class__©úND:\z\workplace\VsCode\pyvenv\venv\Lib\site-packages\pip/_vendor/msgpack/ext.pyr s
 
zExtType.__new__)Ú__name__Ú
__module__Ú __qualname__Ú__doc__r Ú __classcell__rrrrrsrz    code datac@s’eZdZdZddgZd dd„Zdd„Zd    d
„Zd d „Zd d„Z    e
dd„ƒZ dd„Z e
dd„ƒZ dd„Ze
dd„ƒZdd„Zdd„Ze
dd„ƒZdS)!Ú    TimestampaRTimestamp 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Ú nanosecondsrcCsRt|tƒstdƒ‚t|tƒs$tdƒ‚d|kr8dksBntdƒ‚||_||_dS)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.
        zseconds must be an intergerznanoseconds must be an integerréʚ;z?nanoseconds must be a non-negative integer less than 999999999.N)rÚ    int_typesrr
rr)ÚselfrrrrrÚ__init__-s
 
ÿzTimestamp.__init__cCsd |j|j¡S)z#String representation of Timestamp.z'Timestamp(seconds={0}, nanoseconds={1}))Úformatrr©rrrrÚ__repr__EsÿzTimestamp.__repr__cCs*t|ƒ|jkr&|j|jko$|j|jkSdS)z0Check for equality with another Timestamp objectF)Útyperrr©rÚotherrrrÚ__eq__KsÿzTimestamp.__eq__cCs | |¡ S)z(not-equals method (see :func:`__eq__()`))r&r$rrrÚ__ne__SszTimestamp.__ne__cCst|j|jfƒS)N)Úhashrrr!rrrÚ__hash__WszTimestamp.__hash__cCs€t|ƒdkr"t d|¡d}d}nTt|ƒdkrPt d|¡d}|d@}|d?}n&t|ƒdkrnt d    |¡\}}ntd
ƒ‚t||ƒS) aUnpack 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)ÚbrrÚdata64rrrÚ
from_bytesZs  
 ÿzTimestamp.from_bytescCs\|jd?dkrF|jd>|jB}|d@dkr8t d|¡}qXt d|¡}nt d|j|j¡}|S)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
        r.rlüÿr+r-r0)rrr2Úpack)rr5rrrrÚto_bytesus zTimestamp.to_bytescCs&t|dƒ}t|ddƒ}t||ƒS)zœCreate a Timestamp from posix timestamp in seconds.
 
        :param unix_float: Posix timestamp in seconds.
        :type unix_float: int or float.
        ér)rr)Úunix_secrrrrrÚ    from_unixŠs zTimestamp.from_unixcCs|j|jdS)znGet the timestamp as a floating-point value.
 
        :returns: posix timestamp
        :rtype: float
        geÍÍA©rrr!rrrÚto_unix•szTimestamp.to_unixcCstt|dƒŽS)z—Create a Timestamp from posix timestamp in nanoseconds.
 
        :param int unix_ns: Posix timestamp in nanoseconds.
        :rtype: Timestamp
        r)rÚdivmod)Úunix_nsrrrÚfrom_unix_nanoszTimestamp.from_unix_nanocCs|jd|jS)z~Get the timestamp as a unixtime in nanoseconds.
 
        :returns: posix timestamp in nanoseconds
        :rtype: int
        rr<r!rrrÚ to_unix_nano¦szTimestamp.to_unix_nanocCstj | ¡t¡S)zlGet the timestamp as a UTC datetime.
 
        Python 2 is not supported.
 
        :rtype: datetime.
        )ÚdatetimeÚ fromtimestampr=Ú_utcr!rrrÚ to_datetime®szTimestamp.to_datetimecCst | ¡¡S)zuCreate a Timestamp from datetime with tzinfo.
 
        Python 2 is not supported.
 
        :rtype: Timestamp
        )rr;Ú    timestamp)ÚdtrrrÚ from_datetime·szTimestamp.from_datetimeN)r)rrrrÚ    __slots__rr"r&r'r)Ú staticmethodr6r8r;r=r@rArErHrrrrr"s&
 
 
 
 
    r)Ú collectionsrrBÚsysr2Ú version_infoÚPY2rÚlongrrDÚtimezoneÚutcÚAttributeErrorÚ    timedeltarÚobjectrrrrrÚ<module>s