Ë
    Ü_Ëi®  ã                  óh   — d Z ddlmZ ddlZddlZddlmZmZ ddlm	Z	m
Z
 ddlmZ dZ G d„ d	«      Zy)
z3Tools for representing MongoDB internal Timestamps.é    )ÚannotationsN)ÚAnyÚUnion)Ú_getstate_slotsÚ_setstate_slots)Úutcl        c                  ó”   — e Zd ZdZdZeZeZdZ	dd„Z
edd„«       Zedd„«       Zdd„Zdd„Zdd	„Zdd
„Zdd„Zdd„Zdd„Zdd„Zdd„Zy)Ú	Timestampz.MongoDB internal timestamps used in the opLog.)Ú__timeÚ__incé   c                ó  — t        |t        j                  «      rC|j                  «       }|�||z
  }t        t	        j
                  |j                  «       «      «      }t        |t        «      st        dt        |«      › �«      ‚t        |t        «      st        dt        |«      › �«      ‚d|cxk  rt        k  st        d«      ‚ t        d«      ‚d|cxk  rt        k  st        d«      ‚ t        d«      ‚|| _        || _        y)a“  Create 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 r   z$time must be contained in [0, 2**32)z#inc must be contained in [0, 2**32))Ú
isinstanceÚdatetimeÚ	utcoffsetÚintÚcalendarÚtimegmÚ	timetupleÚ	TypeErrorÚtypeÚ
UPPERBOUNDÚ
ValueErrorÚ_Timestamp__timeÚ_Timestamp__inc)ÚselfÚtimeÚincÚoffsets       úQ/var/www/pod-logistic/pod-api/venv/lib/python3.12/site-packages/bson/timestamp.pyÚ__init__zTimestamp.__init__&   sí   € ô" �dœH×-Ñ-Ô.Ø—^‘^Ó%ˆFØÐ!Ø˜f‘}�Ü”x—‘ t§~¡~Ó'7Ó8Ó9ˆDÜ˜$¤Ô$ÜÐCÄDÈÃJÀ<ÐPÓQÐQÜ˜#œsÔ#ÜÐBÄ4ÈÃ9À+ÐNÓOÐOØ�DÔ%œ:Ò%ÜÐCÓDÐDð &ÜÐCÓDÐDØ�CÔ$œ*Ò$ÜÐBÓCÐCð %ÜÐBÓCÐCàˆŒØˆ�
ó    c                ó   — | j                   S )z0Get the time portion of this :class:`Timestamp`.)r   ©r   s    r    r   zTimestamp.timeH   s   € ð �{‰{Ðr"   c                ó   — | j                   S )z/Get the inc portion of this :class:`Timestamp`.)r   r$   s    r    r   zTimestamp.incM   s   € ð �z‰zÐr"   c                ó–   — t        |t        «      r4| j                  |j                  k(  xr | j                  |j
                  k(  S t        S ©N)r   r
   r   r   r   r   ÚNotImplemented©r   Úothers     r    Ú__eq__zTimestamp.__eq__R   s7   € Ü�eœYÔ'Ø—;‘; %§*¡*Ñ,ÒH°·±¸u¿y¹yÑ1HÐHä!Ð!r"   c                óX   — t        | j                  «      t        | j                  «      z  S r'   )Úhashr   r   r$   s    r    Ú__hash__zTimestamp.__hash__X   s   € Ü�D—I‘I‹¤ d§h¡h£Ñ/Ð/r"   c                ó   — | |k(   S r'   © r)   s     r    Ú__ne__zTimestamp.__ne__[   s   € Ø˜5‘=Ð Ð r"   c                ó�   — t        |t        «      r1| j                  | j                  f|j                  |j                  fk  S t        S r'   ©r   r
   r   r   r(   r)   s     r    Ú__lt__zTimestamp.__lt__^   ó7   € Ü�eœYÔ'Ø—I‘I˜tŸx™xÐ(¨E¯J©J¸¿	¹	Ð+BÑBÐBÜÐr"   c                ó�   — t        |t        «      r1| j                  | j                  f|j                  |j                  fk  S t        S r'   r3   r)   s     r    Ú__le__zTimestamp.__le__c   ó7   € Ü�eœYÔ'Ø—I‘I˜tŸx™xÐ(¨U¯Z©Z¸¿¹Ð,CÑCÐCÜÐr"   c                ó�   — t        |t        «      r1| j                  | j                  f|j                  |j                  fkD  S t        S r'   r3   r)   s     r    Ú__gt__zTimestamp.__gt__h   r5   r"   c                ó�   — t        |t        «      r1| j                  | j                  f|j                  |j                  fk\  S t        S r'   r3   r)   s     r    Ú__ge__zTimestamp.__ge__m   r8   r"   c                ó<   — d| j                   › d| j                  › d�S )Nz
Timestamp(z, ú))r   r   r$   s    r    Ú__repr__zTimestamp.__repr__r   s   € Ø˜DŸK™K˜=¨¨4¯:©:¨,°aÐ8Ð8r"   c                ó^   — t         j                   j                  | j                  t        «      S )z®Return a :class:`~datetime.datetime` instance corresponding
        to the time portion of this :class:`Timestamp`.

        The returned datetime's timezone is UTC.
        )r   Úfromtimestampr   r   r$   s    r    Úas_datetimezTimestamp.as_datetimeu   s!   € ô × Ñ ×.Ñ.¨t¯{©{¼CÓ@Ð@r"   N)r   zUnion[datetime.datetime, int]r   r   ÚreturnÚNone)rC   r   )r*   r   rC   Úbool)rC   Ústr)rC   zdatetime.datetime)Ú__name__Ú
__module__Ú__qualname__Ú__doc__Ú	__slots__r   Ú__getstate__r   Ú__setstate__Ú_type_markerr!   Úpropertyr   r   r+   r.   r1   r4   r7   r:   r<   r?   rB   r0   r"   r    r
   r
      su   „ Ù8à#€Ià"€LØ"€Là€Ló ðD òó ðð òó ðó"ó0ó!óó
ó
ó
ó
9ôAr"   r
   )rJ   Ú
__future__r   r   r   Útypingr   r   Úbson._helpersr   r   Úbson.tz_utilr   r   r
   r0   r"   r    ú<module>rT      s/   ðñ :Ý "ã Û ß ç :Ý à€
÷_Aò _Ar"   