
    [j                       U d Z ddlmZ ddlZddlZddlZddlmZmZ ddl	m
Z
mZmZmZmZmZmZmZmZmZmZmZ ddlmZ ddlmZ ddlmZ dd	lmZmZmZ dd
l m!Z! ddl"m#Z# ddl$m%Z%m&Z& ddl'm(Z( ddl)m*Z* ddl+m,Z, ddl-m.Z. ddl/m0Z0m1Z1 ddl2m3Z3 ddl4m5Z5m6Z6m7Z7 e
rddl8m9Z9 eefZ:de;d<   dZ<de<z  Z=de;d<   dZ>dZ?dZ@dZAdZBdZCdZDd ZEd ZFd!ZGd"ZHd#ZId$ZJd%ZKdZLdZMdZNd&e;d'<   dZOd&e;d(<   dZPd&e;d)<   d*ZQd+ZRd+ZSd,ZTd-e;d.<   d/ZUd-e;d0<   d1ZVd2ZWd3ZXdd8ZYdd9ZZdd>Z[ej\        ej]        ej^        ej_        ej`        d?ZaddCZbddDZcddEZdddFZeddHZfddIZgddJZhddKZiddLZjddNZkddOZlddQZmddRZnddTZoddUZpddVZqddWZrddXZsddZZtdd[Zudd\Zvdd]Zwdd`Zx eyg da          ZzddcZ{ddeZ|ddgZ}ddiZ~ddkZddmZddnZddoZddpZddrZddtZddvZddyZdd{Z eyg d|          Zdd}ZddZddZddZddZddgiZde;d<   i dedevde{deide%deqdebdeodebdendeodeddehdesdejdeudexi dejdebdebdebdepdeqdebdebdebdefdefdejdebdebdeldeede&eieeeredZde;d<   ebeeebeeefebeeweheoedZde;d<   e|e}ete,eejejeee~d
Zde;d<   ddiZde;d<   i Zde;d<   e                    e           e                                D ]\  ZZeD ]Zeevree         ee<   e                                Zde;d<   e                    e           g dZde;d<    eydg          ZddZddZ	 dddZddZddZ eyg dâ          Z G dĄ dŦ          Z G dƄ deeef                   ZdS )z9Functions and classes common to multiple pymongo modules.    )annotationsN)OrderedDictabc)TYPE_CHECKINGAnyCallableIteratorMappingMutableMappingNoReturnOptionalSequenceTypeUnionoverload)unquote_plus)SON)UuidRepresentation)CodecOptionsDatetimeConversionTypeRegistry)RawBSONDocument)
MECHANISMS)validate_compressorsvalidate_zlib_compression_level)
DriverInfoConfigurationError)_validate_event_listeners)ReadConcern)_MONGOS_MODES_ServerMode)	ServerApi)DEFAULT_WRITE_CONCERNWriteConcernvalidate_boolean)ClientSessionz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autonodestrreturntuple[str, int]c                    | }d}|                      d          }|dk    r$| d|         t          | |dz   d                   }}|                    d          r
|dd         }||fS )z5Split a host:port string into (host, int(port)) pair.ii  :Nr/   [)rfindr*   
startswith)r>   hostportidxs       R/var/www/app.qaans.com/backend/venv/lib/python3.11/site-packages/pymongo/common.pypartition_noderL      st    DD
**S//C
byy$3$ZT#'))_!5!5ds AbDz:    c                R    t          |           \  }}|                                |fS )z6Split and normalize a node name from a hello response.)rL   lower)r>   rH   rI   s      rK   
clean_noderP      s(    %%JD$ ::<<rM   keydummyr   r   c                &    t          d|            )z1Raise ConfigurationError with the given key name.zUnknown option r   )rQ   rR   s     rK   raise_config_errorrT      s    
4s44
5
55rM   )unspecifiedstandardpythonLegacy
javaLegacycsharpLegacyoptionvalueboolc                    t          |t                    r|dvrt          d|  d          |dk    S t          | |          S )z8Validates that value is True, False, 'true', or 'false'.)truefalseThe value of z must be 'true' or 'false'r^   )
isinstancer?   
ValueErrorr&   rZ   r[   s     rK   validate_boolean_or_stringrd      sT    % )))OVOOOPPPFE***rM   c                    t          |t                    r|S t          |t                    r2	 t          |          S # t          $ r t          d|  d          dw xY wt	          d|  d          )zDValidates that 'value' is an integer (or basestring representation).r`   z must be an integerNWrong type for z, value must be an integerra   r*   r?   rb   	TypeErrorrc   s     rK   validate_integerri      s    % T	E3		 T	Tu:: 	T 	T 	THVHHHIItS	T
HfHHH
I
IIs	   = Ac                X    t          | |          }|dk    rt          d|  d          |S )zFValidate that 'value' is a positive integer, which does not include 0.r   r`   z must be a positive integerri   rb   rZ   r[   vals      rK   validate_positive_integerrn      s9    
65
)
)C
axxLLLLMMMJrM   c                X    t          | |          }|dk     rt          d|  d          |S )z1Validate that 'value' is a positive integer or 0.r   r`   z must be a non negative integerrk   rl   s      rK   validate_non_negative_integerrp      s9    
65
)
)C
QwwPPPPQQQJrM   Optional[str]c                p    ||S t          | |          }t          |                                           |S )z1Validates that 'value' is file-like and readable.)validate_stringopencloserc   s     rK   validate_readablerv      s:    } FE**EKKLrM   c                *    ||S t          | |          S )z4Validate that 'value' is a positive integer or None.rn   rc   s     rK   !validate_positive_integer_or_nonery      s    }$VU333rM   c                *    ||S t          | |          S )z9Validate that 'value' is a positive integer or 0 or None.)rp   rc   s     rK   %validate_non_negative_integer_or_noner{      s    }(777rM   c                V    t          |t                    r|S t          d|  d          )z/Validates that 'value' is an instance of `str`.rf   z", value must be an instance of str)ra   r?   rh   rc   s     rK   rs   rs      s3    % 
PfPPP
Q
QQrM   c                *    ||S t          | |          S )z@Validates that 'value' is an instance of `basestring` or `None`.)rs   rc   s     rK   validate_string_or_noner~      s    }65)))rM   Union[int, str]c                    t          |t                    r|S t          |t                    r"	 t          |          S # t          $ r |cY S w xY wt	          d|  d          )/Validates that 'value' is an integer or string.rf   z&, value must be an integer or a stringrg   rc   s     rK   validate_int_or_basestringr      sz    % 	E3		 	u:: 	 	 	LLL	
TfTTT
U
UUs   = AAc                    t          |t                    r|S t          |t                    r3	 t          |          }n# t          $ r |cY S w xY wt	          | |          S t          d|  d          )r   rf   z3, value must be an non negative integer or a string)ra   r*   r?   rb   rp   rh   rl   s      rK   'validate_non_negative_int_or_basestringr     s    % :	E3		 :	e**CC 	 	 	LLL	,VS999
afaaa
b
bbs   > AAfloatc                    |  d}	 t          |          }n7# t          $ r t          |          dt          $ r t          |          dw xY wd|cxk     rdk     sn t          |  d          |S )zXValidates 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)r   rb   rh   )rZ   r[   errmsgs      rK   validate_positive_floatr     s     444F*e + + +  d* * * *T)*
 u????s????FUUUVVVLs	    4Ac                >    |dk    s|dk    rdS t          | |          S )zgValidates that 'value' is 0 or a positive float, or can be converted to
    0 or a positive float.
    r   0r   rc   s     rK   validate_positive_float_or_zeror   ,  s*     zzUc\\q"65111rM   Optional[float]c                0    ||S t          | |          dz  S zcValidates a timeout specified in milliseconds returning
    a value in floating point seconds.
    N     @@r   rc   s     rK   validate_timeout_or_noner   5  s#     }"6511F::rM   c                l    |t          |  d          |dk    s|dk    rdS t          | |          dz  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.
    Nz cannot be Noner   r   r   )r   r   rc   s     rK   validate_timeout_or_zeror   >  sK     } F!;!;!;<<<zzUc\\q"6511F::rM   c                H    ||dk    s|dk    rdS t          | |          dz  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   rc   s     rK    validate_timeout_or_none_or_zeror   K  s3    
 }

