
    Ii"                       % S r SSKJr  SSKrSSKrSSKJrJr  SSKJ	r	  SSK
JrJrJrJr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  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'  SSK(J)r)  SSK*J+r+  SSK,J-r-  SSK.J/r/J0r0  SSK1J2r2  SSK3J4r4J5r5J6r6  \(       a  SSK7J8r8  \\4r9S\:S'   Sr;S\;-  r<S\:S'   Sr=Sr>Sr?Sr@SrASrBSrCS rDS rES!rFS"rGS#rHS$rIS%rJSrKSrLSrMS&\:S''   SrNS&\:S('   SrOS&\:S)'   S*rPS+rQS+rRS,rSS-\:S.'   S/rTS-\:S0'   S1rUS2rVS3rWSS4 jrXSS5 jrYSSS6 jjrZ\R                  \R                  \R                  \R                  \R                  S7.r`SS8 jraSS9 jrbSS: jrcSS; jrdSS< jreSS= jrfSS> jrgSS? jrhSS@ jriSSA jrjSSB jrkSSC jrlSSD jrmSSE jrnSSF jroSSG jrpSSH jrqSSI jrrSSJ jrsSSK jrtSSL jruSSM jrvSSN jrw\x" / SOQ5      rySSP jrz      SSQ jr{SSR jr|SSS jr}SST jr~SSU jrSSV jrSSW jrSSX jrSSY jrSSZ jrSS[ jrSS\ jrSS] jr\x" / S^Q5      rSS_ jrSS` jrSSa jrSSb jrSSc jrSdSe/0rSf\:Sg'   0 Sh\_Si\u_Sj\z_Sk\h_Sl\$_Sm\p_Sn\a_So\n_Sp\a_Sq\m_Sr\n_Ss\c_St\g_Su\r_Sv\i_Sw\t_Sx\w_0 Sy\i_Sz\a_S{\a_S|\a_S}\o_S~\p_Sd\a_S\a_S\a_S\e_S\e_S\i_S\a_S\a_S\k_S\d_S\%_E\h\d\q\S.ErS\:S'   \a\\\a\d\e\a\\v\g\n\S.rS\:S'   \{\|\s\+\\i\i\\\}S.
rS\:S'   SeSd0rS\:S'   0 rS\:S'   \GR)                  \5        \GR+                  5        H  u  rr\ H  r\\;  d  M  \\   \\'   M     M!     \GR3                  5       rS\:S'   \GR)                  \5        / SQrS\:S'   \x" Sj/5      rSS jr S       SS jjrSS jr S     SS jjrSS jrSS jr\x" / SQ5      r " S S5      r " S S\\\4   5      rSS jrg)z9Functions and classes common to multiple pymongo modules.    )annotationsN)OrderedDictabc)get_close_matches)TYPE_CHECKINGAnyCallableIteratorMappingMutableMappingNoReturnOptionalSequenceTypeUnionoverload)unquote_plus)SON)UuidRepresentation)CodecOptionsDatetimeConversionTypeRegistry)RawBSONDocument)validate_compressorsvalidate_zlib_compression_level)
DriverInfo)ConfigurationError)_validate_event_listeners)ReadConcern)_MONGOS_MODES_ServerMode)	ServerApi)DEFAULT_WRITE_CONCERNWriteConcernvalidate_boolean)_AgnosticClientSessionzSequence[Type]ORDERED_TYPESi      intMAX_MESSAGE_SIZEi  z3.6      
         g      ?<   g      4@d   Optional[int]MAX_IDLE_TIME_MSMAX_IDLE_TIME_SECWAIT_QUEUE_TIMEOUT   T);   zSequence[int]COMMAND_NOT_FOUND_CODES)   i@  i@  UNAUTHORIZED_CODESi'  mongodbautoc                    U nSnU R                  S5      nUS:w  a  U SU [        XS-   S 5      p!UR                  S5      (       a  USS nX4$ )z5Split a host:port string into (host, int(port)) pair.ii  :Nr.   [)rfindr)   
