+\hC3dZddlmZddlmZmZmZmZmZddl m Z GddZ Gdde Z Gd d e Z Gd d e ZGd de ZGdde ZGddeZGddeZy)z{Result class definitions. .. seealso:: This module is compatible with both the synchronous and asynchronous PyMongo APIs. ) annotations)AnyMappingMutableMappingOptionalcast)InvalidOperationc>eZdZdZdZddZd dZd dZed dZ y) _WriteResultz$Base class for write result classes.)__acknowledgedc||_yN_WriteResult__acknowledged)self acknowledgeds R/root/niggaflix-v3/playground/venv/lib/python3.12/site-packages/pymongo/results.py__init__z_WriteResult.__init__s *cN|jjd|jdS)N()) __class____name__rrs r__repr__z_WriteResult.__repr__"s'..))*!D,?,?+@BBrc:|jstd|dy)z8Raise an exception on property access if unacknowledged. A value for zi is not available when the write is unacknowledged. Check the acknowledged attribute to avoid this error.N)rr r property_names r_raise_if_unacknowledgedz%_WriteResult._raise_if_unacknowledged%s."""}o. #rc|jS)aCIs this the result of an acknowledged write operation? The :attr:`acknowledged` attribute will be ``False`` when using ``WriteConcern(w=0)``, otherwise ``True``. .. note:: If the :attr:`acknowledged` attribute is ``False`` all other attributes of this class will raise :class:`~pymongo.errors.InvalidOperation` when accessed. Values for other attributes cannot be determined if the write operation was unacknowledged. .. seealso:: :class:`~pymongo.write_concern.WriteConcern` rrs rrz_WriteResult.acknowledged/s""""rN)rboolreturnNoner$strr r'r$r%r$r#) r __module__ __qualname____doc__ __slots__rrr!propertyrrrr r s..#I+C##rr cBeZdZdZdZdfd ZddZeddZxZ S) InsertOneResultzThe return type for :meth:`~pymongo.collection.Collection.insert_one` and as part of :meth:`~pymongo.mongo_client.MongoClient.bulk_write`. ) __inserted_idc2||_t| |yr)_InsertOneResult__inserted_idsuperr)r inserted_idrrs rrzInsertOneResult.__init__Js( &rch|jjd|jd|jdSNrz, acknowledged=r)rrr4rrs rrzInsertOneResult.__repr__Ns7~~&&'q););(>odN_N_M``a b rc|jS)zThe inserted document's _id.)r4rs rr6zInsertOneResult.inserted_idSs!!!r)r6rrr#r$r%r&r$r) rr*r+r,r-rrr.r6 __classcell__rs@rr1r1Cs-#I' ""rr1cBeZdZdZdZdfd ZddZeddZxZ S) InsertManyResultzGThe return type for :meth:`~pymongo.collection.Collection.insert_many`.)__inserted_idsc2||_t| |yr)_InsertManyResult__inserted_idsr5r)r inserted_idsrrs rrzInsertManyResult.__init__^s* &rch|jjd|jd|jdSr8)rrrArrs rrzInsertManyResult.__repr__bs7~~&&'q)<)<(?tO`O`Naab c rc|jS)a@A list of _ids of the inserted documents, in the order provided. .. note:: If ``False`` is passed for the `ordered` parameter to :meth:`~pymongo.collection.Collection.insert_many` the server may have inserted the documents in a different order than what is presented here. )rArs rrBzInsertManyResult.inserted_idsgs"""r)rB list[Any]rr#r$r%r&)r$rE) rr*r+r,r-rrr.rBr;r<s@rr>r>Ys)Q#I' ##rr>ceZdZdZdZ d d fd Zd dZed dZeddZ eddZ eddZ edd Z xZ S) UpdateResultaThe return type for :meth:`~pymongo.collection.Collection.update_one`, :meth:`~pymongo.collection.Collection.update_many`, and :meth:`~pymongo.collection.Collection.replace_one`, and as part of :meth:`~pymongo.mongo_client.MongoClient.bulk_write`. ) __raw_result__in_client_bulkc@||_||_t| |yr)_UpdateResult__raw_result_UpdateResult__in_client_bulkr5r)r raw_resultrin_client_bulkrs rrzUpdateResult.__init__s" ' . &rch|jjd|jd|jdSr8)rrrKrrs rrzUpdateResult.__repr__6..))*!D,=,=+@PTPaPaObbcddrc|jSz/The raw result document returned by the server.rKrs rrMzUpdateResult.raw_result   rc|jd|jJ|js |jy|jj ddS)z0The number of documents matched for this update. matched_countrn)r!rKrL upserted_idgetrs rrVzUpdateResult.matched_countsT %%o6  ,,,$$)9)9)E  $$S!,,rc|jd|jJtt|jj dSz!The number of documents modified.modified_count nModified)r!rKrintrYrs rr\zUpdateResult.modified_countsC %%&67  ,,,C**..{;<An object wrapper for collection-level bulk write API results.r/c&t|||y)a@Create a BulkWriteResult instance. :param bulk_api_result: A result dict from the collection-level bulk write API :param acknowledged: Was this write result acknowledged? If ``False`` then all properties of this object will raise :exc:`~pymongo.errors.InvalidOperation`. N)r5rrus rrzBulkWriteResult.__init__ s ,7rch|jjd|jd|jdSr8)rrrvrrs rrzBulkWriteResult.__repr__s8~~&&'q)=)=(@PTPaPaObbc d rc|jd|jr$|jdDcic] }|d|d c}Sycc}w)z=A map of operation index to the _id of the upserted document. upserted_idsr`indexraN)r!rv)rupserts rrzBulkWriteResult.upserted_idssN %%n5   AEAUAUV`AabvF7OVE]2b bcsArr&)r$zOptional[dict[int, Any]]) rr*r+r,r-rrr.rr;r<s@rrrs)HI8 rrceZdZdZdZ d fd Zd dZd dZed dZ eddZ eddZ edd Z xZ S)ClientBulkWriteResultz:An object wrapper for client-level bulk write API results.)__has_verbose_resultsc4||_t| ||y)aUCreate a ClientBulkWriteResult instance. :param bulk_api_result: A result dict from the client-level bulk write API :param acknowledged: Was this write result acknowledged? If ``False`` then all properties of this object will raise :exc:`~pymongo.errors.InvalidOperation`. :param has_verbose_results: Should the returned result be verbose? If ``False``, then the ``insert_results``, ``update_results``, and ``delete_results`` properties of this object will raise :exc:`~pymongo.errors.InvalidOperation`. N)+_ClientBulkWriteResult__has_verbose_resultsr5r)rrvrhas_verbose_resultsrs rrzClientBulkWriteResult.__init__&s "&9"    rcdj|jj|j|j|j S)Nz%{}({!r}, acknowledged={}, verbose={}))formatrrrvrrrs rrzClientBulkWriteResult.__repr__=s=6== NN # #      $ $   rc:|jstd|dy)zARaise an exception on property access if verbose results are off.rzv is not available when the results are not set to be verbose. Check the verbose_results attribute to avoid this error.N)rr rs r_raise_if_not_verbosez+ClientBulkWriteResult._raise_if_not_verboseEs0))"}o.AA *rc|jS)z/Whether the returned results should be verbose.)rrs rrz)ClientBulkWriteResult.has_verbose_resultsNs)))rc|jd|jdtttt f|j jdS)z:A map of successful insertion operations to their results.insert_results insertResults)r!rrrr^r1rvrYrs rrz$ClientBulkWriteResult.insert_resultsSsP %%&67 ""#34 C( )  $ $_ 5  rc|jd|jdtttt f|j jdS)z7A map of successful update operations to their results.update_results updateResults)r!rrrr^rGrvrYrs rrz$ClientBulkWriteResult.update_results]P %%&67 ""#34 C% &  $ $_ 5  rc|jd|jdtttt f|j jdS)z7A map of successful delete operations to their results.delete_results deleteResults)r!rrrr^rgrvrYrs rrz$ClientBulkWriteResult.delete_resultsgrr)rvzMutableMapping[str, Any]rr#rr#r$r%r&r(r))r$zMapping[int, InsertOneResult])r$zMapping[int, UpdateResult])r$zMapping[int, DeleteResult])rr*r+r,r-rrrr.rrrrr;r<s@rrr!sD*I 1  "    . **      rrN)r, __future__rtypingrrrrrpymongo.errorsr r r1r>rGrgrqrrr/rrrs#??+&#&#R"l",#|#4@/<@/F-<-60B<0Bf*:N 0N r