+\hwFdZddlmZddlmZmZgdZdZ dZ dZ dZ d Z d Z dd l mZdd lmZmZmZdd lmZddlmZmZmZddlmZddlmZmZmZmZm Z m!Z!m"Z"ddl#m$Z$ddl%m&Z&ddl'm(Z(ddl)m*Z*ddl m+Z+ddl m,Z,ddl m-Z-ddl m.Z.ddl m/Z/ddl m0Z0eZ1 ddZ2y)zPython driver for MongoDB.) annotations)ContextManagerOptional) ASCENDING DESCENDINGGEO2D GEOSPHEREHASHEDTEXT version_tupleget_version_string __version__versionReturnDocumentMAX_SUPPORTED_WIRE_VERSIONMIN_SUPPORTED_WIRE_VERSION CursorType MongoClientAsyncMongoClient DeleteMany DeleteOne IndexModel InsertOne ReplaceOne UpdateMany UpdateOneReadPreference WriteConcernhas_ctimeout2d2dspherehashedtext)_csot)rr r )r)rrr)r)rrrrrrr)r)r)r)r) uri_parser) change_stream)client_session) collection)command_cursor)databasect|tttdfst dt||r|dkr 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 float, not rztimeout cannot be negative) isinstanceintfloattype TypeError ValueErrorr'_TimeoutContext)secondss S/root/niggaflix-v3/playground/venv/lib/python3.12/site-packages/pymongo/__init__.pyr r zsfd gUDJ7 8HgXYY7Q;566.   ))N)r6zOptional[float]returnzContextManager[None])3__doc__ __future__rtypingrr__all__rrrr r r pymongor'pymongo._versionrr r !pymongo.asynchronous.mongo_clientrpymongo.commonrrrpymongo.cursorrpymongo.operationsrrrrrrrpymongo.read_preferencesrpymongo.synchronous.collectionr pymongo.synchronous.mongo_clientrpymongo.write_concernrr(r)r*r+r,r-rr r8r7rIs!"+ <         KK>XX%498.!"" !8*r8