
    &g/                       S r SSKJr  SSKrSSKrSSKJrJrJrJ	r	J
r
JrJrJr  SSKJr  SSKJrJrJr  SSKJr  SSKJrJr  SS	KJrJrJr  SS
KJr  SSKJ r   SSK!J"r"J#r#  \(       aF  SSKJ$r$  SSK%J&r&  SSK'J(r(  SSK)J*r*  SSKJ+r+J,r,J-r-  SSKJ.r.  SSK/J0r0  SSK1J2r2  SSK3J4r4J5r5J6r6J7r7  SSK8J9r9  Sr:              S                                             SS jjr;g)z&Internal network layer helper methods.    )annotationsN)TYPE_CHECKINGAnyMappingMutableMappingOptionalSequenceUnioncast)_decode_all_selective)_csothelpers_sharedmessage)_NO_COMPRESSION)NotPrimaryErrorOperationFailure)_COMMAND_LOGGER_CommandStatusMessage
_debug_log)_OpMsg)_is_speculative_authenticate)async_receive_messageasync_sendall)CodecOptions)AsyncClientSession)AsyncMongoClient)AsyncConnection)SnappyContextZlibContextZstdContext)_EventListeners)ReadConcern)_ServerMode)_Address_CollationIn_DocumentOut_DocumentType)WriteConcernFc                  #    [        [        U5      5      nUS-   nSnUnU(       a"  U(       d  Uc   e[        R                  " X$5      nU(       aP  U(       a  UR                  (       d8  UR
                  (       a  UR                  US'   U(       a  UR                  X 5        Ub  XS'   USL=(       a    UR                  n[        R                  R                  5       nU(       a  [        UU5      nU(       a  UR                  5       [        ;   a  SnU(       aR  UR                  (       aA  UR                  R                  (       d&  UR                  R!                  XU5      I Sh  vN =nnU(       a  U R#                  Xr5        [$        R&                  " UU5        U(       az  U(       a  [(        R*                  OSnUU(       a  [(        R,                  OS-  n[        R.                  " UX!XEUS9u  nnnn U(       a!  Ub  U U:  a  [        R0                  " UUU5        O![        R2                  " SUSSUSUU5      u  nnnUb@  UU[        R4                  -   :  a)  [        R0                  " UUU[        R4                  -   5        Ub  [6        R8                  " [:        R<                  5      (       a  [?        [6        [@        RB                  URD                  RF                  U[        [        U5      5      UUUU RH                  U RJ                  U RL                  S   U RL                  S	   U RN                  S
9  U(       a2  Uc   eU
c   eURQ                  UUUU
U RJ                  U RN                  S9   [S        U RT                  RV                  U5      I Sh  vN   U(       a  U(       a  Sn!SS	0n"O[Y        U U5      I Sh  vN n!U!RZ                  U l-        U!R]                  UUS9n#U#S   n"U R^                  (       d  U"Ra                  S5      n$U$(       a  U$U l1        U(       a  URe                  U"U5      I Sh  vN   U(       a!  [f        Rh                  " U"U Rj                  U	US9  [        R                  R                  5       U-
  n&Ub  [6        R8                  " [:        R<                  5      (       a  [?        [6        [@        R|                  URD                  RF                  U&U"[        [        U5      5      UUUU RH                  U RJ                  U RL                  S   U RL                  S	   U RN                  SU;   S9  U(       a5  Uc   eU
c   eUR                  U&U"UUU
U RJ                  U RN                  UUS9	  U(       ac  UR                  (       aR  U!(       aK  UR                  R                  U!R                  5       5      I Sh  vN n([        S[        U(UU5      S   5      n"U"$  GNu GNO GN) GN! [l         Gaa  n%[        R                  R                  5       U-
  n&[o        U%[p        [r        45      (       a  U%Rt                  n'O[        Rv                  " U%5      n'Ub  [6        R8                  " [:        R<                  5      (       a  [?        [6        [@        Rx                  URD                  RF                  U&U'[        [        U5      5      UUUU RH                  U RJ                  U RL                  S   U RL                  S	   U RN                  [o        U%[r        5      S9  U(       a4  Uc   eU
c   eUR{                  U&U'UUU
U RJ                  U RN                  US9  e Sn%A%ff = f GN7f)a  Execute a command over the socket, or raise socket.error.

:param conn: a AsyncConnection 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 AsyncClientSession instance.
:param client: optional AsyncMongoClient 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   )r   clientIdcommandcommandNamedatabaseName	requestIdoperationIddriverConnectionIdserverConnectionId
serverHost
serverPort	serviceId)
service_idok)codec_optionsuser_fieldsz$clusterTime)parse_write_concern_error)r   r/   
durationMSfailurer1   r2   r3   r4   r5   r6   r7   r8   r9   isServerSideError)r:   database_namespeculativeAuthenticate)r   r/   r?   replyr1   r2   r3   r4   r5   r6   r7   r8   r9   speculative_authenticate)r:   speculative_hellorB   r&   )Dnextiterr   _maybe_add_read_preferencein_transactionleveldocument_update_read_concernenabled_for_commandsdatetimenowr   lowerr   
_encrypter_bypass_auto_encryptionencryptapply_timeoutr   apply_write_concernr   MORE_TO_COMEEXHAUST_ALLOWED_op_msg_raise_document_too_large_query_COMMAND_OVERHEADr   isEnabledForloggingDEBUGr   r   STARTED_topology_settings_topology_ididserver_connection_idaddressr:   publish_command_startr   connget_connr   more_to_comeunpack_responsereadyget_cluster_time_process_responser   _check_command_responsemax_wire_version	Exception
isinstancer   r   details_convert_exceptionFAILEDpublish_command_failure	SUCCEEDEDpublish_command_successdecryptraw_command_responser   r   ))rg   dbnamespec	is_mongosread_preferencer<   sessionclientcheckallowable_errorsre   	listenersmax_bson_sizeread_concernr>   r+   compression_ctx
use_op_msgunacknowledgedr=   exhaust_allowedwrite_concernnamensrF   origpublishstartflags
request_idmsgsizemax_doc_sizerD   response_docunpacked_docscluster_timeexcdurationr@   	decrypteds)                                            aC:\Suresh\moveshuttle\MDcreated\moveengine\venv\Lib\site-packages\pymongo/asynchronous/network.pyr0   r0   =   s^    f T
D	'	B D***11$HW)?)?"."7"7D((4%[t#F	(F(FG!!#E8tD4::<?:&##F,=,=,U,U"--55fMRRRt 6(	dM2'5##1?''A.5oo4_/
+
C|
 m7L=<X--dD-H 'r1b$m_!

C  TMG<U<U,U%U))$mgF_F_6_`''66-5522?? d,#$&#'77#'#<#<<<?<<?// $$$"""''%% 	( 	
ADII..444.E*.L/jAAE % 2 2D!11+ 2 M )+L::+//?)5D&..|WEEE66 ))$.G	Z   $$&.H''66-7722??#" d,#$&#'77#'#<#<<<?<<?//)Bd)J" $$$"""))%%/  	* 
	
 &## ++33E4N4N4PQQ	1)]KXYZ[
 A Sl 	5 B F  &$$((*U2cO-=>??$'KKG005G++GMM::#188#66CC'# $T$Z 0!'( *'+ww'+'@'@#||A#||A"oo&06F&G" (((&&&--))??$ . 	 	M&V Rs   E ]"W#H](#W# WW# $]%W# 4W5A6W# +W ,,W# E]6]7!]W# W#  W# #].E]

]])TNNNNNFNNFFNFN).rg   r   r{   strr|   zMutableMapping[str, Any]r}   boolr~   zOptional[_ServerMode]r<   zCodecOptions[_DocumentType]r   zOptional[AsyncClientSession]r   zOptional[AsyncMongoClient]r   r   r   z#Optional[Sequence[Union[str, int]]]re   zOptional[_Address]r   zOptional[_EventListeners]r   zOptional[int]r   zOptional[ReadConcern]r>   r   r+   zOptional[_CollationIn]r   z4Union[SnappyContext, ZlibContext, ZstdContext, None]r   r   r   r   r=   zOptional[Mapping[str, Any]]r   r   r   zOptional[WriteConcern]returnr'   )<__doc__
__future__r   rO   r^   typingr   r   r   r   r   r	   r
   r   bsonr   pymongor   r   r   pymongo.compression_supportr   pymongo.errorsr   r   pymongo.loggerr   r   r   pymongo.messager   pymongo.monitoringr   pymongo.network_layerr   r   r   #pymongo.asynchronous.client_sessionr   !pymongo.asynchronous.mongo_clientr   pymongo.asynchronous.poolr   r   r   r    r!   pymongo.read_concernr"   pymongo.read_preferencesr#   pymongo.typingsr$   r%   r&   r'   pymongo.write_concernr(   _IS_SYNCr0        r   <module>r      s   - "  	 	 	 ' 2 2 7 N M " ;
 !FB9SS204SS2 <@"&+/#'*.&+(,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. /mr   