+\hhdZddlmZddlZddlZddlmZmZddlm Z m Z ddl m Z dZ Gdd Zy) z3Tools for representing MongoDB internal Timestamps.) annotationsN)AnyUnion)_getstate_slots_setstate_slots)utclceZdZdZdZeZeZdZ ddZ e ddZ e ddZ ddZddZdd Zdd Zdd Zdd Zdd ZddZddZy) Timestampz.MongoDB internal timestamps used in the opLog.)__time__incct|tjrC|j}|||z }tt j |j }t|tstdt|t|tstdt|d|cxkrtkstdtdd|cxkrtkstdtd||_ ||_ y)aCreate a new :class:`Timestamp`. This class is only for use with the MongoDB opLog. If you need to store a regular timestamp, please use a :class:`~datetime.datetime`. Raises :class:`TypeError` if `time` is not an instance of :class: `int` or :class:`~datetime.datetime`, or `inc` is not an instance of :class:`int`. Raises :class:`ValueError` if `time` or `inc` is not in [0, 2**32). :param time: time in seconds since epoch UTC, or a naive UTC :class:`~datetime.datetime`, or an aware :class:`~datetime.datetime` :param inc: the incrementing counter Nz%time must be an instance of int, not z$inc must be an instance of int, not rz$time must be contained in [0, 2**32)z#inc must be contained in [0, 2**32)) isinstancedatetime utcoffsetintcalendartimegm timetuple TypeErrortype UPPERBOUND ValueError_Timestamp__time_Timestamp__inc)selftimeincoffsets Q/root/niggaflix-v3/playground/venv/lib/python3.12/site-packages/bson/timestamp.py__init__zTimestamp.__init__&s" dH-- .^^%F!f}xt~~'789D$$CDJ<PQ Q#s#B49+NO OD%:%CD D&CD DC$*$BC C%BC C  c|jS)z0Get the time portion of this :class:`Timestamp`.)rrs r rzTimestamp.timeHs{{r"c|jS)z/Get the inc portion of this :class:`Timestamp`.)rr$s r rz Timestamp.incMszzr"ct|tr4|j|jk(xr|j|j k(St SN)rr rrrrNotImplementedrothers r __eq__zTimestamp.__eq__Rs7 eY ';;%**,Huyy1H H! !r"cXt|jt|jz Sr')hashrrr$s r __hash__zTimestamp.__hash__XsDIIdhh//r"c||k( Sr'r)s r __ne__zTimestamp.__ne__[s5=  r"ct|tr1|j|jf|j|jfkStSr'rr rrr(r)s r __lt__zTimestamp.__lt__^7 eY 'IItxx(EJJ +BB Br"ct|tr1|j|jf|j|jfkStSr'r3r)s r __le__zTimestamp.__le__c7 eY 'IItxx(UZZ,CC Cr"ct|tr1|j|jf|j|jfkDStSr'r3r)s r __gt__zTimestamp.__gt__hr5r"ct|tr1|j|jf|j|jfk\StSr'r3r)s r __ge__zTimestamp.__ge__mr8r"c<d|jd|jdS)Nz Timestamp(z, ))rrr$s r __repr__zTimestamp.__repr__rsDKK=4::,a88r"c^tjj|jtS)zReturn a :class:`~datetime.datetime` instance corresponding to the time portion of this :class:`Timestamp`. The returned datetime's timezone is UTC. )r fromtimestamprrr$s r as_datetimezTimestamp.as_datetimeus!   ..t{{C@@r"N)rzUnion[datetime.datetime, int]rrreturnNone)rCr)r*rrCbool)rCstr)rCzdatetime.datetime)__name__ __module__ __qualname____doc__ __slots__r __getstate__r __setstate__ _type_markerr!propertyrrr+r.r1r4r7r:r<r?rBr0r"r r r su8#I"L"LL D" 0!    9Ar"r )rJ __future__rrrtypingrr bson._helpersrr bson.tz_utilrrr r0r"r rTs/:":  _A_Ar"