esllt"6511F::rM   c                0    |dS t          | |          dz  S r   )r   rc   s     rK   validate_timeoutmsr   U  s#     }t*6599FBBrM   c                >    |dk    s|dk    rdS t          | |          S )zBValidates maxStalenessSeconds according to the Max Staleness Spec.rD   z-1rx   rc   s     rK   validate_max_stalenessr   ^  s(    {{etmmr$VU333rM   r"   c                T    t          |t                    st          |d          |S )zValidate a read preference.z is not a read preference.)ra   r"   rh   rR   r[   s     rK   validate_read_preferencer   f  s1    e[)) @5>>>???LrM   c                <    |t           vrt          | d          |S )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!   rb   r   s     rK   validate_read_preference_moder   m  s+     M!!EBBBCCCLrM   c                d    |t           vr&t          |  dt          t                                |S )z&Validate the authMechanism URI option.z must be in )r   rb   tuplerc   s     rK   validate_auth_mechanismr   y  s6    JFCCj0A0ACCDDDLrM   c                    	 t           |         S # t          $ r( t          | dt          t                                dw xY w)z<Validate the uuid representation option selected in the URI.z3 is an invalid UUID representation. Must be one of N)_UUID_REPRESENTATIONSKeyErrorrb   r   r   s     rK   validate_uuid_representationr     sg    $U++    . .*++. .
 
 		s	    2Anamelist[dict[str, str]]c                   t          |t                    s|g}g }|D ]}|dk    r|                    i            	 i }|                    d          D ]9}|                    d          \  }}t	          |          |t	          |          <   :|                    |           # t
          $ r t          |d|            dw xY w|S )z5Parse readPreferenceTags if passed as a client kwarg. ,rC   z not a valid value for N)ra   listappendsplitr   	Exceptionrb   )r   r[   tag_setstag_settagstagrQ   rm   s           rK   validate_read_preference_tagsr     s    eT"" H T Tb==OOB	TD}}S)) < <99S>>S*6s*;*;\#&&''OOD!!!! 	T 	T 	THH$HHIItS	TOs   A&B## C)SERVICE_NAMECANONICALIZE_HOST_NAMESERVICE_REALMAWS_SESSION_TOKENPROVIDER_NAMEdict[str, Union[bool, str]]c                6   i }t          |t                    s:t          |t                    st          d          |                                D ]\  }}t          |t                    r|||<    t          |t
                    r%t          |                                          ||<   Z|dv rt          |t                    r|||<   yt          j	        |          rdt          j
        |          }|dk    rd}nt          d|           t          |j                  |k    r| d| d}t          |          |||<   t          d          |S t          | |          }|                    d	          D ]}	 |                    d
          \  }}n(# t          $ r d|v rd}t          d| d          dw xY w|t          vr't          | dt!          t                     d          |dk    rt#          ||          ||<   t%          |          ||<   |S )z!Validate authMechanismProperties.zCAuth mechanism properties must be given as a string or a dictionary)allowed_hostsrequest_token_callbackr)   z%Unrecognized Auth mechanism function z must accept z parameterszDAuth mechanism property values must be strings or callback functionsr   rC   r   z_AWS_SESSION_TOKEN:<redacted token>, did you forget to percent-escape the token with quote_plus?zQauth mechanism properties must be key:value pairs like SERVICE_NAME:mongodb, not .Nz< is not a supported auth mechanism property. Must be one of r   )ra   r?   dictrb   itemsr\   rO   r   inspect
isfunction	signaturelen
parametersrs   r   _MECHANISM_PROPSr   rd   r   )	rZ   r[   propsrQ   r   expected_paramsmsgoptrm   s	            rK   "validate_auth_mechanism_propertiesr     s   EeS!! %&& 	dbccc++-- 	 	JC%%% "c

E4((  ZZ--//c

)))j.E.E)"c

