+\h.dZddlmZddlZddlZddlmZmZmZm Z m Z m Z m Z m Z ddlmZddlmZmZmZddlmZddlmZmZdd lmZmZmZdd lmZdd lm Z dd l!m"Z"m#Z#erFdd lm$Z$ddlm%Z%m&Z&m'Z'ddlm(Z(ddl)m*Z*ddl+m,Z,ddl-m.Z.ddl/m0Z0ddl1m2Z2ddl3m4Z4m5Z5m6Z6m7Z7ddl8m9Z9dZ: d ddZ;y)z&Internal network layer helper methods.) annotationsN) TYPE_CHECKINGAnyMappingMutableMappingOptionalSequenceUnioncast)_decode_all_selective)_csothelpers_sharedmessage)_NO_COMPRESSION)NotPrimaryErrorOperationFailure)_COMMAND_LOGGER_CommandStatusMessage _debug_log)_OpMsg)_is_speculative_authenticate)receive_messagesendall) CodecOptions) SnappyContext ZlibContext ZstdContext)_EventListeners) ReadConcern) _ServerMode) ClientSession) MongoClient) Connection)_Address _CollationIn _DocumentOut _DocumentType) WriteConcernTc tt|}|dz}d}|}|r|s|Jtj||}| r=|r |js/| j r| j |d<|r|j|||||d<| duxr | j}tjj}|r t||}|r|jtvrd}|rA|jr5|jjs|jj!|||x}}|r|j#||t%j&|||rl|rt(j*nd}||rt(j,ndz}tj.||||||\}}}} |r?| =| | kDr8tj0||| n tj2d|dd|d||\}}}| >|| tj4zkDr(tj0||| tj4z|t7j8t:j<rt?t6t@jB|jDjF|tt|||||jH|jJ|jLd|jLd |jN |r3| J| J| jQ|||| |jJ|jN  tS|jTjV||r |rd}!d d i}"ntY||}!|!jZ|_-|!j]|| }#|#d}"|j^s|"jad}$|$r|$|_1|r|je|"||r#tgjh|"|jj| |tjj|z }&|t7j8t:j<rt?t6t@j||jDjF|&|"tt|||||jH|jJ|jLd|jLd |jNd|v|r6| J| J| j|&|"||| |jJ|jN|| |rQ|jrE|!rC|jj|!j}(tdt|(||d}"|"S#tl$rS}%tjj|z }&to|%tptrfr |%jt}'ntjv|%}'|t7j8t:j<rt?t6t@jx|jDjF|&|'tt|||||jH|jJ|jLd|jLd |jNto|%tr|r5| J| J| j{|&|'||| |jJ|jN|d}%~%wwxYw)aExecute a command over the socket, or raise socket.error. :param conn: a Connection instance :param dbname: name of the database on which to run the command :param spec: a command document as an ordered dict type, eg SON. :param is_mongos: are we connected to a mongos? :param read_preference: a read preference :param codec_options: a CodecOptions instance :param session: optional ClientSession instance. :param client: optional MongoClient instance for updating $clusterTime. :param check: raise OperationFailure if there are errors :param allowable_errors: errors to ignore if `check` is True :param address: the (host, port) of `conn` :param listeners: An instance of :class:`~pymongo.monitoring.EventListeners` :param max_bson_size: The maximum encoded bson size for this server :param read_concern: The read concern for this command. :param parse_write_concern_error: Whether to parse the ``writeConcernError`` field in the command response. :param collation: The collation for this command. :param compression_ctx: optional compression Context. :param use_op_msg: True if we should use OP_MSG. :param unacknowledged: True if this is an unacknowledged command. :param user_fields: Response fields that should be decoded using the TypeDecoders from codec_options, passed to bson._decode_all_selective. :param exhaust_allowed: True if we should enable OP_MSG exhaustAllowed. z.$cmdFN readConcern collationr)ctx) rclientIdcommand commandName databaseName requestId operationIddriverConnectionIdserverConnectionId serverHost serverPort serviceId) service_idok) codec_options user_fieldsz $clusterTime)parse_write_concern_error)rr/ durationMSfailurer1r2r3r4r5r6r7r8r9isServerSideError)r: database_namespeculativeAuthenticate)rr/r?replyr1r2r3r4r5r6r7r8r9speculative_authenticate)r:speculative_hellorBr&)Dnextiterr_maybe_add_read_preferencein_transactionleveldocument_update_read_concernenabled_for_commandsdatetimenowrlowerr _encrypter_bypass_auto_encryptionencrypt apply_timeoutr apply_write_concernr MORE_TO_COMEEXHAUST_ALLOWED_op_msg_raise_document_too_large_query_COMMAND_OVERHEADr isEnabledForloggingDEBUGrrSTARTED_topology_settings _topology_ididserver_connection_idaddressr:publish_command_startrconnget_connr more_to_comeunpack_responsereadyget _cluster_time_process_responser_check_command_responsemax_wire_version Exception isinstancerrdetails_convert_exceptionFAILEDpublish_command_failure SUCCEEDEDpublish_command_successdecryptraw_command_responser r ))rgdbnamespec is_mongosread_preferencer<sessionclientcheckallowable_errorsre listeners max_bson_size read_concernr>r+compression_ctx use_op_msgunacknowledgedr=exhaust_allowed write_concernnamensrForigpublishstartflags request_idmsgsize max_doc_sizerD response_doc unpacked_docs cluster_timeexcdurationr@ decrypteds) ^/root/niggaflix-v3/playground/venv/lib/python3.12/site-packages/pymongo/synchronous/network.pyr0r0=s(f T D ' B D***11$HW)?)?   "."7"7D    ( (t 4%[t#F (F(FG    ! ! #E8tD4:: ?$'KKG005G  ++GMM:#188#66CC'# $T$Z 0!'( *'+ww'+'@'@#||A#||A"oo&06F&G" ( ((& &&  - -))??$ .  M&s8B?T Y3 EY..Y3)TNNNNNFNNFFNFN).rgr#r{strr|zMutableMapping[str, Any]r}boolr~zOptional[_ServerMode]r<zCodecOptions[_DocumentType]rzOptional[ClientSession]rzOptional[MongoClient]rrrz#Optional[Sequence[Union[str, int]]]rezOptional[_Address]rzOptional[_EventListeners]rz Optional[int]rzOptional[ReadConcern]r>rr+zOptional[_CollationIn]rz4Union[SnappyContext, ZlibContext, ZstdContext, None]rrrrr=zOptional[Mapping[str, Any]]rrrzOptional[WriteConcern]returnr')<__doc__ __future__rrOr^typingrrrrrr r r bsonr pymongor rrpymongo.compression_supportrpymongo.errorsrrpymongo.loggerrrrpymongo.messagerpymongo.monitoringrpymongo.network_layerrrrrrrrpymongo.read_concernrpymongo.read_preferencesr "pymongo.synchronous.client_sessionr! pymongo.synchronous.mongo_clientr"pymongo.synchronous.poolr#pymongo.typingsr$r%r&r'pymongo.write_concernr(_IS_SYNCr0rrs-"   '227NM"; !SS204@<3SS2 <@"&+/#'*.&+(,LP /3!,0-m m m #m m + m / m%m "m m:m m)m!m(m $m &!m"J#m$%m&'m(-)m*+m,*-m./mr