
    l8'h                    `   d Z ddlmZ ddlmZmZ g dZdZ	 dZ	 dZ		 dZ
	 d	Z	 d
Z	 ddlmZ ddlmZmZmZ ddlmZmZ ddlmZ ddlmZmZmZmZmZmZmZ ddl m!Z! ddl"m#Z# ddl$m%Z% ddl&m'Z' 	 ddl(m)Z) eZ0	 ddZ1ddZ2y# e*$ r&Z+ddl,Z- e-j\                  de+e/d       Y dZ+[+2dZ+[+ww xY w)zPython driver for MongoDB.    )annotations)ContextManagerOptional)	ASCENDING
DESCENDINGGEO2D	GEOSPHEREHASHEDTEXTversion_tupleget_version_string__version__versionReturnDocumentMAX_SUPPORTED_WIRE_VERSIONMIN_SUPPORTED_WIRE_VERSION
CursorTypeMongoClientAsyncMongoClient
DeleteMany	DeleteOne
IndexModel	InsertOne
ReplaceOne
UpdateMany	UpdateOneReadPreferenceWriteConcernhas_ctimeout   2d2dspherehashedtext)_csot)r   r   r   )r   r   )r   )r   r   r   r   r   r   r   )r   )r   )r   )r   )r   Nz Failed to import Async PyMongo:    )
stacklevelc                 0    	 ddl m}  y# t        $ r Y yw xY w)zIs the C extension installed?r   	_cmessageTF)pymongor,   ImportErrorr+   s    L/var/www/html/trade_iq/venv/lib/python3.12/site-packages/pymongo/__init__.pyr   r   w   s    % s   	 	c                    t        | t        t        t        d      f      st	        d      | r| dk  rt        d      | t        |       } t        j                  |       S )a  **(Provisional)** Apply the given timeout for a block of operations.

    .. note:: :func:`~pymongo.timeout` is currently provisional. Backwards
       incompatible changes may occur before becoming officially supported.

    Use :func:`~pymongo.timeout` in a with-statement::

      with pymongo.timeout(5):
          client.db.coll.insert_one({})
          client.db.coll2.insert_one({})

    When the with-statement is entered, a deadline is set for the entire
    block. When that deadline is exceeded, any blocking pymongo operation
    will raise a timeout exception. For example::

      try:
          with pymongo.timeout(5):
              client.db.coll.insert_one({})
              time.sleep(5)
              # The deadline has now expired, the next operation will raise
              # a timeout exception.
              client.db.coll2.insert_one({})
      except PyMongoError as exc:
          if exc.timeout:
              print(f"block timed out: {exc!r}")
          else:
              print(f"failed with non-timeout error: {exc!r}")

    When nesting :func:`~pymongo.timeout`, the nested deadline is capped by
    the outer deadline. The deadline can only be shortened, not extended.
    When exiting the block, the previous deadline is restored::

      with pymongo.timeout(5):
          coll.find_one()  # Uses the 5 second deadline.
          with pymongo.timeout(3):
              coll.find_one() # Uses the 3 second deadline.
          coll.find_one()  # Uses the original 5 second deadline.
          with pymongo.timeout(10):
              coll.find_one()  # Still uses the original 5 second deadline.
          coll.find_one()  # Uses the original 5 second deadline.

    :param seconds: A non-negative floating point number expressing seconds, or None.

    :raises: :py:class:`ValueError`: When `seconds` is negative.

    See :ref:`timeout-example` for more examples.

    .. versionadded:: 4.2
    Nz(timeout must be None, an int, or a floatr   ztimeout cannot be negative)
isinstanceintfloattype	TypeError
ValueErrorr'   _TimeoutContext)secondss    r/   r    r       s[    d gUDJ78BCC7Q;566.  ))    )returnbool)r8   zOptional[float]r:   zContextManager[None])3__doc__
__future__r   typingr   r   __all__r   r   r   r	   r
   r   r-   r'   pymongo._versionr   r   r   pymongo.commonr   r   pymongo.cursorr   pymongo.operationsr   r   r   r   r   r   r   pymongo.read_preferencesr   pymongo.synchronous.collectionr    pymongo.synchronous.mongo_clientr   pymongo.write_concernr   !pymongo.asynchronous.mongo_clientr   	Exceptionewarnings	_warningswarnImportWarningr   r   r     r9   r/   <module>rP      s    ! " +< 	 
 
 	 
 	  K K Q %   4 9 8 .ZB  !8*)  Z INN5aU;]WXYY	Zs   0B B-B((B-