#E** #-e44	222&'OO$%RS%R%RSSSy+,,?? KKKKKC$S//)"c

 Z   FE**E{{3 + +	yy~~HC 	 	 	"c))C  ' #' ' '  		 &&& . .)**. . .  
 ***3C==E#JJ%c**E#JJLs   ;F%F92Union[Type[MutableMapping], Type[RawBSONDocument]]c                   d}	 t          |t          j                  }n?# t          $ r2 t	          |d          rt          |j        t          j                  }Y nw xY w|s't          |t                    st          |  d          |S )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   rh   hasattrr   r   )rZ   r[   
is_mappings      rK   validate_document_classr     s     JJs'9::

 J J J5,'' 	J#E$4c6HIIJJ  
j@@ 
 5 5 5
 
 	

 Ls    9AAOptional[TypeRegistry]c                f    |.t          |t                    st          |  dt                     |S )z"Validate the type_registry option.Nz must be an instance of )ra   r   rh   rc   s     rK   validate_type_registryr     s8    E<!@!@6II<IIJJJLrM   r   c                T    t          |t                    st          |  d          |S )z!Validates that 'value' is a list.z must be a list)ra   r   rh   rc   s     rK   validate_listr     s0    eT"" 46222333LrM   Optional[list]c                *    ||S t          | |          S )z)Validates that 'value' is a list or None.)r   rc   s     rK   validate_list_or_noner   
  s    }'''rM   Nonec                l    t          |t          j        t          f          st	          |  d          dS )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)ra   r   r
   r   rh   rc   s     rK   validate_list_or_mappingr     sI    eck4011 
 " " "
 
 	

 
rM   c                ^    t          |t          j                  st          |  d          dS )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)ra   r   r
   rh   rc   s     rK   validate_is_mappingr     sD    eS[)) 
 " " "
 
 	

 
rM   c                l    t          |t          j        t          f          st	          |  d          dS )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)ra   r   r   r   rh   rc   s     rK   validate_is_document_typer   %  sJ    ec0/BCC 
 ) ) )
 
 	

 
rM   c                    ||S t          | |           t          |                    d                    dk    rt          |  d          |S )zValidate the appname option.Nzutf-8   z must be <= 128 bytes)rs   r   encoderb   rc   s     rK   validate_appname_or_noner   0  sW    }FE"""
5<<  !!C''F999:::LrM   Optional[DriverInfo]c                \    ||S t          |t                    st          |  d          |S ) Validate the driver keyword arg.Nz" must be an instance of DriverInfo)ra   r   rh   rc   s     rK   validate_driver_or_noner   ;  s;    }eZ(( G6EEEFFFLrM   Optional[ServerApi]c                \    ||S t          |t                    st          |  d          |S )z$Validate the server_api keyword arg.Nz! must be an instance of ServerApi)ra   r#   rh   rc   s     rK   validate_server_api_or_noner   D  s;    }eY'' F6DDDEEELrM   Optional[Callable]c                P    ||S t          |          st          |  d          |S )z%Validates that 'value' is a callable.Nz must be a callable)callablerb   rc   s     rK   validate_is_callable_or_noner   M  s6    }E?? 9F777888LrM   replacementMapping[str, Any]c                    t          d|            | rUt          | t                    sBt          t	          |                     }|                    d          rt          d          dS dS dS )z Validate a replacement document.r   $z'replacement can not include $ operatorsN)r   ra   r   nextiterrG   rb   )r   firsts     rK   validate_ok_for_replacer   V  s    {333 H:k?CC HT+&&''C   	HFGGGH H H H	H 	HrM   updatec                    t          d|            | st          d          t          | t                     }t	          t          |                     }|r$|                    d          st          d          dS dS )zValidate an update document.r   zupdate cannot be emptyr   z"update only works with $ operatorsN)r   rb   ra   r   r   r   rG   )r   is_documentr   s      rK   validate_ok_for_updater   `  s    Xv... 31222 ...KfE ?5++C00 ?=>>>? ? ? ?rM   )strictreplaceignorec                d    |t           vr&t          | dt          t                                |S )zAValidate the Unicode decode error handler option of CodecOptions.z< is an invalid Unicode decode error handler. Must be one of )_UNICODE_DECODE_ERROR_HANDLERSrb   r   r   s     rK   %validate_unicode_decode_error_handlerr  p  sJ    222 7 73447 7
 
 	

 LrM   Optional[datetime.tzinfo]c                b    |,t          |t          j                  st          d|z            |S )zValidate the tzinfo optionNz)%s must be an instance of datetime.tzinfo)ra   datetimetzinforh   r   s     rK   validate_tzinfor  {  s2    E8?!C!CCeKLLLLrM   Optional[Any]c                ^    ||S ddl m} t          ||          st          |  d          |S )r   Nr   )AutoEncryptionOptsz* must be an instance of AutoEncryptionOpts)pymongo.encryption_optionsr	  ra   rh   )rZ   r[   r	  s      rK   %validate_auto_encryption_opts_or_noner    sN    }======e/00 O6MMMNNNLrM   Optional[DatetimeConversion]c                .   |t           j        S t          |t                    r=|                                rt          t          |                    S t           |         S t          |t
                    rt          |          S t          |  d          )z%Validate a DatetimeConversion string.Nz5 must be a str or int representing DatetimeConversion)r   DATETIMEra   r?   isdigitr*   rh   rc   s     rK   validate_datetime_conversionr    s    }!**% )==?? 	2%c%jj111!%((	E3		 )!%(((
vTTT
U
UUrM   c                8    |dvrt          |  d|d          |S )z)Validate the serverMonitoringMode option.>   r=   pollstream=z7 is invalid. Must be one of "auto", "stream", or "poll")rb   rc   s     rK   validate_server_monitoring_moder    s;    ...XXXXX
 
 	
 LrM   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servermonitoringmodez$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/  rI  z	list[str]TIMEOUT_OPTIONStuple[str, Any]c                f    t          | |          \  }}|t          vrt          d|            | |fS )z,Validate optional authentication parameters.zUnknown authentication option: )validate_AUTH_OPTIONSr   )rZ   r[   rO   s      rK   validate_auth_optionr^  )  sA    FE**LE5M!! !K6!K!KLLL5=rM   c                    |                                  }t                              |t                    } || |          }| |fS )zGeneric validation function.)rO   rX  getrT   )rZ   r[   rO   	validators       rK   r\  r\  1  s>    LLNNEu&899IIfe$$E5=rM   optionswarnMutableMapping[str, Any]c                    t           t                    rt                      }dd}d fd}n
i }dd}dd}                                 D ]\  }} ||          }	 t                              |t
                    } |||          }|| ||          <   L# t          t          t          f$ r1}	|r$t          j
        t          |	          d	           n Y d
}	~	d
}	~	ww xY w|S )a  Validate each entry in options and raise a warning if it is not valid.
    Returns a copy of options with invalid entries removed.

    :Parameters:
        - `opts`: A dict containing MongoDB URI options.
        - `warn` (optional): If ``True`` then warnings will be logged and
          invalid options will be ignored. Otherwise, invalid options will
          cause errors.
    xr?   r@   c                    | S N rf  s    rK   get_normed_keyz-get_validated_options.<locals>.get_normed_keyI      HrM   c                .                         |           S rh  )	cased_key)rf  rb  s    rK   get_setter_keyz-get_validated_options.<locals>.get_setter_keyL  s    $$Q'''rM   c                *    |                                  S rh  )rO   rj  s    rK   rk  z-get_validated_options.<locals>.get_normed_keyR  s    7799rM   c                    | S rh  ri  rj  s    rK   ro  z-get_validated_options.<locals>.get_setter_keyU  rl  rM   r)   )
