f9  UdZddlmZddlZddlZddlZddlZddlmZ ddl m Z m Z m Z mZmZmZmZmZmZddlZddlmZmZmZmZmZddlmZddlmZmZmZm Z  dd l!m"Z"d Z#dd l%m&Z&m'Z'm(Z(m)Z)m*Z*m+Z+m,Z,m-Z-dd l.m/Z/ddl0m1Z1ddl2m3Z3m4Z4m5Z5ddl6m7Z7ddl8m9Z9e rZ>m?Z?m@Z@ddlAmBZBddlCmDZDddlEmFZFddlGmHZHddl6mIZIddlJmKZKmLZLdZMdZNdZOdZPdZQdZRd ZSd!ZTd"ZUd#ZVd$ZWd%ZXd&ZYePd'eQd(eRd)iZZd*d+d,d-Z[ed./Z\d0e]d1<d~d2Z^ dd3Z_dd4Z` dd5Zadd6d7d8d9d:Zbd;dd?d@dAdBdCdDdDdEdF Zc d ddGZd ddHZeGdIdJZfGdKdLZgGdMdNefZhGdOdPegZiGdQdRejZkejdSjZndTZo ddUZpejdVjZqddWZrejdXjZsejdYjZtejdZjZu dd[Zv dd\Zw dd]Zxe#r e"jZx d dd^Zy dd_Zz dd`Z{ ddaZ|e#r e"jZ| d ddbZ~ejdcjZdddZ ddeZ ddfZe#r e"jZ d ddgZGdhdiZdjZGdkdleZddmZePdneQdoeRdpiZ ddqZ ddrZe#r e"jZ ddsZ ddtZe#r e"jZ dduZ ddvZe#r e"jZ ddwZGdxdyZGdzd{Zej&ej(ej&ej(iZd|e]d}<y#e$$rd Z#YwxYw)zTools for creating `messages `_ to be sent to MongoDB. .. note:: This module is for internal use and is generally not needed by application developers. ) annotationsN)BytesIO) TYPE_CHECKINGAnyCallableIterableMappingMutableMappingNoReturnOptionalUnion) CodecOptions_decode_selective _dict_to_bson_make_c_stringencode)Int64)_RAW_ARRAY_BSON_OPTIONSDEFAULT_RAW_BSON_OPTIONSRawBSONDocument _inflate_bson) _cmessageTF)ConfigurationErrorCursorNotFoundDocumentTooLargeExecutionTimeoutInvalidOperationNotPrimaryErrorOperationFailure ProtocolError) HelloCompat)_handle_reauth)_COMMAND_LOGGER_CommandStatusMessage _debug_log)ReadPreference) WriteConcern) timedelta) ClientSession) SnappyContext ZlibContext ZstdContext) MongoClient)_EventListeners) Connection) ReadConcern) _ServerMode)_Address _DocumentOutiii?ssssdocumentss updatess deletes documentsupdatesdeletes)insertupdatedeletereplace)unicode_decode_error_handlerzCodecOptions[Mapping[str, Any]]_UNICODE_REPLACE_CODEC_OPTIONSc>tjttS)z(Generate a pseudo random 32 bit integer.)randomrandint MIN_INT32 MAX_INT32r6X/var/lib/jenkins/workspace/mettalog/venv/lib/python3.12/site-packages/pymongo/message.py_randintrJrs >>)Y //r6c|j}|j}|r8|tjjk7st |dkDr d|vrd|i}||d<|S)z-Add $readPreference to spec when appropriate.r4$query$readPreference)modedocumentr&SECONDARY_PREFERREDlen)specread_preferencerNrOs rI_maybe_add_read_preferencerTws`   D''H  ;;@@@CMTUDU 4 d#D"*  Kr6cFt||jjdS)zupserted)rh_idupdatedExistingFr;urkq)getrQ) operationcommandresultaffectedresrVerrorr>rks rI_convert_write_resultrvsU zz#q!H "C ZZ&**UB"7 8F ::j !28"R\^bQc'dC# $ FA)>&QEF"#))#4i "'C JHw{+,C J h   )*6*3EFGC O J ZZ) *e 3A Y'*F+//%)?@C)*378C O Jr6rg )tailable oplogReplaynoCursorTimeout awaitDataallowPartialResultsfiltersorthintcommentmaxScan maxTimeMSmaxmin returnKey showRecordIdsnapshot) rLz$orderbyz$hintz$commentz$maxScanz $maxTimeMSz$maxz$minz $returnKeyz $showRecordIdz $showDiskLocz $snapshotc hd|i} d|vrr| j|jD cgc]\} } | tvr t| | fn| | fc} } d| vr| jdd| vr| jdn|| d<|r|| d<|r|| d<|rt || d<|d krd | d <|r|| d <|j r| r | j s|j| d <|r|| d<| | | d<|r>| jtjD cgc]\}} || zs |d fc} }| Scc} } wcc} }w)z!Generate a find command document.findrL$explainrMr projectionskiplimitrT singleBatch batchSize readConcern collation allowDiskUse) r>items _MODIFIERSpopabslevelin_transactionrO_OPTIONS)collrRrrr batch_sizeoptions read_concernrsessionallow_disk_usecmdkeyvalopts rI_gen_find_commandrsV"4.C4 !%  C+.*;C#&#sK    GGJ   # GG% &H &L F  5zG 19!%C %K7w/E/E)22M$K!,N 0@RHCGcMS$KRS J? :Ss!D( D. D. cX||d}|r||d<|||d<||jdk\r||d<|S)z$Generate a getMore command document.)getMore collectionrr r)max_wire_version) cursor_idrrmax_await_time_msrconnrs rI_gen_get_more_commandrsL'0tDC%K$,Kt449 I Jr6ceZdZdZdZdZdZ d dZd dZd dZ d dZ d ddZ d dd Z y)_QueryzA query operation.)flagsdbrntoskiprRfields codec_optionsrSrrnamerrrclientr _as_commandexhaustNc||_||_||_||_||_||_||_||_| |_| |_ | |_ | |_ | |_ ||_ ||_d|_d|_||_y)Nr)rrrrrRrrrSrrrrrrrrrr)selfrrrrrRrrrSrrrrrrrrs rI__init__z_Query.__init__-s&     *.( $"  , AE r6cd|_yNrrs rIresetz _Query.resetS r6c8|jd|jSN.rrrs rI namespacez_Query.namespaceV''!DII;''r6c d}|jsd}nV|jdk\rd}nD|jjs.t d|jj |jfz|j |j|j|S)NFTrgzDread concern level of %s is not valid with a max wire version of %d.) rrr ok_for_legacyrrvalidate_sessionrr)rr use_find_cmds rI use_commandz_Query.use_commandYs ||L  " "a 'L""00$1484E4E4K4KTMbMb3cd  dkk4<<8r6c |j |jSd|jv}t|j|j|j|j |j |j|j|j|j|j|j }|r d|_ d|i}|j}|j||r>|j|d|j ||s|j"s|j%|||j'|||j(|j(}|j*rG|j*j,s1|j*j/|j0||j2}|r|j5||||j0f|_|jS)z.Return a find command document for this query.rexplainF)rrRrrrrrrrrrrrradd_server_api _apply_torSr_update_read_concernsend_cluster_timer _encrypter_bypass_auto_encryptionencryptrr apply_timeout)rrrrrrrs rI as_commandz_Query.as_commandiss    '## # )/ II II KK LL JJ OO JJ    NN LL      !DIc"C,, C    c5$*>*> E7#9#9,,S$7 sGT[[9   V%6%6%N%N##++DGGS$:L:LMC    vs +<r6c ||_|jr|jdz}n |j}|j}|j}|rO|j |dd}t d||j||j|j\}}} } ||| fS|jdk(xrdxs |j} |jr%| rt|j| } n |j} |jrt|tsJt!||}t#|||j$| ||rdn |j&|j|jS) z:Get a query message, possibly setting the secondaryOk bit.Trrctxr4r5N)rSrNrrrRr_op_msgrrcompression_contextrrr is_mongos isinstancer rT_queryrr) rrSruse_cmdrnsrR request_idmsgsize_ ntoreturns rI get_messagez_Query.get_messages? /   JJNEJJE ^^ yy ??4t?>dN3 33-dODD   LL  D   ((  r6) rintrrXrrXrrrRMapping[str, Any]rOptional[Mapping[str, Any]]rrrSr1rrrrrr0rrrOptional[ClientSession]rr-rOptional[bool]rboolreturnNonerrXrr/rrFrr/rrrztuple[dict[str, Any], str])rSr1rr/rrrtuple[int, bytes, int]) rZ __module__ __qualname____doc__ __slots__conn_mgrrrrrrrrrHr6rIrrsI,HI$$ $ $  $  $,$$$%$$$"$/$)$$ '!$"#$L ("7<* * /3* #* ZOT2 *2 2<2 GK2 2 r6rceZdZdZdZdZ d dZd dZd dZddZ d ddZ d dd Z y )_GetMorezA getmore operation.) rrrrrrrSrrrrrrrc ||_||_||_||_||_||_||_||_| |_| |_ d|_ | |_ | |_ yr) rrrrrrSrrrrrrr) rrrrrrrSrrrrrrs rIrz_GetMore.__init__sc ""*.  !2  AE  r6cd|_yrrrs rIrz_GetMore.resetrr6c8|jd|jSrrrs rIrz_GetMore.namespacerr6cd}|jsd}n|jdk\rd}|j|j|j|S)NFTrg)rrrrr)rrrs rIrz_GetMore.use_commandsC||G  " "a 'G dkk4<<8r6c|j |jSt|j|j|j|j |j |}|jr(|jj|d|j||j||j||j|j|j}|jrG|jjs1|jj|j ||j"}|r|j%|d||j f|_|jS)z1Return a getMore command document for this query.NF)r)rrrrrrrrrrSrrrrrrrrr)rrrrrs rIrz_GetMore.as_command s    '## #3 NN II NN  " " LL    << LL " "3t/C/CT J C  sDLL$++>   V%6%6%N%N##++DGGS$:L:LMC    v4  0<r6cv|j}|j}|rz|j|dd}|jr|jrt j }nd}t|||jd|j|j\}} } } || | fSt||j|j|S)zGet a getmore message.TrrNr) rrrrr_OpMsgEXHAUST_ALLOWEDrrr _get_morerr) rdummy0rrrrrRrrrrrs rIrz_GetMore.get_message+s^^ && ??4t?,>DD\D\( $JT1sD( (T^^T^^SAAr6N)rrXrrXrrrrrrrSr1rrrr-r Optional[int]rrrrrrrrrrr)r rrr/rrrz0Union[tuple[int, bytes, int], tuple[int, bytes]]) rZrrrrrrrrrrrrHr6rIrrsI D     $ %)): ( 7<  /3 # >>CBB!+B6:B 9Br6rc eZdZdfd ZxZS)_RawBatchQueryc^t|||jdk\ry|jsyyNrgTFsuperrrrrrrYs rIrz_RawBatchQuery.use_commandA. D!  A %r6rrZrrr __classcell__rYs@rIr r @ r6r c eZdZdfd ZxZS)_RawBatchGetMorec^t|||jdk\ry|jsyyrrrs rIrz_RawBatchGetMore.use_commandMrr6rrrs@rIrrLrr6rcNeZdZUdZded<d dZed dZd dZd dZ d dZ y )_CursorAddresszEThe server address (host, port) of a cursor, with namespace property.r_CursorAddress__namespacec@tj||}||_|Sr)tuple__new__r)clsaddressrrs rIr z_CursorAddress.__new__]s}}S'*$ r6c|jS)zThe namespace this cursor.)rrs rIrz_CursorAddress.namespacebsr6c@g||jjSr)r__hash__rs rIr%z_CursorAddress.__hash__gs#*$)(()3355r6ct|tr2t|t|k(xr|j|jk(StSr)rrrrNotImplementedrothers rI__eq__z_CursorAddress.__eq__ls7 e^ ,;%,.T4>>U__3T Tr6c||k( SrrHr(s rI__ne__z_CursorAddress.__ne__qs5=  r6N)r"r2rrXrrrrr)r)objectrr) rZrrr__annotations__r propertyrr%r*r,rHr6rIrrXs3O   6  !r6rz39=G $ r6zz$_op_msg_no_header..s!Cs#c(!Crc32K|]}t|ywrrBrCs rIrFz$_op_msg_no_header..s<3s8:| 33IsCcTt|||||\}}}td||\} }| |||fS)zInternal OP_MSG message helper.)rYr:) rrqrNrOrPrrrS max_bson_sizer=s rI_op_msg_compressedr]s@&7ugzSWY]%^"C]sC(HC Z ..r6cRt|||||\}}}td|\}} || ||fS)z*Internal compressed OP_MSG message helper.r[)rYr?) rrqrNrOrPr7rSr\r op_messages rI_op_msg_uncompressedr`s?'8w TXZ^&_#D*m+D$7J z:} </=)TVY ZZr6c0tdt|||S)z Internal getMore message helper.r})r?r{rzs rI_get_more_uncompressedrps $ y Y ZZr6c<|rt||||St|||S)zGet a **getMore** message.)rrr~s rIr r {s' #O]IsSS !/=) LLr6c>eZdZdZdZ ddZ ddZ ddZ ddZe ddZ e ddZ e dd Z e dd Z dd Ze dd Z dd ZddZddZy)_BulkWriteContextzCA wrapper around Connection for use with write splitting functions.) db_namerop_idrfieldpublish start_time listenersrr3op_typecodecc @||_||_||_||_|j|_||_t|j |_tjj|_ ||_ t|j|_||_||_yr)rrrrenabled_for_commandsrrrerdatetimenowrrrrr3rr) r database_namecmd_namer operation_idrrrrs rIrz_BulkWriteContext.__init__s%  ! " 55   * "++//1 T556   r6c|jdz}t||j|||j|\}}}|s t d|||fS)N.$cmdcannot do an empty bulk write)r_do_batched_op_msgrrr)rrrOrrrto_sends rI__batch_commandz!_BulkWriteContext.__batch_commandsVLL7* #5 t||S$ D$  C"#BC C3''r6c|j||\}}}|j|||||}|j||j||fSr) _BulkWriteContext__batch_command write_command_process_responser)rrrOrrrrrrs rIexecutez_BulkWriteContext.executesS$(#7#7T#B C##CS'6J  6wr6c^|j||\}}}|j|||d|||S)Nr)r unack_write)rrrOrrrrs rI execute_unackz_BulkWriteContext.execute_unacks<$(#7#7T#B C j#q'6Br6c.|jjS)z#A proxy for SockInfo.max_bson_size.)rr\rs rIr\z_BulkWriteContext.max_bson_sizesyy&&&r6cx|jr|jjdz S|jjS)z&A proxy for SockInfo.max_message_size.rw)r3rmax_message_sizers rIrz"_BulkWriteContext.max_message_sizes0 ==99--2 2yy)))r6c.|jjS)z*A proxy for SockInfo.max_write_batch_size.)rmax_write_batch_sizers rIrz&_BulkWriteContext.max_write_batch_sizesyy---r6c|jS)z:The maximum size of a BSON command before batch splitting.)r\rs rImax_split_sizez _BulkWriteContext.max_split_sizes!!!r6ctjtjrt t|j j tj|tt||j|||jj|jj|jjd|jjd|jj  |j"r|j%|||} |jj'||}t(j(j+|j,z }|t/|j0||} nddi} tjtjrt t|j j tj2|| tt||j|||jj|jj|jjd|jjd|jj |j"r|j5|| |t(j(j+|_|S#t6$r} t(j(j+|j,z }t9| t:r"t/|j0|| j<} n(t9| t>r | j<} n tA| } tjtjrt t|j j tjB|| tt||j|||jj|jj|jjd|jjd|jj t9| t:|j"r!|j,J|jE|| |d} ~ wwxYw#t(j(j+|_wxYw)zAA proxy for Connection.unack_write that handles event publishing.rr4 clientIdr>rq commandName databaseName requestId operationIddriverConnectionIdserverConnectionId serverHost serverPort serviceIdNr_ rr> durationMSreplyrrrrrrrrrrr>rfailurerrrrrrrrrisServerSideError)#r# isEnabledForloggingDEBUGr%_topology_settings _topology_idr$STARTEDrcrdrridserver_connection_idr" service_idr_startrrrrrvr SUCCEEDED_succeed Exceptionrrdetailsrr\FAILED_fail) rrrrrTrOrrrdurationrexcrs rIrz_BulkWriteContext.unack_writes@  ' ' 6 22??-55 cO!\\$&#'99<<#'99#A#A99,,Q/99,,Q/))..  <<++c:t4C: 6YY**3 =F((,,.@H!-diifEq "// >'!'!:!:!G!G 5 ? ?#+#$(cO%)\\",$.+/99<<+/99+I+I#'99#4#4Q#7#'99#4#4Q#7"&))"6"6 || j%:@'//335DO A ((,,.@H#/0(=diickk(ZC1++,S1++GMM:##66CC188'# $T#Y!%( *'+yy||'+yy'E'E#yy003#yy003"ii22&06F&G"||222 :w9 ; >'//335DOs&E,J Q#F*Q  QQ%Q:c~|||j<tjtjrt t|j jtj|tt||j|||jj|jj|jj d|jj d|jj" |j$r|j'||| |jj)|||j*}t,j,j/|j0z }tjtjrt t|j jtj2||tt||j|||jj|jj|jj d|jj d|jj"|j$r|j5|||t,j,j/|_|S#t6$ru}t,j,j/|j0z }t9|t:t<fr |j>} n tA|} tjtjrt t|j jtjB|| tt||j|||jj|jj|jj d|jj d|jj"t9|t<|j$r|jE|| |d}~wwxYw#t,j,j/|_wxYw)zCA proxy for SocketInfo.write_command that handles event publishing.rr4rrrN)#rr#rrrr%rrr$rrcrdrrrrr"rrrrrrrrrrrrrrrr\rr) rrrrrOrrrrrs rIrz_BulkWriteContext.write_command@sDJJ  ' ' 6 22??-55 cO!\\$&#'99<<#'99#A#A99,,Q/99,,Q/))..  << KKZ .3 6II++JTZZHE((,,.@H++GMM:##66CC1;;' $T#Y!%( *'+yy||'+yy'E'E#yy003#yy003"ii22 || j%:<'//335DO = ((,,.@H#1ABC(+ ,S1++GMM:##66CC188'# $T#Y!%( *'+yy||'+yy'E'E#yy003#yy003"ii22&06F&G$|| :w9 7 :'//335DOs&EJ PE0PPP%P<c |||j<|jj||j||jj |jj |j|jj|S)zPublish a CommandStartedEvent.) rrpublish_command_startrrr"rrr)rrrrOs rIrz_BulkWriteContext._startseDJJ ,,  LL  II   II * * JJ II   r6c |jj|||j||jj|jj |j |jj|j y)z Publish a CommandSucceededEvent.rN) rpublish_command_successrrr"rrrr)rrrrs rIrz_BulkWriteContext._succeeds^ ..   II  II   II * * JJ II ,, / r6c |jj|||j||jj|jj |j |jj|j y)zPublish a CommandFailedEvent.rN) rpublish_command_failurerrr"rrrr)rrrrs rIrz_BulkWriteContext._fails^ ..   II  II   II * * JJ II ,, / r6N)rrXrrXrr/rrrr.rr)rrrr)rMutableMapping[str, Any]rOlist[Mapping[str, Any]]r*tuple[int, bytes, list[Mapping[str, Any]]]rrrOrrr-rz1tuple[Mapping[str, Any], list[Mapping[str, Any]]]rrrOrrr-rrr-)rrrrrbytesrTrrOrrr-rr) rrrrrrrOrrr-rdict[str, Any])rrrrrOrrr)rrrr3rr(rr)rrrr3rr(rr)rZrrrrrrrrr0r\rrrrr"rrrrrHr6rIrrsM I    # 0 (+ (3J ( 3 (+3JT_ : + 3J T_   ''**..""W %WW W  W & WW %WrP %PP P & P  P PPd+9<D[ !    r6ri cfeZdZdZ ddZ ddZ d dZed dZy) _EncryptedBulkWriteContextrHc|jdz}t||j|||j|\}}|s t d|j dddz}t t||dt}||fS)Nrrr8rr) r_encode_batched_write_commandrrrrhr memoryviewr)rrrOrrr cmd_startoutgoings rIrz*_EncryptedBulkWriteContext.__batch_commandsLL7* 4 t||S$ D W"#BC CIIgq)A-  C!<>VW  r6c|j||\}}|jj|j||j|j |}||fS)N)rrr))_EncryptedBulkWriteContext__batch_commandrrqrrr)rrrOr batched_cmdrrrs rIrz"_EncryptedBulkWriteContext.executesX $33C> W$(II$5$5 LL+TZZ^d%6% wr6c|j||\}}|jj|j|t d|j ||S)Nr)w) write_concernrr)rrrqrr'r)rrrOrrrs rIrz(_EncryptedBulkWriteContext.execute_unacksU $33C> W  LL &+LL  r6ctS)z Reduce the batch splitting size.)_MAX_SPLIT_SIZE_ENCrs rIrz)_EncryptedBulkWriteContext.max_split_sizes #"r6N)rrrOrrz.tuple[dict[str, Any], list[Mapping[str, Any]]]rrr-) rZrrrrrrr0rrHr6rIrrsI !+ !3J ! 7 !+3JT_ : + 3J T_   ##r6rcH|dk(rtd||fzt|d)z-Internal helper for raising DocumentTooLarge.r=zfBSON document too large (%d bytes) - the connected server supports BSON document sizes up to %d bytes.z command document too large)r)rpdoc_sizemax_sizes rI_raise_document_too_largers@H "8, -  ).IJKKr6s documentssupdatessdeletesc|j}|j}|j} |rdnd} |j| |jd|jt |d||jd|j } |jd |jt |g} d} |D]}t |d|}t|}|j |z}| dk(xr|| kD}| xr||kD}|s|r6ttj|}t|t|||| kDrn0|j|| j|| d z } | |k(sn|j }|j| |jt!|| z | |fS#t$r tddwxYw) zCreate a batched OP_MSG write.r9sr8FUnknown commandNrr4)r\rrwritertell _OP_MSG_MAPrfrrQlistrekeysrappendseekrL)rprqrOackrPrbufr\rrr size_locationridxrEvalue doc_lengthnew_message_size doc_too_largeunacked_doc_too_largewrite_oplengths rI_batched_op_msg_implrs%%M33++#& ,?EIIeIIgIImGUD12IIgHHJMII!"< +i()G Cc5$/Z 88: 2qJ&69I&I %( HZ--G 1JOO-.y9H %hE M J . .  %s q & & 16XXZFHH]IIi./0 F?I <01t;7 ""r6ct||||||\}}|jjJtd||jj\}} || |fS)z]Create the next batched insert, update, or delete operation with OP_MSG, compressed. r[)rrrr:) rprqrOrrPrr7rrrs rI_batched_op_msg_compressedr gs\+9gtS$PSTMD' 88 ' ' 33 3dCHH,H,HIOJ sG ##r6c pt}|jt|jdt|||||||\}}|j dt } |jt | |j d|jt || |j|fS)z"OP_MSG implementation entry point.srr)rr_ZERO_64rrrJrLr) rprqrOrrPrrrrrs rI_batched_op_msgr ys *CIIhII12*9gtS$PSUXYOGVHHQKJIIi #$HHQKIIi s||~w ..r6c|jddd|d<d|vrt|djdd}nd}|jjrt ||||||St ||||||S)zRCreate the next batched insert, update, or delete operation using OP_MSG. rr4rrb writeConcernrT)splitrrorrr r )rrprqrOrPrrs rIrrs}__S!,Q/GEN 7>*..sA67 xx##))WdCsSS 9gtS$ DDr6c bt}t|||||||\}}|j|fS)z:Encode the next batched insert, update, or delete command.)r_batched_write_command_implr) rrprqrOrPrrrrs rIrrs9 *C,Y 7DRVX[]`aJGQ <<>7 ""r6c~|j}|j}|tz} |j} |j t |j |j d|j t|j t|j} |j t ||jdd|j |j t||jdz } g} d}|D]}t|j d}t!|d|}t#|| kD}|r6t%t&j)|}t+|t#|||d k\xr+|jt#|zt#|z| k\}||k\}|s|rne|j t,|j ||j t|j || j/||d z }|j t0|j}|j| |j t3|| z d z |j| |j t3|| z | |fS#t$r tddwxYw) z(Create a batched OP_QUERY write command.utf8r5rNrrFr4)r\r_COMMAND_OVERHEADrrrxr_ZERO_8_SKIPLIMrrtruncate_OP_MAPrfrrXrrQrrerr_BSONOBJr_ZERO_16rL)rrprqrOrPrrr\r max_cmd_sizer command_start list_startrrrErrrr enough_dataenough_documentsrs rIrrsK%%M33!#44L''NIIhIIiv&'IIgIIhHHJMIIfWoHHROLLN< ')$% aJG C#hoof%c5$/E \1 JOO-.y9H %hE M JQhYCHHJS$9CJ$F>#Y "66 *  ( # ' %s q'.IIhXXZFHHZIIi+a/01HH]IIi./0 F?O <01t; ::> #$HII4ylBCb9F b&1 1 ZZ!^!%4>>!:!A!A!CL  # #D! ,F#..{/G/GH%l6&:LII!!&)R/= & $$V[9<;K;KF;SUa#$|'7'7'??  (  >>NN# # r6Fc|j||r tj|j|Stj|j||S)aUnpack a response from the database and decode the BSON document(s). Check the response for errors and unpack, returning a dictionary containing the response data. Can raise CursorNotFound, NotPrimaryError, ExecutionTimeout, or OperationFailure. :param cursor_id: cursor_id we sent to get this response - used for raising an informative exception when we get cursor id not valid at server response :param codec_options: an instance of :class:`~bson.codec_options.CodecOptions` :param user_fields: Response fields that should be decoded using the TypeDecoders from codec_options, passed to bson._decode_all_selective. )r3r) decode_allr:_decode_all_selectiverrrr/legacy_responses rIunpack_responsez_OpReply.unpack_responseKsC0 )$ ??4>>=A A))$..-UUr6cR|j|}|jdk(sJ|dS)Unpack a command response.rr4r)r9r$)rrrOs rIcommand_responsez_OpReply.command_responsehs2##-#@##q(((Awr6ctz)Return the bytes of the command response.)NotImplementedErrorrs rIraw_command_responsez_OpReply.raw_command_responsens "!r6cy)+Is the moreToCome bit set on this response?FrHrs rI more_to_comez_OpReply.more_to_comessr6cN|j|\}}}}|dd}|||||S)z%Construct an _OpReply from raw bytes.N) UNPACK_FROM)r!rrrrr$r:s rIunpackz_OpReply.unpackxs703s/C,y!_H 5)_i@@r6)rrrrr$rr:r)NN)rr r/rrz list[bytes] rr rrr/rr8rrzlist[dict[str, Any]]rrrr)rr rr)rrrr#)rZrrrrstructStruct unpack_fromrGOP_CODErr3rBr9r=rAr0rD classmethodrHrHr6rIr#r#s.FI&--(44KG#[_*&*1 sectionN)rGCHECKSUM_PRESENTr rZrQ)r!rrfirst_payload_typefirst_payload_sizerRs rIrHz _OpMsg.unpacks9<8L5!#5 A:s+++#&QRWXYQZ$[\\s'''#&B5)$LMM  ""EFXYZE[ \] ] s8)A- - FG Gqr75*++r6)rrrRr)rr r/rrrrIrJ)rrrK)rrrr)rZrrrrrLrMrNrGrOr^rZrrr3rBr9r=rAr0rDrPrHrHr6rIrrs,MI&--'33KGLO1 $(35 #  #1 # ! # $(&D37 % ] ]$]1 ]  ]  ](D%44,,r6rz5dict[int, Callable[[bytes], Union[_OpReply, _OpMsg]]] _UNPACK_REPLYr-)rRrrSr1rr)r[rrr)rprXrqrrrrrr)NNN)rrXrRrrz1Optional[Union[Mapping[str, Any], Iterable[str]]]rrrrrr rr rr0rrrrrrrr)rr rrXrr rr rz Optional[Any]rr/rr)rprr7rr.Union[SnappyContext, ZlibContext, ZstdContext]rtuple[int, bytes])rprr7rrrc) rrrqrrNrXrO!Optional[list[Mapping[str, Any]]]rPrrztuple[bytes, int, int])rrrqrrNrXrOrdrPrrrbrtuple[int, bytes, int, int]) rrrqrrNrXrOrdrPrrrer)rrrqrrgrXrSzOptional[_ServerMode]rPrr4Union[SnappyContext, ZlibContext, ZstdContext, None]rre)rrrirXrjrrkrrlrrmrrPrrztuple[bytes, int])rrrirXrjrrkrrlrrmrrPrrrbrr)rrrirXrjrrkrrlrrmrrPrrr)rrrirXrjrrkrrlrrmrrPrrrfrr)rirXrkrrrrr) rirXrkrrrrrbrrc)rirXrkrrrrrc) rirXrkrrrrrfrrc)rprXrrrrrr )rprrqrrOrrrrPrrrrrr#tuple[list[Mapping[str, Any]], int])rprrqrrOrrrrPrrrr%tuple[bytes, list[Mapping[str, Any]]])rprrqrrOrrrrPrrrrr)rrXrprrqrrOrrPrrrrr)rrXrprrqrrOrrPrrrrrh)rrXrprrqrrOrrPrrrrrrrg)r __future__rrrrDrLiorrtypingrrrrr r r r r r)rrrrr bson.int64r bson.raw_bsonrrrrpymongor_use_c ImportErrorpymongo.errorsrrrrrrrr pymongo.hellor!pymongo.helpersr"pymongo.loggerr#r$r%pymongo.read_preferencesr&pymongo.write_concernr'r(pymongo.client_sessionr)pymongo.compression_supportr*r+r,pymongo.mongo_clientr-pymongo.monitoringr. pymongo.poolr/pymongo.read_concernr0r1pymongo.typingsr2r3rGrFr_INSERT_UPDATE_DELETE_EMPTYrrrrxr rrrerBr/rJrTr\rvrrrrrrr rrrrMpackr4r5r:r<r?rLrIrJrYr]r`rrorsru_query_messagerryr{rr_get_more_messager rrrrrrrr r rrrr#rrOrHrarHr6rIrs # "    WW! F   &*MM3."4SS02'046            . . 1 / /  $yI N BN!*C ? 0  "5@$O !!.!8I!!J     #"  2.2'+%)0 0 0B0  0  0  000+0%0#00f %     &v v rsBsBl V  x !U!:)6==499+++&T++&v}}W%**  FMM$  $ $ '&--.33 V]]4 % % 4 4 44 , 4  4  4@ /  /  / / , /  / 8 /! / =  =  = = , =  = ! = $,,AE ' ' %' '+ '  ' > '!'@     0  ># ### #  # 0 # # 8##$# ### #  # 0 # ##" #22AE     0   >( &--%** [[[[ 8 [  [[[),[9<[[ &88AE M M M M > M  Mv v z +#!2+#\ L&  ^ ^ AA A "A  A  A  A A)AH## # "#  #  #  #+#" &==$$ $ "$  $  $  $0$$// / "/  /  /  /0/8 //OEEE&E " E  E  E0E0 # # #& # " #  #  #+ # $-$K$K!JJJ&J " J  J  J J)JZnAnAbQ,Q,j hoo NNFMMH D4 FsQ22Q=<Q=