+
    8i!                    b   R t ^ RIHt ^ RIt^ RIt^ RIt^ RIt^ RIt^ RIH	t	 ^ RI
HtHtHtHtHt ^ RIHt ^ RIHt ^ RIHt Rt]P.                  ! R	4      P0                  t]P.                  ! R
4      P0                  t]P.                  ! R	4      P6                  tR R ltR R lt ! R R4      tR# )z)Tools for working with MongoDB ObjectIds.)annotationsN)SystemRandom)AnyNoReturnOptionalTypeUnion)_datetime_to_millis	InvalidId)utci z>Iz>I5sc                    V ^8  d   QhRRRR/# )   oidstrreturnr    )formats   "K/var/www/html/photoedit/myenv/lib/python3.14/site-packages/bson/objectid.py__annotate__r   $   s      3 8     c                &    \        R V ,          4      h)zS%r is not a valid ObjectId, it must be a 12-byte input or a 24-character hex stringr
   )r   s   &r   _raise_invalid_idr   $   s    
	(*-	. r   c                   V ^8  d   QhRR/# r   r   bytesr   )r   s   "r   r   r   +   s      u r   c                 .    \         P                  ! ^4      # )z+Get the 5-byte random field of an ObjectId.)osurandomr   r   r   _random_bytesr   +   s    ::a=r   c                     ] tR t^0tRt]P                  ! 4       t]! 4       P                  ^ ]
4      t]P                  ! 4       t]! 4       tR%t^tR&R R llt]R R l4       t]R R l4       t]R	 R
 l4       t]R R l4       t]R R l4       tR R ltR R ltR R ltR R ltR R ltR R lt R R lt!R R lt"R R  lt#R! R" lt$R# R$ lt%R%t&R# )'ObjectIdzA MongoDB ObjectId.Nc                    V ^8  d   QhRRRR/# )r   r   z%Optional[Union[str, ObjectId, bytes]]r   Noner   )r   s   "r   r   ObjectId.__annotate__>   s     :b :bA :bT :br   c                N   Vf   \         P                  ;_uu_ 4        \         P                  pV^,           \        ^,           ,          \         n        RRR4       \	        \        \        P                  ! 4       4      \         P                  4       4      \        X4      R,          ,           V n	        R# \        V\        4      '       d   \        V4      ^8X  d	   Wn	        R# \        V\        4      '       d;   \        V4      ^8X  d    \        P                  V4      V n	        R# \#        V4       R# \        V\         4      '       d   VP$                  V n	        R# \        R\'        V4       24      h  + '       g   i     EL'; i  \        \         3 d    \#        T4        R# i ; i)a  Initialize a new ObjectId.

An ObjectId is a 12-byte unique identifier consisting of:

  - a 4-byte value representing the seconds since the Unix epoch,
  - a 5-byte random value,
  - a 3-byte counter, starting with a random value.

By default, ``ObjectId()`` creates a new unique identifier. The
optional parameter `oid` can be an :class:`ObjectId`, or any 12
:class:`bytes`.

For example, the 12 bytes b'foo-bar-quux' do not follow the ObjectId
specification but they are acceptable input::

  >>> ObjectId(b'foo-bar-quux')
  ObjectId('666f6f2d6261722d71757578')

`oid` can also be a :class:`str` of 24 hex digits::

  >>> ObjectId('0123456789ab0123456789ab')
  ObjectId('0123456789ab0123456789ab')

Raises :class:`~bson.errors.InvalidId` if `oid` is not 12 bytes nor
24 hex digits, or :class:`TypeError` if `oid` is not an accepted type.

:param oid: a valid ObjectId.

.. seealso:: The MongoDB documentation on  `ObjectIds <http://dochub.mongodb.org/core/objectids>`_.

.. versionchanged:: 3.8
   :class:`~bson.objectid.ObjectId` now implements the `ObjectID
   specification version 0.2
   <https://github.com/mongodb/specifications/blob/master/source/
   objectid.rst>`_.