stacklevelN)rf  r?   r@   r?   )ra   _CaseInsensitiveDictionaryr   r>  r`  rT   rb   rh   r   warningsrc  r?   )
rb  rc  validated_optionsrk  ro  r   r[   
normed_keyra  excs
   `         rK   get_validated_optionsrx  9  sl    '566 688	 	 	 		( 	( 	( 	( 	( 	( 	( 	 	 	 		 	 	 	 mmoo B B
U#^C((
		B155jBTUUIIc5))E =BnnZ8899 I'9: 	 	 	 c#hh155555 65555	 s   ,BC"1'CC"encrypted_fieldsc                6    |                      dd| d          S )NescCollectionenxcol_.z.escr`  ry  r   s     rK   _esc_coll_namer  g  s$    1FD1F1F1FGGGrM   c                6    |                      dd| d          S )NecocCollectionr|  z.ecocr}  r~  s     rK   _ecoc_coll_namer  k  s%     02HT2H2H2HIIIrM   )r7  wtimeoutr8  rB  jr!  c                      e Zd ZdZddZedd            Zedd            ZddZedd            Z	ddZ
edd            ZdS )
BaseObjectzA base class that provides attributes and methods common
    to multiple pymongo classes.

    SHOULD NOT BE USED BY DEVELOPERS EXTERNAL TO MONGODB.
    codec_optionsr   rN  r"   write_concernr%   read_concernr    r@   r   c                d   t          |t                    st          d          || _        t          |t                    st          |d          || _        t          |t                    st          d          || _        t          |t                    st          d          || _	        d S )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)