startswith)nodehostportidxs       4/venv/lib/python3.13/site-packages/pymongo/common.pypartition_noderH      s\    DD
**S/C
by$3ZT')_!5dsAbz:    c                @    [        U 5      u  pUR                  5       U4$ )z6Split and normalize a node name from a hello response.)rH   lower)rC   rD   rE   s      rG   
clean_noderL      s!    %JD ::<rI   c                b    SU  S3nU(       a  USSR                  U5       S3-  n[        U5      e)z1Raise ConfigurationError with the given key name.Unknown option: .z Did you mean one of (, z:) or maybe a camelCase version of one? Refer to docstring.)joinr   )keysuggestionsmsgs      rG   raise_config_errorrU      s=    SE
#C'		+(>'??yzz
S
!!rI   )unspecifiedstandardpythonLegacy
javaLegacycsharpLegacyc                v    [        U[        5      (       a  US;  a  [        SU  S35      eUS:H  $ [        X5      $ )z8Validates that value is True, False, 'true', or 'false'.)truefalseThe value of z must be 'true' or 'false'r\   )
isinstancestr
ValueErrorr%   optionvalues     rG   validate_boolean_or_stringre      sB    %))}VH4NOPPF**rI   c                    [        U[        5      (       a  U$ [        U[        5      (       a   [        U5      $ [	        SU  S35      e! [         a    [        SU  S35      Sef = f)zDValidates that 'value' is an integer (or basestring representation).r^   z must be an integerNWrong type for z, value must be an integerr_   r)   r`   ra   	TypeErrorrb   s     rG   validate_integerrj      sr    %	E3			Tu: ofX-GH
II  	T}VH4GHItS	Ts   
A A#c                F    [        X5      nUS::  a  [        SU  S35      eU$ )zFValidate that 'value' is a positive integer, which does not include 0.r   r^   z must be a positive integerrj   ra   rc   rd   vals      rG   validate_positive_integerro      s-    
6
)C
ax=0KLMMJrI   c                F    [        X5      nUS:  a  [        SU  S35      eU$ )z1Validate that 'value' is a positive integer or 0.r   r^   z must be a non negative integerrl   rm   s      rG   validate_non_negative_integerrq      s-    
6
)C
Qw=0OPQQJrI   c                X    Uc  U$ [        X5      n[        U5      R                  5         U$ )z1Validates that 'value' is file-like and readable.)validate_stringopencloserb   s     rG   validate_readablerv      s-    } F*EKLrI   c                "    Uc  U$ [        X5      $ )z4Validate that 'value' is a positive integer or None.ro   rb   s     rG   !validate_positive_integer_or_nonery      s    }$V33rI   c                "    Uc  U$ [        X5      $ )z9Validate that 'value' is a positive integer or 0 or None.)rq   rb   s     rG   %validate_non_negative_integer_or_noner{      s    }(77rI   c                N    [        U[        5      (       a  U$ [        SU  S35      e)z/Validates that 'value' is an instance of `str`.rg   z", value must be an instance of str)r_   r`   ri   rb   s     rG   rs   rs      s)    %
ofX-OP
QQrI   c                "    Uc  U$ [        X5      $ )z@Validates that 'value' is an instance of `basestring` or `None`.)rs   rb   s     rG   validate_string_or_noner~      s    }6))rI   c                    [        U[        5      (       a  U$ [        U[        5      (       a   [        U5      $ [	        SU  S35      e! [         a    Us $ f = f)/Validates that 'value' is an integer or string.rg   z&, value must be an integer or a stringrh   rb   s     rG   validate_int_or_basestringr     s]    %	E3			u: ofX-ST
UU  	L	s   
A AAc                    [        U[        5      (       a  U$ [        U[        5      (       a   [        U5      n[	        X5      $ [        SU  S35      e! [         a    Us $ f = f)r   rg   z3, value must be an non negative integer or a string)r_   r)   r`   ra   rq   ri   rm   s      rG   'validate_non_negative_int_or_basestringr     sg    %	E3			e*C -V99
ofX-`a
bb  	L	s   A A"!A"c                    U  S3n [        U5      nSUs=:  a  S:  d  O  [        U  S35      eU$ ! [         a    [        U5      Se[         a    [        U5      Sef = f)zPValidates that 'value' is a float, or can be converted to one, and is
positive.
z must be an integer or floatNr   g    eAz1 must be greater than 0 and less than one billion)floatra   ri   )rc   rd   errmsgs      rG   validate_positive_floatr     sw     x34F*e u?s?F8#TUVVL  + d* *T)*s	   1 ,Ac                2    US:X  d  US:X  a  g[        X5      $ )z_Validates that 'value' is 0 or a positive float, or can be converted to
0 or a positive float.
r   0r   rb   s     rG   validate_positive_float_or_zeror   0  s     zUc\"611rI   c                (    Uc  U$ [        X5      S-  $ )[Validates a timeout specified in milliseconds returning
a value in floating point seconds.
     @@r   rb   s     rG   validate_timeout_or_noner   9  s     }"61F::rI   c                Z    Uc  [        U  S35      eUS:X  d  US:X  a  g[        X5      S-  $ )zValidates a timeout specified in milliseconds returning
a value in floating point seconds for the case where None is an error
and 0 is valid. Setting the timeout to nothing in the URI string is a
config error.
z cannot be Noner   r   r   )r   r   rb   s     rG   validate_timeout_or_zeror   B  s;     } F8?!;<<zUc\"61F::rI   c                >    Ub  US:X  d  US:X  a  g[        X5      S-  $ )zValidates a timeout specified in milliseconds returning
a value in floating point seconds. value=0 and value="0" are treated the
same as value=None which means unlimited timeout.
Nr   r   r   r   rb   s     rG    validate_timeout_or_none_or_zeror   O  s(    
 }
esl"61F::rI   c                &    Uc  g[        X5      S-  $ )r   Nr   )r   rb   s     rG   validate_timeoutmsr   Y  s     }*69FBBrI   c                2    US:X  d  US:X  a  g[        X5      $ )zBValidates maxStalenessSeconds according to the Max Staleness Spec.r?   z-1rx   rb   s     rG   validate_max_stalenessr   b  s    {etm$V33rI   c                N    [        U[        5      (       d  [        U< S35      eU$ )zValidate a read preference.z is not a read preference.)r_   r!   ri   dummyrd   s     rG   validate_read_preferencer   j  s'    e[))5)#=>??LrI   c                6    U[         ;  a  [        U S35      eU$ )zValidate read preference mode for a MongoClient.

.. versionchanged:: 3.5
   Returns the original ``value`` instead of the validated read preference
   mode.
z is not a valid read preference)r    ra   r   s     rG   validate_read_preference_moder   q  s$     M!E7"ABCCLrI   c                N    SSK Jn  X;  a  [        U  S[        U5       35      eU$ )z&Validate the authMechanism URI option.r   )
MECHANISMSz must be in )pymongo.auth_sharedr   ra   tuple)rc   rd   r   s      rG   validate_auth_mechanismr   }  s,    .F8<j0A/BCDDLrI   c                n     [         U   $ ! [         a    [        U S[        [         5       35      Sef = f)z<Validate the uuid representation option selected in the URI.z3 is an invalid UUID representation. Must be one of N)_UUID_REPRESENTATIONSKeyErrorra   r   r   s     rG   validate_uuid_representationr     sN    $U++ g *+,.
 		s    )4c                j   [        U[        5      (       d  U/n/ nU Hr  nUS:X  a  UR                  0 5        M   0 nUR                  S5       H-  nUR                  S5      u  pg[	        U5      U[	        U5      '   M/     UR                  U5        Mt     U$ ! [
         a    [        U< SU  35      Sef = f)z5Parse readPreferenceTags if passed as a client kwarg. ,r>   z not a valid value for N)r_   listappendsplitr   	Exceptionra   )namerd   tag_setstag_settagstagrR   rn   s           rG   validate_read_preference_tagsr     s    eT""Hb=OOB	TD}}S)99S>*6s*;\#&' * OOD!  O  	T{*A$HItS	Ts   ABB2)SERVICE_NAMECANONICALIZE_HOST_NAMESERVICE_REALMAWS_SESSION_TOKENENVIRONMENTTOKEN_RESOURCEc           	     \   0 n[        U[        5      (       d  [        U[        5      (       d  [        S5      eUR	                  5        H  u  p1[        U[        5      (       a  XU'   M   [        U[
        5      (       a  [        U5      R                  5       X#'   MR  US;   a  [        U[        5      (       a  XU'   Ms  US;   a'  SSKJ	n  [        X5      (       d  [        S5      eXU'   M  [        SU S[        U5       35      e   U$ [        X5      n[        U5      nUR                  S	5       H{  nUR                  S
5      u  p6nU(       d  [        S5      eU[        ;  a/  SU;   a  [        S5      e[        U S[!        [        5       S35      eUS:X  a  [#        X75      X#'   Mw  XrU'   M}     U$ )z!Validate authMechanismProperties.zCAuth mechanism properties must be given as a string or a dictionary)ALLOWED_HOSTS)OIDC_CALLBACKOIDC_HUMAN_CALLBACKr   )OIDCCallbackz'callback must be an OIDCCallback objectz)Invalid type for auth mechanism property rP   r   r>   z#Malformed auth mechanism propertiesr   zPauth mechanism properties must be key:value pairs like AWS_SESSION_TOKEN:<token>z< is not a supported auth mechanism property. Must be one of rO   r   )r_   r`   dictra   itemsboolrK   r   pymongo.auth_oidc_sharedr   typers   r   r   	partition_MECHANISM_PROPSr   re   )rc   rd   propsrR   r   opt_rn   s           rG   "validate_auth_mechanism_propertiesr     s   EeS!!%&&bcc++-JC%%%"c
E4(( Z--/
))j.E.E"c
@@A!%66$%NOO"c
 #LSEQSTXY^T_S`!abb ( F*EE{{3mmC(BCC&&"c) E 
 % 6)*+1.  **3C=EJ#J+  . LrI   c                   Sn [        U[        R                  5      nU(       d#  [        U[        5      (       d  [        U  S35      eU$ ! [         a8    [	        US5      (       a$  [        UR
                  [        R                  5      n Nmf = f)z#Validate the document_class option.F
__origin__zg must be dict, bson.son.SON, bson.raw_bson.RawBSONDocument, or a subclass of collections.MutableMapping)
issubclassr   r   ri   hasattrr   r   )rc   rd   
is_mappings      rG   validate_document_classr     s     JJs'9'9:
 j@@h 5 5
 	

 L  J5,''#E$4$4c6H6HIJJs   A
 
?BBc                ^    Ub)  [        U[        5      (       d  [        U  S[         35      eU$ )z"Validate the type_registry option.z must be an instance of )r_   r   ri   rb   s     rG   validate_type_registryr     s0    E<!@!@6(":<.IJJLrI   c                L    [        U[        5      (       d  [        U  S35      eU$ )z!Validates that 'value' is a list.z must be a list)r_   r   ri   rb   s     rG   validate_listr     s&    eT""6(/233LrI   c                "    Uc  U$ [        X5      $ )z)Validates that 'value' is a list or None.)r   rb   s     rG   validate_list_or_noner   	  s    }''rI   c                j    [        U[        R                  [        45      (       d  [	        U  S35      eg)z/Validates that 'value' is a list or a document.zu must either be a list or an instance of dict, bson.son.SON, or any other type that inherits from collections.MappingN)r_   r   r   r   ri   rb   s     rG   validate_list_or_mappingr     s9    eckk4011h " "
 	
 2rI   c                ^    [        U[        R                  5      (       d  [        U  S35      eg)z=Validate the type of method arguments that expect a document.zd must be an instance of dict, bson.son.SON, or any other type that inherits from collections.MappingN)r_   r   r   ri   rb   s     rG   validate_is_mappingr     s4    eS[[))h " "
 	
 *rI   c                j    [        U[        R                  [        45      (       d  [	        U  S35      eg)zEValidate the type of method arguments that expect a MongoDB document.z must be an instance of dict, bson.son.SON, bson.raw_bson.RawBSONDocument, or a type that inherits from collections.MutableMappingN)r_   r   r   r   ri   rb   s     rG   validate_is_document_typer   $  s<    ec00/BCCh ) )
 	
 DrI   c                ~    Uc  U$ [        X5        [        UR                  S5      5      S:  a  [        U  S35      eU$ )zValidate the appname option.zutf-8   z must be <= 128 bytes)rs   lenencodera   rb   s     rG   validate_appname_or_noner   /  sB    }F"
5<< !C'F8#89::LrI   c                V    Uc  U$ [        U[        5      (       d  [        U  S35      eU$ ) Validate the driver keyword arg.z" must be an instance of DriverInfo)r_   r   ri   rb   s     rG   validate_driver_or_noner   :  s1    }eZ((6("DEFFLrI   c                V    Uc  U$ [        U[        5      (       d  [        U  S35      eU$ )z$Validate the server_api keyword arg.z! must be an instance of ServerApi)r_   r"   ri   rb   s     rG   validate_server_api_or_noner   C  s1    }eY''6("CDEELrI   c                L    Uc  U$ [        U5      (       d  [        U  S35      eU$ )z%Validates that 'value' is a callable.z must be a callable)callablera   rb   s     rG   validate_is_callable_or_noner   L  s-    }E??F8#6788LrI   c                    [        SU 5        U (       aL  [        U [        5      (       d6  [        [	        U 5      5      nUR                  S5      (       a  [        S5      eggg)z Validate a replacement document.replacement$z'replacement can not include $ operatorsN)r   r_   r   nextiterrB   ra   )r   firsts     rG   validate_ok_for_replacer   U  sT    {3:k?CCT+&'C  FGG ! D{rI   c                    [        SU 5        U (       d  [        S5      e[        U [        5      (       + n[	        [        U 5      5      nU(       a"  UR                  S5      (       d  [        S5      egg)zValidate an update document.updatezupdate cannot be emptyr   z"update only works with $ operatorsN)r   ra   r_   r   r   r   rB   )r   is_documentr   s      rG   validate_ok_for_updater   _  s^    Xv.122 ..KfE5++C00=>> 1{rI   )strictreplaceignorec                T    U[         ;  a  [        U S[        [         5       35      eU$ )zAValidate the Unicode decode error handler option of CodecOptions.z< is an invalid Unicode decode error handler. Must be one of )_UNICODE_DECODE_ERROR_HANDLERSra   r   r   s     rG   %validate_unicode_decode_error_handlerr   o  s:    22g 3457
 	

 LrI   c                f    Ub-  [        U[        R                  5      (       d  [        SU-  5      eU$ )zValidate the tzinfo optionz)%s must be an instance of datetime.tzinfo)r_   datetimetzinfori   r   s     rG   validate_tzinfor   z  s.    E8??!C!CCeKLLLrI   c                X    Uc  U$ SSK Jn  [        X5      (       d  [        U  S35      eU$ )r   r   )AutoEncryptionOptsz* must be an instance of AutoEncryptionOpts)pymongo.encryption_optionsr   r_   ri   )rc   rd   r   s      rG   %validate_auto_encryption_opts_or_noner    s2    }=e006("LMNNLrI   c                   Uc  [         R                  $ [        U[        5      (       a2  UR	                  5       (       a  [        [        U5      5      $ [         U   $ [        U[
        5      (       a  [        U5      $ [        U  S35      e)z%Validate a DatetimeConversion string.z5 must be a str or int representing DatetimeConversion)r   DATETIMEr_   r`   isdigitr)   ri   rb   s     rG   validate_datetime_conversionr    sp    }!***%==??%c%j11!%((	E3		!%((
vhST
UUrI   c                6    US;  a  [        U  SU< S35      eU$ )z)Validate the serverMonitoringMode option.>   r<   pollstream=z7 is invalid. Must be one of "auto", "stream", or "poll")ra   rb   s     rG   validate_server_monitoring_moder
    s0    ..hay WX
 	
 LrI   tlssslzdict[str, list[str]]URI_OPTIONS_ALIAS_MAPappnameauthmechanismauthmechanismproperties
authsourcecompressorsconnecttimeoutmsdirectconnectionheartbeatfrequencymsjournallocalthresholdmsmaxidletimemsmaxconnectingmaxpoolsizemaxstalenesssecondsreadconcernlevelreadpreferencereadpreferencetags
replicaset
retryreadsretrywritesloadbalancedserverselectiontimeoutmssockettimeoutmstlsallowinvalidcertificatestlsallowinvalidhostnames	tlscafiletlscertificatekeyfiletlscertificatekeyfilepasswordtlsdisableocspendpointchecktlsinsecurew
wtimeoutmszlibcompressionlevel)srvservicenamesrvmaxhosts	timeoutmsservermonitoringmode$dict[str, Callable[[Any, Any], Any]]URI_OPTIONS_VALIDATOR_MAP)connectdriver
server_apifsyncminpoolsize
tlscrlfiletz_awareunicode_decode_error_handleruuidrepresentationwaitqueuemultiplewaitqueuetimeoutmsdatetime_conversionNONSPEC_OPTIONS_VALIDATOR_MAP)
document_classtype_registryread_preferenceevent_listenersr   usernamepasswordserver_selectorauto_encryption_optsauthoidcallowedhostsKW_VALIDATORSzdict[str, str]INTERNAL_URI_OPTION_NAME_MAPzdict[str, tuple[str, str]]URI_OPTIONS_DEPRECATION_MAP
VALIDATORS)r  r  r  r  r#  r$  r?  z	list[str]TIMEOUT_OPTIONSc                `    [        X5      u  p!U[        ;  a  [        SU  S[         35      eX4$ )z,Validate optional authentication parameters.rN   z. Must be in )validate_AUTH_OPTIONSr   )rc   rd   rK   s      rG   validate_auth_optionrS  (  s7    F*LEM! #3F8=!XYY=rI   c                l    U=(       d    U n X   $ ! [          a    [        X!SS9n[        X5         g f = f)Ng?)cutoff)r   r   rU   )rR   
validators
normed_keyrS   s       rG   _get_validatorrX  0  s?     "sJ-%% -'
sK3,-s    33c                R    [        U [        U R                  5       S9nU" X5      nX4$ )zGeneric validation function.rW  )rX  rN  rK   )rc   rd   	validators      rG   rQ  rQ  ;  s(    vzfllnMIf$E=rI   c                  ^  [        T [        5      (       a  [        5       nS	S jnS	U 4S jjnO0 nS	S jnS	S jnT R                  5        H/  u  pVU" U5      n [        U[        US9nU" XV5      n	XU" U5      '   M1     U$ ! [
        [        [        4 a1  n
U(       a$  [        R                  " [        U
5      SS9   Sn
A
Mu  e Sn
A
ff = f)
aI  Validate each entry in options and raise a warning if it is not valid.
Returns a copy of options with invalid entries removed.

:param opts: A dict containing MongoDB URI options.
:param warn: If ``True`` then warnings will be logged and
      invalid options will be ignored. Otherwise, invalid options will
      cause errors.
c                    U $ N xs    rG   get_normed_key-get_validated_options.<locals>.get_normed_keyQ      HrI   c                &   > TR                  U 5      $ r^  )	cased_key)ra  optionss    rG   get_setter_key-get_validated_options.<locals>.get_setter_keyT  s    $$Q''rI   c                "    U R                  5       $ r^  )rK   r`  s    rG   rb  rc  Z  s    779rI   c                    U $ r^  r_  r`  s    rG   rh  ri  ]  rd  rI   rZ  r(   )
stacklevelN)ra  r`   returnr`   )r_   _CaseInsensitiveDictionaryr   rX  r4  ra   ri   r   warningswarnr`   )rg  rp  validated_optionsrb  rh  r   rd   rW  r[  	validatedexcs   `          rG   get_validated_optionsrt  B  s     '56668		( 	( 		 mmo
#C(
		F&s,ER\]I!#-I =FnZ89 &  I'9: 	c#h155		s   B  C%C CCc                .    U R                  SSU S35      $ )NescCollectionenxcol_.z.escgetencrypted_fieldsr   s     rG   _esc_coll_namer|  o  s    8D61FGGrI   c                .    U R                  SSU S35      $ )NecocCollectionrw  z.ecocrx  rz  s     rG   _ecoc_coll_namer  s  s     0HTF%2HIIrI   )r,  wtimeoutr-  r8  jr  c                      \ rS rSrSr          SS jr\SS j5       r\SS j5       rSS jr	\SS j5       r
SS jr\SS	 j5       rS
rg)
BaseObjecti{  zA base class that provides attributes and methods common
to multiple pymongo classes.

SHOULD NOT BE USED BY DEVELOPERS EXTERNAL TO MONGODB.
c                <   [        U[        5      (       d  [        S5      eXl        [        U[        5      (       d  [        U< S35      eX l        [        U[        5      (       d  [        S5      eX0l        [        U[        5      (       d  [        S5      eX@l	        g )NzDcodec_options must be an instance of bson.codec_options.CodecOptionszR is not valid for read_preference. See pymongo.read_preferences for valid options.zGwrite_concern must be an instance of pymongo.write_concern.WriteConcernzDread_concern must be an instance of pymongo.read_concern.ReadConcern)
r_   r   ri   _codec_optionsr!   _read_preferencer$   _write_concernr   _read_concern)selfcodec_optionsrD  write_concernread_concerns        rG   __init__BaseObject.__init__  s     -66bcc+/;77"% &  
 !0-66Y  ,,44bcc)rI   c                    U R                   $ )zTRead only access to the :class:`~bson.codec_options.CodecOptions`
of this instance.
)r  r  s    rG   r  BaseObject.codec_options  s    
 """rI   c                    U R                   $ )zRead only access to the :class:`~pymongo.write_concern.WriteConcern`
of this instance.

.. versionchanged:: 3.0
  The :attr:`write_concern` attribute is now read only.
)r  r  s    rG   r  BaseObject.write_concern  s     """rI   c                V    U(       a  UR                   (       a  [        $ U R                  $ )zBRead only access to the write concern of this instance or session.)in_transactionr#   r  r  sessions     rG   _write_concern_forBaseObject._write_concern_for  s!     w--((!!!rI   c                    U R                   $ )zRead only access to the read preference of this instance.

.. versionchanged:: 3.0
  The :attr:`read_preference` attribute is now read only.
)r  r  s    rG   rD  BaseObject.read_preference  s     $$$rI   c                n    U(       a#  UR                  5       =(       d    U R                  $ U R                  $ )zDRead only access to the read preference of this instance or session.)_txn_read_preferencer  r  s     rG   _read_preference_forBaseObject._read_preference_for  s-     //1JT5J5JJ$$$rI   c                    U R                   $ )zlRead only access to the :class:`~pymongo.read_concern.ReadConcern`
of this instance.

.. versionadded:: 3.2
)r  r  s    rG   r  BaseObject.read_concern  s     !!!rI   )r  r  r  r  N)
r  r   rD  r!   r  r$   r  r   rm  None)rm  r   )rm  r$   )r   Optional[_AgnosticClientSession]rm  r$   )rm  r!   )r  r  rm  r!   )rm  r   )__name__
__module____qualname____firstlineno____doc__r  propertyr  r  r  rD  r  r  __static_attributes__r_  rI   rG   r  r  {  s    *#* %* $	*
 "* 
*: # # # #" % %% " "rI   r  c                      \ rS rSrSS jrSS jrSS jrSS jrSS jrSS jr	SS jr
SS	 jrSS
 jrSS S jjrS!S jrS"S jrS#S jr\SS$S jj5       r\S%S j5       rSS&S jjrS'S jrSS jrSrg)(rn  i  c                T    0 U l         0 U l        U R                  [        U0 UD65        g r^  )%_CaseInsensitiveDictionary__casedkeys _CaseInsensitiveDictionary__datar   r   )r  argskwargss      rG   r  #_CaseInsensitiveDictionary.__init__  s'    +-&(D$)&)*rI   c                <    UR                  5       U R                  ;   $ r^  )rK   r  r  rR   s     rG   __contains__'_CaseInsensitiveDictionary.__contains__  s    yy{dkk))rI   c                ,    [        U R                  5      $ r^  )r   r  r  s    rG   __len__"_CaseInsensitiveDictionary.__len__  s    4;;rI   c                (    S U R                    5       $ )Nc              3  $   #    U  H  ov   M     g 7fr^  r_  ).0rR   s     rG   	<genexpr>6_CaseInsensitiveDictionary.__iter__.<locals>.<genexpr>  s     0//s   )r  r  s    rG   __iter__#_CaseInsensitiveDictionary.__iter__  s    0t//00rI   c                x    [        U  Vs0 s H  oR                  U   U R                  U   _M!     sn5      $ s  snf r^  )r`   r  r  )r  ks     rG   __repr__#_CaseInsensitiveDictionary.__repr__  s5    FA$$Q'Q7FGGFs   &7c                \    UR                  5       nXR                  U'   X R                  U'   g r^  rK   r  r  )r  rR   rd   lc_keys       rG   __setitem__&_CaseInsensitiveDictionary.__setitem__  s'    #& #FrI   c                <    U R                   UR                  5          $ r^  )r  rK   r  s     rG   __getitem__&_CaseInsensitiveDictionary.__getitem__  s    {{399;''rI   c                X    UR                  5       nU R                  U	 U R                  U	 g r^  r  )r  rR   r  s      rG   __delitem__&_CaseInsensitiveDictionary.__delitem__  s'    V$KKrI   c                    [        U[        R                  5      (       d  [        $ [	        U 5      [	        U5      :w  a  gU H  nX   X   :w  d  M    g   g)NFT)r_   r   r   NotImplementedr   r  otherrR   s      rG   __eq__!_CaseInsensitiveDictionary.__eq__  sJ    %--!!t9E
"CyEJ&  rI   Nc                V    U R                   R                  UR                  5       U5      $ r^  )r  ry  rK   r  rR   defaults      rG   ry  _CaseInsensitiveDictionary.get  s    {{syy{G44rI   c                    UR                  5       nU R                  R                  US 5        U R                  R                  " U/UQ70 UD6$ r^  )rK   r  popr  )r  rR   r  r  r  s        rG   r  _CaseInsensitiveDictionary.pop  s@    VT*{{v7777rI   c                v    U R                   R                  5       u  pU R                  R                  U5      nX#4$ r^  )r  popitemr  r  )r  r  rf  rd   s       rG   r  "_CaseInsensitiveDictionary.popitem  s4     ,,446'rI   c                l    U R                   R                  5         U R                  R                  5         g r^  )r  clearr  r  s    rG   r   _CaseInsensitiveDictionary.clear  s$     rI   c                    g r^  r_  r  s      rG   
setdefault%_CaseInsensitiveDictionary.setdefault      rI   c                    g r^  r_  r  s      rG   r  r    r  rI   c                    UR                  5       nX;   a  U R                  U   $ XR                  U'   X R                  U'   U$ r^  )rK   r  r  )r  rR   r  r  s       rG   r  r    s@    ;;;v&&'*V$")KKNrI   c                    [        U[        5      (       a  U H  nX   XR                  U5      '   M     g U H	  nX   X'   M     g r^  )r_   rn  rf  r  s      rG   r   !_CaseInsensitiveDictionary.update  sB    e788-2Z__S)*  !J	 rI   c                <    U R                   UR                  5          $ r^  )r  rK   r  s     rG   rf  $_CaseInsensitiveDictionary.cased_key%  s    		,,rI   )__casedkeys__data)r  r   r  r   )rR   r`   rm  r   )rm  r)   )rm  zIterator[str])rm  r`   )rR   r`   rd   r   rm  r  )rR   r`   rm  r   )rR   r`   rm  r  )r  r   rm  r   r^  )rR   r`   r  Optional[Any]rm  r   )rR   r`   r  r   r  r   rm  r   )rm  tuple[str, Any])rm  r  )rR   r`   r  r  rm  r  )rR   r`   r  r   rm  r   )rR   r`   r  r  rm  r  )r  Mapping[str, Any]rm  r  )r  r  r  r  r  r  r  r  r  r  r  r  r  ry  r  r  r  r   r  r   rf  r  r_  rI   rG   rn  rn    s{    +
* 1H$
( 
	58
 
    '-rI   rn  c                 2     SSK Jn   g! [         a     gf = f)zIs the C extension installed?r   	_cmessageTF)pymongor  ImportErrorr  s    rG   has_cr  )  s    % s   	 
)rC   r`   rm  ztuple[str, int]r^  )rR   r`   rS   Optional[list]rm  r   )rc   r`   rd   r   rm  r   )rc   r`   rd   r   rm  r)   )rc   r`   rd   r   rm  Optional[str])rc   r`   rd   r   rm  r2   )rc   r`   rd   r   rm  r`   )rc   r`   rd   r   rm  Union[int, str])rc   r   rd   r   rm  r  )rc   r`   rd   r   rm  r   )rc   r`   rd   r   rm  Optional[float])rc   r   rd   r   rm  r  )r   r   rd   r   rm  r!   )r   r   rd   r   rm  r)   )r   r`   rd   r   rm  zlist[dict[str, str]])rc   r`   rd   r   rm  zdict[str, Union[bool, str]])rc   r`   rd   r   rm  z2Union[Type[MutableMapping], Type[RawBSONDocument]])rc   r   rd   r   rm  zOptional[TypeRegistry])rc   r`   rd   r   rm  r   )rc   r   rd   r   rm  r  )rc   r   rd   r   rm  r  )rc   r`   rd   r   rm  r  )rc   r   rd   r   rm  zOptional[DriverInfo])rc   r   rd   r   rm  zOptional[ServerApi])rc   r   rd   r   rm  zOptional[Callable])r   r  rm  r  )r   r   rm  r  )r   r   rd   r`   rm  r`   )r   r   rd   r   rm  zOptional[datetime.tzinfo])rc   r   rd   r   rm  r  )rc   r   rd   r   rm  zOptional[DatetimeConversion])rc   r`   rd   r`   rm  r`   )rc   r`   rd   r   rm  r  )rR   r`   rV  r3  rW  r  rm  r	   )T)rg  r  rp  r   rm  zMutableMapping[str, Any])r{  r  r   r`   rm  r   )rm  r   )r  
__future__r   r   ro  collectionsr   r   difflibr   typingr   r   r	   r
   r   r   r   r   r   r   r   r   urllib.parser   bsonr   bson.binaryr   bson.codec_optionsr   r   r   bson.raw_bsonr   pymongo.compression_supportr   r   pymongo.driver_infor   pymongo.errorsr   pymongo.monitoringr   pymongo.read_concernr   pymongo.read_preferencesr    r!   pymongo.server_apir"   pymongo.write_concernr#   r$   r%   pymongo.typingsr&   r'   __annotations__MAX_BSON_SIZEr*   MIN_WIRE_VERSIONMAX_WIRE_VERSIONMAX_WRITE_BATCH_SIZEMIN_SUPPORTED_SERVER_VERSIONMIN_SUPPORTED_WIRE_VERSIONMAX_SUPPORTED_WIRE_VERSIONHEARTBEAT_FREQUENCYKILL_CURSOR_FREQUENCYEVENTS_QUEUE_FREQUENCYSERVER_SELECTION_TIMEOUTMIN_HEARTBEAT_INTERVALMIN_SRV_RESCAN_INTERVALCONNECT_TIMEOUTMAX_POOL_SIZEMIN_POOL_SIZEMAX_CONNECTINGr3   r4   r5   LOCAL_THRESHOLD_MSRETRY_WRITESRETRY_READSr8   r:   _MAX_END_SESSIONSSRV_SERVICE_NAMESERVER_MONITORING_MODErH   rL   rU   UNSPECIFIEDSTANDARDPYTHON_LEGACYJAVA_LEGACYCSHARP_LEGACYr   re   rj   ro   rq   rv   ry   r{   rs   r~   r   r   r   r   r   r   r   r   r   r   r   r   r   r   	frozensetr   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r  r  r
  r  r4  rA  rK  rL  rM  r   r   optnamealiasesaliascopyrN  rO  rR  rS  rX  rQ  rt  r|  r  WRITE_CONCERN_OPTIONSr  r`   rn  r  r_  rI   rG   <module>r0     s    @ "   ( %    &  * M M ) + - 8 , ? ( W W6 "%k 2~ 2 M) # )     %                    #' - & $( = ' %) M (     */  . %7 M 6       	" &11"++&44$00&44 +	J48R*	V
c&2;
;;C4		* 	 0f7*(


H
? "++J!K 	V 
E7/ + 'C''C,'C A'C /	'C
 ''C 8'C 2'C 4'C )'C 7'C -'C .'C 8'C 1'C /'C  3!'C" 7#'C$ )%'C& ,''C( -)'C* .+'C,  8-'C. 7/'C0 
%1'C2 "#=3'C4  :5'C6 "7'C8 .9'C: $%<;'C< "#=='C> -?'C@ 	0A'CB /C'CD ;E'CF &0#;M'C ? 'X *%-'0#*$I6>27G C & .+/0''3A)73 $ 
50 n 	; 7 	     !> ?-335GW11/H/Q%e,  6 4M3Q3Q3S
0 S 
  -    456 ]a-	->-LY-- .2**&***ZHJ
 ""Z[ S" S"lU-S!9 U-prI   