N:      Nz6id must be an instance of (bytes, str, ObjectId), not )r!   	_inc_lock_inc_MAX_COUNTER_VALUE_PACK_INT_RANDOMinttime_random	_PACK_INT_ObjectId__id
isinstancer   lenr   fromhex	TypeError
ValueErrorr   binarytype)selfr   incs   && r   __init__ObjectId.__init__>   s   J ;###mm!$q-?!-C D $
 )TYY[)98;K;K;MNQZ[^Q_`cQddDIU##CBIS!!3x2~+ %c 2DI "#&X&&

DITUYZ]U^T_`aa' $## ":. +%c*+s   5E0F 0F	F$#F$c               $    V ^8  d   QhRRRRRR/# )r   clsType[ObjectId]generation_timedatetime.datetimer   r!   r   )r   s   "r   r   r$   {   s#      > <M RZ r   c                V    \        \        V4      R,          4      R,           pV ! V4      # )a  Create a dummy ObjectId instance with a specific generation time.

This method is useful for doing range queries on a field
containing :class:`ObjectId` instances.

.. warning::
   It is not safe to insert a document containing an ObjectId
   generated using this method. This method deliberately
   eliminates the uniqueness guarantee that ObjectIds
   generally provide. ObjectIds generated with this method
   should be used exclusively in queries.

`generation_time` will be converted to UTC. Naive datetime
instances will be treated as though they already contain UTC.

An example using this helper to get documents where ``"_id"``
was generated before January 1, 2010 would be:

>>> gen_time = datetime.datetime(2010, 1, 1)
>>> dummy_id = ObjectId.from_datetime(gen_time)
>>> result = collection.find({"_id": {"$lt": dummy_id}})

:param generation_time: :class:`~datetime.datetime` to be used
    as the generation time for the resulting ObjectId.
i  s           )r/   r	   )r=   r?   r   s   && r   from_datetimeObjectId.from_datetimez   s/    8 )/:dBC12 	 3xr   c               $    V ^8  d   QhRRRRRR/# )r   r=   r>   r   r   r   boolr   )r   s   "r   r   r$      s!      n 3 4 r   c                b    V'       g   R#  \        V4       R#   \        \        3 d     R# i ; i)zhChecks if a `oid` string is valid or not.

:param oid: the object id to validate

.. versionadded:: 2.3
FT)r!   r   r4   )r=   r   s   &&r   is_validObjectId.is_valid   s0     	SM9% 		s    ..c                   V ^8  d   QhRR/# r   r   )r   s   "r   r   r$      s       r   c                    \         P                  ! 4       pWP                  8w  d   Wn        \        4       V n        V P                  # )z1Generate a 5-byte random number once per process.)r   getpid_pidr   _ObjectId__random)r=   pids   & r   r.   ObjectId._random   s0     iik((?H(?CL||r   c                   V ^8  d   QhRR/# r   r   )r   s   "r   r   r$      s       r   c                    V P                   # )z/12-byte binary representation of this ObjectId.r0   r8   s   &r   r6   ObjectId.binary   s     yyr   c                   V ^8  d   QhRR/# )r   r   r@   r   )r   s   "r   r   r$      s     	? 	?!2 	?r   c                    \        V P                  R,          4      ^ ,          p\        P                  P                  V\        4      # )zA :class:`datetime.datetime` instance representing the time of
generation for this :class:`ObjectId`.