ra   r   rh   _BaseObject__codec_optionsr"   _BaseObject__read_preferencer%   _BaseObject__write_concernr    _BaseObject__read_concern)selfr  rN  r  r  s        rK   __init__zBaseObject.__init__z  s     -66 	dbccc,/;77 	"     
 "1-66 	Y    -,44 	dbccc*rM   c                    | j         S )zdRead only access to the :class:`~bson.codec_options.CodecOptions`
        of this instance.
        )r  r  s    rK   r  zBaseObject.codec_options  s    
 ##rM   c                    | j         S )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    rK   r  zBaseObject.write_concern  s     ##rM   sessionOptional[ClientSession]c                0    |r|j         rt          S | j        S )zBRead only access to the write concern of this instance or session.)in_transactionr$   r  r  r  s     rK   _write_concern_forzBaseObject._write_concern_for  s%      	)w- 	)((!!rM   c                    | j         S )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    rK   rN  zBaseObject.read_preference  s     %%rM   c                J    |r|                                 p| j        S | j        S )zDRead only access to the read preference of this instance or session.)_txn_read_preferencer  r  s     rK   _read_preference_forzBaseObject._read_preference_for  s0      	L//11KT5KK%%rM   c                    | j         S )zRead only access to the :class:`~pymongo.read_concern.ReadConcern`
        of this instance.

        .. versionadded:: 3.2
        )r  r  s    rK   r  zBaseObject.read_concern  s     ""rM   N)
r  r   rN  r"   r  r%   r  r    r@   r   )r@   r   )r@   r%   )r  r  r@   r%   )r@   r"   )r  r  r@   r"   )r@   r    )__name__
__module____qualname____doc__r  propertyr  r  r  rN  r  r  ri  rM   rK   r  r  s  s         + + + +: $ $ $ X$ $ $ $ X$" " " " & & & X&& & & & # # # X# # #rM   r  c                      e Zd Zd$dZd%d	Zd&dZd'dZd(dZd)dZd*dZ	d+dZ
d,dZd-d.dZd/dZd0dZd1dZed-d2d            Zed3d            Zd-d4d Zd5d"Zd*d#ZdS )6rs  argsr   kwargsc                `    i | _         i | _        |                     t          |i |           d S rh  )%_CaseInsensitiveDictionary__casedkeys _CaseInsensitiveDictionary__datar   r   )r  r  r  s      rK   r  z#_CaseInsensitiveDictionary.__init__  s6    +-&(D$)&))*****rM   rQ   r?   r@   r\   c                8    |                                 | j        v S rh  )rO   r  r  rQ   s     rK   __contains__z'_CaseInsensitiveDictionary.__contains__  s    yy{{dk))rM   r*   c                *    t          | j                  S rh  )r   r  r  s    rK   __len__z"_CaseInsensitiveDictionary.__len__  s    4;rM   Iterator[str]c                $    d | j         D             S )Nc              3     K   | ]}|V  d S rh  ri  ).0rQ   s     rK   	<genexpr>z6_CaseInsensitiveDictionary.__iter__.<locals>.<genexpr>  s"      00000000rM   )r  r  s    rK   __iter__z#_CaseInsensitiveDictionary.__iter__  s    00t/0000rM   c                :     t           fd D                       S )Nc                B    i | ]}j         |         j        |         S ri  )r  r  )r  kr  s     rK   
<dictcomp>z7_CaseInsensitiveDictionary.__repr__.<locals>.<dictcomp>  s)    FFFAD$Q'QFFFrM   )r?   r  s   `rK   __repr__z#_CaseInsensitiveDictionary.__repr__  s&    FFFFFFFGGGrM   r[   r   c                V    |                                 }|| j        |<   || j        |<   d S rh  rO   r  r  )r  rQ   r[   lc_keys       rK   __setitem__z&_CaseInsensitiveDictionary.__setitem__  s.    #& #FrM   c                @    | j         |                                         S rh  )r  rO   r  s     rK   __getitem__z&_CaseInsensitiveDictionary.__getitem__  s    {399;;''rM   c                N    |                                 }| j        |= | j        |= d S rh  r  )r  rQ   r  s      rK   __delitem__z&_CaseInsensitiveDictionary.__delitem__  s*    V$KrM   otherc                    t          |t          j                  st          S t	          |           t	          |          k    rdS |D ]}| |         ||         k    r dS dS )NFT)ra   r   r
   NotImplementedr   r  r  rQ   s      rK   __eq__z!_CaseInsensitiveDictionary.__eq__  sm    %-- 	"!!t99E