The :class:`datetime.datetime` is timezone aware, and
represents the generation time in UTC. It is precise to the
second.
:    r'   N)_UNPACK_INTr0   datetimefromtimestampr   )r8   	timestamps   & r   r?   ObjectId.generation_time   s4      		#/2	  ..y#>>r   c                   V ^8  d   QhRR/# r   r   )r   s   "r   r   r$      s      e r   c                    V P                   # )zTReturn value of object for pickling.
needed explicitly because __slots__() defined.
rR   rS   s   &r   __getstate__ObjectId.__getstate__   s     yyr   c                    V ^8  d   QhRRRR/# )r   valuer   r   r#   r   )r   s   "r   r   r$      s      # $ r   c                    \        V\        4      '       d   VR,          pMTp\        V\        4      '       d   VP                  R4      V n        R# W n        R# )z Explicit state set from picklingr0   zlatin-1N)r1   dictr   encoder0   )r8   rb   r   s   && r   __setstate__ObjectId.__setstate__   sD     eT""(CC c3

9-DIIr   c                   V ^8  d   QhRR/# r   r   r   r   )r   s   "r   r   r$      s       r   c                	6    V P                   P                  4       # N)r0   hexrS   s   &r   __str__ObjectId.__str__   s    yy}}r   c                   V ^8  d   QhRR/# ri   r   )r   s   "r   r   r$      s     ' '# 'r   c                	    R V : R2# )z
ObjectId('z')r   rS   s   &r   __repr__ObjectId.__repr__   s    D82&&r   c                    V ^8  d   QhRRRR/# r   otherr   r   rE   r   )r   s   "r   r   r$            C D r   c                	l    \        V\        4      '       d   V P                  VP                  8H  # \        # rk   r1   r!   r0   r6   NotImplementedr8   ru   s   &&r   __eq__ObjectId.__eq__   (    eX&&99,,r   c                    V ^8  d   QhRRRR/# rt   r   )r   s   "r   r   r$      rv   r   c                	l    \        V\        4      '       d   V P                  VP                  8g  # \        # rk   rx   rz   s   &&r   __ne__ObjectId.__ne__   r}   r   c                    V ^8  d   QhRRRR/# rt   r   )r   s   "r   r   r$      rv   r   c                	l    \        V\        4      '       d   V P                  VP                  8  # \        # rk   rx   rz   s   &&r   __lt__ObjectId.__lt__   (    eX&&99u||++r   c                    V ^8  d   QhRRRR/# rt   r   )r   s   "r   r   r$      rv   r   c                	l    \        V\        4      '       d   V P                  VP                  8*  # \        # rk   rx   rz   s   &&r   __le__ObjectId.__le__   r}   r   c                    V ^8  d   QhRRRR/# rt   r   )r   s   "r   r   r$      rv   r   c                	l    \        V\        4      '       d   V P                  VP                  8  # \        # rk   rx   rz   s   &&r   __gt__ObjectId.__gt__   r   r   c                    V ^8  d   QhRRRR/# rt   r   )r   s   "r   r   r$      rv   r   c                	l    \        V\        4      '       d   V P                  VP                  8  # \        # rk   rx   rz   s   &&r   __ge__ObjectId.__ge__   r}   r   c                   V ^8  d   QhRR/# )r   r   r,   r   )r   s   "r   r   r$      s      # r   c                ,    \        V P                  4      # )z,Get a hash value for this :class:`ObjectId`.)hashr0   rS   s   &r   __hash__ObjectId.__hash__   s    DIIr   )__idrk   )'__name__
__module____qualname____firstlineno____doc__r   rK   rL   r   randintr*   r)   	threadingLockr(   r   rM   	__slots___type_markerr:   classmethodrB   rG   r.   propertyr6   r?   r_   rf   rm   rq   r{   r   r   r   r   r   r   __static_attributes__r   r   r   r!   r!   0   s    99;D>!!!%78D IHIL:bx  @        	? 	? '





 r   r!   ) r   
__future__r   rY   r   structr   r-   randomr   typingr   r   r   r   r   bson.datetime_msr	   bson.errorsr   bson.tz_utilr   r*   Structpackr/   r+   unpackrX   r   r   r!   r   r   r   <module>r      s    0 "  	     7 7 0 !  MM$$$	==(-- mmD!((
R Rr   