""5 	 	CCyE#J&&uu ' trM   Ndefaultr  c                \    | j                             |                                |          S rh  )r  r`  rO   r  rQ   r  s      rK   r`  z_CaseInsensitiveDictionary.get  s     {syy{{G444rM   c                    |                                 }| j                            |d             | j        j        |g|R i |S rh  )rO   r  popr  )r  rQ   r  r  r  s        rK   r  z_CaseInsensitiveDictionary.pop  sL    VT***t{v7777777rM   rZ  c                v    | j                                         \  }}| j                            |          }||fS rh  )r  popitemr  r  )r  r  rn  r[   s       rK   r  z"_CaseInsensitiveDictionary.popitem  s9     ,4466	''%rM   c                j    | j                                          | j                                         d S rh  )r  clearr  r  s    rK   r  z _CaseInsensitiveDictionary.clear   s1       rM   c                    d S rh  ri  r  s      rK   
setdefaultz%_CaseInsensitiveDictionary.setdefault      rM   c                    d S rh  ri  r  s      rK   r  z%_CaseInsensitiveDictionary.setdefault  r  rM   c                x    |                                 }|| v r| j        |         S || j        |<   || j        |<   |S rh  )rO   r  r  )r  rQ   r  r  s       rK   r  z%_CaseInsensitiveDictionary.setdefault  sC    $;;;v&&'*DV$")DKNrM   r   c                    t          |t                    r%|D ] }||         | |                    |          <   !d S |D ]}||         | |<   d S rh  )ra   rs  rn  r  s      rK   r   z!_CaseInsensitiveDictionary.update  su    e788 	' 8 8-23ZU__S))**8 8  ' '!#JS		' 'rM   c                @    | j         |                                         S rh  )r  rO   r  s     rK   rn  z$_CaseInsensitiveDictionary.cased_key  s    		,,rM   )r  r   r  r   )rQ   r?   r@   r\   )r@   r*   )r@   r  )r@   r?   )rQ   r?   r[   r   r@   r   )rQ   r?   r@   r   )rQ   r?   r@   r   )r  r   r@   r\   rh  )rQ   r?   r  r  r@   r   )rQ   r?   r  r   r  r   r@   r   )r@   rZ  )r@   r   )rQ   r?   r  r   r@   r  )rQ   r?   r  r   r@   r   )rQ   r?   r  r  r@   r  )r  r   r@   r   )r  r  r  r  r  r  r  r  r  r  r  r  r`  r  r  r  r   r  r   rn  ri  rM   rK   rs  rs    s       + + + +
* * * *       1 1 1 1H H H H$ $ $ $
( ( ( (       
	 	 	 	5 5 5 5 58 8 8 8
       
        X    X    ' ' ' '- - - - - -rM   rs  )r>   r?   r@   rA   )rQ   r?   rR   r   r@   r   )rZ   r?   r[   r   r@   r\   )rZ   r?   r[   r   r@   r*   )rZ   r?   r[   r   r@   rq   )rZ   r?   r[   r   r@   r3   )rZ   r?   r[   r   r@   r?   )rZ   r?   r[   r   r@   r   )rZ   r   r[   r   r@   r   )rZ   r?   r[   r   r@   r   )rZ   r?   r[   r   r@   r   )rZ   r   r[   r   r@   r   )rR   r   r[   r   r@   r"   )rR   r   r[   r   r@   r*   )r   r?   r[   r   r@   r   )rZ   r?   r[   r   r@   r   )rZ   r?   r[   r   r@   r   )rZ   r   r[   r   r@   r   )rZ   r?   r[   r   r@   r   )rZ   r   r[   r   r@   r   )rZ   r   r[   r   r@   r   )rZ   r?   r[   r   r@   r   )rZ   r   r[   r   r@   r   )rZ   r   r[   r   r@   r   )rZ   r   r[   r   r@   r   )r   r   r@   r   )r   r   r@   r   )rR   r   r[   r?   r@   r?   )rR   r   r[   r   r@   r  )rZ   r   r[   r   r@   r  )rZ   r   r[   r   r@   r  )rZ   r?   r[   r?   r@   r?   )rZ   r?   r[   r   r@   rZ  )T)rb  r   rc  r\   r@   rd  )ry  r   r   r?   r@   r   )r  
__future__r   r  r   rt  collectionsr   r   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.authr   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.client_sessionr'   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_CONNECTINGr4   r5   r6   LOCAL_THRESHOLD_MSRETRY_WRITESRETRY_READSr9   r;   _MAX_END_SESSIONSSRV_SERVICE_NAMESERVER_MONITORING_MODErL   rP   rT   UNSPECIFIEDSTANDARDPYTHON_LEGACYJAVA_LEGACYCSHARP_LEGACYr   rd   ri   rn   rp   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  r>  rK  rU  rV  rW  r   r   optnamealiasesaliascopyrX  rY  r]  r^  r\  rx  r  r  WRITE_CONCERN_OPTIONSr  r?   rs  ri  rM   rK   <module>r     sk    @ ? ? " " " " " "    ( ( ( ( ( ( ( (                            & % % % % %       * * * * * * M M M M M M M M M M ) ) ) ) ) ) # # # # # #        + * * * * * - - - - - - 8 8 8 8 8 8 , , , , , , ? ? ? ? ? ? ? ? ( ( ( ( ( ( W W W W W W W W W W 5444444!$k 2 2 2 2 2 M)  ) ) ) )     %                    #'  & & & & $(  ' ' ' ' %)  ( ( ( (     */  . . . . %7  6 6 6 6       	 	 	 	   6 6 6 6 &1"+&4$0&4  + + + +	J 	J 	J 	J         4 4 4 48 8 8 8R R R R* * * *	V 	V 	V 	V
c 
c 
c 
c   &2 2 2 2; ; ; ;
; 
; 
; 
;; ; ; ;C C C C4 4 4 4   	 	 	 	   	 	 	 	   * 9    8 8 8 8v   *      ( ( ( (
 
 
 

 
 
 

 
 
 
            H H H H
? 
? 
? 
? "++J+J+J!K!K       	 	 	 	V V V 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* .+'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 'CF &0#;M'C 'C 'C  ' ' ' 'X *%-'0#*$I6>27G G     & .+/0''3A)7 7    $ 
50     	;  	 	 	 	     !> ? ? ?-3355 R RGW R R111/H/Q%e,R
 4M3Q3Q3S3S
 S S S S 
  -             	4566       .2+ + + + +\H H H HJ J J J
 "	"Z"Z"Z[[ S# S# S# S# S# S# S# S#lU- U- U- U- U-S!9 U- U- U- U- U-rM   