
    =h                       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<   d1ZVd2ZWd3ZXdd4ZYdd5ZZdd6Z[ej                  ej                  ej                  ej                  ej                  d7Zadd8Zbdd9Zcdd:Zddd;Zedd<Zfdd=Zgdd>Zhdd?Zidd@ZjddAZkddBZlddCZmddDZnddEZoddFZpddGZqddHZrddIZsddJZtddKZuddLZvddMZwddNZx eyg dO      ZzddPZ{	 	 	 	 	 	 ddQZ|ddRZ}ddSZ~ddTZddUZddVZddWZddXZddYZddZZdd[Zdd\Zdd]Z eyg d^      Zdd_Zdd`ZddaZddbZddcZdddegiZdfe;dg<   i dhedievdje{dkeidle%dmeqdnebdoeodpebdqendreodseddtehduesdvejdweudxexi dyejdzebd{ebd|ebd}epd~eqddebdebdebdefdefdejdebdebdeldeede&eieeeredZde;d<   ebeeebeeefebeeweheoedZde;d<   e|e}ete,eejejeee~d
Zde;d<   deddiZde;d<   i Zde;d<   ej+                  e       ej-                         D ]  \  ZZeD ]  Zeevsee   ee<     ej5                         Zde;d<   ej+                  e       g dZde;d<    eydjg      ZddZddZ	 d	 	 	 	 	 ddZddZddZ eyg d      Z G d d      Z G d deeef         Zy)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autoc                    | }d}| j                  d      }|dk7  r| d| t        | |dz   d       }}|j                  d      r|dd }||fS )z5Split a host:port string into (host, int(port)) pair.ii  :Nr/   [)rfindr*   
startswith)nodehostportidxs       ^/var/www/html/phonemate/phone_mate_backend/venv/lib/python3.12/site-packages/pymongo/common.pypartition_noderI      s_    DD
**S/C
by$3ZT#')_!5dsAbz:    c                B    t        |       \  }}|j                         |fS )z6Split and normalize a node name from a hello response.)rI   lower)rD   rE   rF   s      rH   
clean_noderM      s#    %JD$ ::<rJ   c                    t        d|        )z1Raise ConfigurationError with the given key name.zUnknown option r   )keydummys     rH   raise_config_errorrQ      s    
se4
55rJ   )unspecifiedstandardpythonLegacy
javaLegacycsharpLegacyc                j    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'rX   )
isinstancestr
ValueErrorr&   optionvalues     rH   validate_boolean_or_stringra      sA    %))}VH4NOPPFE**rJ   c                    t        |t              r|S t        |t              r	 t        |      S t	        d|  d      # t        $ r t        d|  d      dw xY w)zDValidates that 'value' is an integer (or basestring representation).rZ   z must be an integerNWrong type for z, value must be an integerr[   r*   r\   r]   	TypeErrorr^   s     rH   validate_integerrf      sl    %	E3		Tu: ofX-GH
II  	T}VH4GHItS	Ts	   
> Ac                F    t        | |      }|dk  rt        d|  d      |S )zFValidate that 'value' is a positive integer, which does not include 0.r   rZ   z must be a positive integerrf   r]   r_   r`   vals      rH   validate_positive_integerrk      s/    
65
)C
ax=0KLMMJrJ   c                F    t        | |      }|dk  rt        d|  d      |S )z1Validate that 'value' is a positive integer or 0.r   rZ   z must be a non negative integerrh   ri   s      rH   validate_non_negative_integerrm      s/    
65
)C
Qw=0OPQQJrJ   c                X    ||S t        | |      }t        |      j                          |S )z1Validates that 'value' is file-like and readable.)validate_stringopencloser^   s     rH   validate_readablerr      s/    } FE*EKLrJ   c                "    ||S t        | |      S )z4Validate that 'value' is a positive integer or None.rk   r^   s     rH   !validate_positive_integer_or_noneru      s    }$VU33rJ   c                "    ||S t        | |      S )z9Validate that 'value' is a positive integer or 0 or None.)rm   r^   s     rH   %validate_non_negative_integer_or_nonerw      s    }(77rJ   c                D    t        |t              r|S t        d|  d      )z/Validates that 'value' is an instance of `str`.rc   z", value must be an instance of str)r[   r\   re   r^   s     rH   ro   ro      s&    %
ofX-OP
QQrJ   c                "    ||S t        | |      S )z@Validates that 'value' is an instance of `basestring` or `None`.)ro   r^   s     rH   validate_string_or_nonerz      s    }65))rJ   c                    t        |t              r|S t        |t              r	 t        |      S t	        d|  d      # t        $ r |cY S w xY w)/Validates that 'value' is an integer or string.rc   z&, value must be an integer or a stringrd   r^   s     rH   validate_int_or_basestringr}      sW    %	E3		u: ofX-ST
UU  	L	s   
> AAc                    t        |t              r|S t        |t              r	 t        |      }t	        | |      S t        d|  d      # t        $ r |cY S w xY w)r|   rc   z3, value must be an non negative integer or a string)r[   r*   r\   r]   rm   re   ri   s      rH   'validate_non_negative_int_or_basestringr     sc    %	E3		e*C -VS99
ofX-`a
bb  	L	s   A
 
AAc                    |  d}	 t        |      }d|cxk  rdk  sn t        |  d      |S # t        $ r t        |      dt        $ r t        |      dw xY w)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)floatr]   re   )r_   r`   errmsgs      rH   validate_positive_floatr     sw     x34F*e u?s?F8#TUVVL  + d* *T)*s	   / *Ac                0    |dk(  s|dk(  ryt        | |      S )zgValidates that 'value' is 0 or a positive float, or can be converted to
    0 or a positive float.
    r   0r   r^   s     rH   validate_positive_float_or_zeror   ,  s!     zUc\"6511rJ   c                (    ||S t        | |      dz  S )cValidates a timeout specified in milliseconds returning
    a value in floating point seconds.
         @@r   r^   s     rH   validate_timeout_or_noner   5  s      }"651F::rJ   c                V    |t        |  d      |dk(  s|dk(  ry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.
    z cannot be Noner   r   r   )r   r   r^   s     rH   validate_timeout_or_zeror   >  s=     } F8?!;<<zUc\"651F::rJ   c                :    |
|dk(  s|dk(  ry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   r^   s     rH    validate_timeout_or_none_or_zeror   K  s*    
 }
esl"651F::rJ   c                &    |yt        | |      dz  S )r   Nr   )r   r^   s     rH   validate_timeoutmsr   U  s     }*659FBBrJ   c                0    |dk(  s|dk(  ryt        | |      S )zBValidates maxStalenessSeconds according to the Max Staleness Spec.r@   z-1rt   r^   s     rH   validate_max_stalenessr   ^  s    {etm$VU33rJ   c                B    t        |t              st        |d      |S )zValidate a read preference.z is not a read preference.)r[   r"   re   rP   r`   s     rH   validate_read_preferencer   f  s$    e[)5)#=>??LrJ   c                2    |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!   r]   r   s     rH   validate_read_preference_moder   m  s$     M!E7"ABCCLrJ   c                P    |t         vrt        |  dt        t                      |S )z&Validate the authMechanism URI option.z must be in )r   r]   tupler^   s     rH   validate_auth_mechanismr   y  s+    JF8<j0A/BCDDLrJ   c                l    	 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KeyErrorr]   r   r   s     rH   validate_uuid_representationr     sN    $U++ g *+,.
 		s    (3c                R   t        |t              s|g}g }|D ]n  }|dk(  r|j                  i        	 i }|j                  d      D ]-  }|j                  d      \  }}t	        |      |t	        |      <   / |j                  |       p |S # t
        $ r t        |d|        dw xY w)z5Parse readPreferenceTags if passed as a client kwarg. ,r?   z not a valid value for N)r[   listappendsplitr   	Exceptionr]   )namer`   tag_setstag_settagstagrO   rj   s           rH   validate_read_preference_tagsr     s    eT"Hb=OOB	TD}}S)99S>S*6s*;\#&' * OOD!  O  	T{*A$HItS	Ts   ABB&)SERVICE_NAMECANONICALIZE_HOST_NAMESERVICE_REALMAWS_SESSION_TOKENPROVIDER_NAMEc                   i }t        |t              st        |t              st        d      |j	                         D ]  \  }}t        |t              r|||<   t        |t
              rt        |      j                         ||<   I|dv rt        |t              r|||<   ct        j                  |      r\t        j                  |      }|dk(  rd}nt        d|       t        |j                        |k7  r| d| d}t        |      |||<   t        d       |S t        | |      }|j                  d	      D ]`  }	 |j                  d
      \  }}|t        vrt        | dt!        t               d      |dk(  rt#        ||      ||<   St%        |      ||<   b |S # t        $ r d|v rd}t        d| d      dw xY w)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   r?   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   )r[   r\   dictr]   itemsboolrL   r   inspect
isfunction	signaturelen
parametersro   r   _MECHANISM_PROPSr   ra   r   )	r_   r`   propsrO   r   expected_paramsmsgoptrj   s	            rH   "validate_auth_mechanism_propertiesr     s   EeS!%&bcc++-JC%%"c
E4( Z--/c
))j.E"c
##E*#--e4	22&'O$'LSE%RSSy++,? E.?{KC$S/)"c
 Z % (* FE*E{{3	yy~HC &&% 6)*+1. 
 **3C=E#J%c*E#J1  4 L/  	"c)C    #uA' 		s   F## Gc                    d}	 t        |t        j                        }|st        |t              st        |  d      |S # t        $ r3 t	        |d      r$t        |j
                  t        j                        }Y ]w xY w)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   re   hasattrr   r   )r_   r`   
is_mappings      rH   validate_document_classr     s     JJs'9'9:
 j@h 5 5
 	

 L  J5,'#E$4$4c6H6HIJJs   A   9A<;A<c                R    |$t        |t              st        |  dt               |S )z"Validate the type_registry option.z must be an instance of )r[   r   re   r^   s     rH   validate_type_registryr     s-    E<!@6(":<.IJJLrJ   c                B    t        |t              st        |  d      |S )z!Validates that 'value' is a list.z must be a list)r[   r   re   r^   s     rH   validate_listr     s#    eT"6(/233LrJ   c                "    ||S t        | |      S )z)Validates that 'value' is a list or None.)r   r^   s     rH   validate_list_or_noner   
  s    }''rJ   c                `    t        |t        j                  t        f      st	        |  d      y)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   re   r^   s     rH   validate_list_or_mappingr     s6    eckk401h " "
 	
 2rJ   c                T    t        |t        j                        st        |  d      y)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
   re   r^   s     rH   validate_is_mappingr     s1    eS[[)h " "
 	
 *rJ   c                `    t        |t        j                  t        f      st	        |  d      y)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   re   r^   s     rH   validate_is_document_typer   %  s9    ec00/BCh ) )
 	
 DrJ   c                |    ||S t        | |       t        |j                  d            dkD  rt        |  d      |S )zValidate the appname option.zutf-8   z must be <= 128 bytes)ro   r   encoder]   r^   s     rH   validate_appname_or_noner   0  sD    }FE"
5<< !C'F8#89::LrJ   c                J    ||S t        |t              st        |  d      |S ) Validate the driver keyword arg.z" must be an instance of DriverInfo)r[   r   re   r^   s     rH   validate_driver_or_noner   ;  s.    }eZ(6("DEFFLrJ   c                J    ||S t        |t              st        |  d      |S )z$Validate the server_api keyword arg.z! must be an instance of ServerApi)r[   r#   re   r^   s     rH   validate_server_api_or_noner   D  s.    }eY'6("CDEELrJ   c                @    ||S t        |      st        |  d      |S )z%Validates that 'value' is a callable.z must be a callable)callabler]   r^   s     rH   validate_is_callable_or_noner   M  s+    }E?F8#6788LrJ   c                    t        d|        | rBt        | t              s1t        t	        |             }|j                  d      rt        d      yyy)z Validate a replacement document.replacement$z'replacement can not include $ operatorsN)r   r[   r   nextiterrC   r]   )r   firsts     rH   validate_ok_for_replacer   V  sN    {3:k?CT+&'C FGG ! D{rJ   c                    t        d|        | st        d      t        | t               }t	        t        |             }|r|j                  d      st        d      yy)zValidate an update document.updatezupdate cannot be emptyr   z"update only works with $ operatorsN)r   r]   r[   r   r   r   rC   )r   is_documentr   s      rH   validate_ok_for_updater   `  s[    Xv.122 ..KfE5++C0=>> 1{rJ   )strictreplaceignorec                P    |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_HANDLERSr]   r   r   s     rH   %validate_unicode_decode_error_handlerr   p  s:    22g 3457
 	

 LrJ   c                Z    |(t        |t        j                        st        d|z        |S )zValidate the tzinfo optionz)%s must be an instance of datetime.tzinfo)r[   datetimetzinfore   r   s     rH   validate_tzinfor   {  s+    E8??!CCeKLLLrJ   c                N    ||S ddl m} t        ||      st        |  d      |S )r   r   )AutoEncryptionOptsz* must be an instance of AutoEncryptionOpts)pymongo.encryption_optionsr   r[   re   )r_   r`   r   s      rH   %validate_auto_encryption_opts_or_noner     s2    }=e/06("LMNNLrJ   c                    |t         j                  S t        |t              r-|j	                         rt        t        |            S t         |   S t        |t
              rt        |      S t        |  d      )z%Validate a DatetimeConversion string.z5 must be a str or int representing DatetimeConversion)r   DATETIMEr[   r\   isdigitr*   re   r^   s     rH   validate_datetime_conversionr     sh    }!***%==?%c%j11!%((	E3	!%((
vhST
UUrJ   c                0    |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")r]   r^   s     rH   validate_server_monitoring_moder    s0    ..hay WX
 	
 LrJ   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  r7  z	list[str]TIMEOUT_OPTIONSc                T    t        | |      \  }}|t        vrt        d|        | |fS )z,Validate optional authentication parameters.zUnknown authentication option: )validate_AUTH_OPTIONSr   )r_   r`   rL   s      rH   validate_auth_optionrK  )  s7    FE*LE5M! #B6(!KLL5=rJ   c                p    | j                         }t        j                  |t              } || |      }| |fS )zGeneric validation function.)rL   rF  getrQ   )r_   r`   rL   	validators       rH   rI  rI  1  s4    LLNEu&89Ife$E5=rJ   c                    t         t              rt               }dd}d fd}n
i }dd}dd} j                         D ]<  \  }} ||      }	 t        j	                  |t
              } |||      }|| ||      <   > |S # t        t        t        f$ r.}	|r!t        j                  t        |	      d       n Y d}	~	~d}	~	ww xY w)	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.
    c                    | S N xs    rH   get_normed_keyz-get_validated_options.<locals>.get_normed_keyI      HrJ   c                &    j                  |       S rQ  )	cased_key)rT  optionss    rH   get_setter_keyz-get_validated_options.<locals>.get_setter_keyL  s    $$Q''rJ   c                "    | j                         S rQ  )rL   rS  s    rH   rU  z-get_validated_options.<locals>.get_normed_keyR  s    779rJ   c                    | S rQ  rR  rS  s    rH   rZ  z-get_validated_options.<locals>.get_setter_keyU  rV  rJ   r)   )
stacklevelN)rT  r\   returnr\   )r[   _CaseInsensitiveDictionaryr   r,  rM  rQ   r]   re   r   warningswarnr\   )
rY  ra  validated_optionsrU  rZ  r   r`   
normed_keyrN  excs
   `         rH   get_validated_optionsre  9  s     '5668		( 		 mmo
U#C(
		B155jBTUIc5)E =BnZ89 &  I'9: 	c#h15 6	s   #BC$B??Cc                .    | j                  dd| d      S )NescCollectionenxcol_.z.escrM  encrypted_fieldsr   s     rH   _esc_coll_namerl  g  s    8D61FGGrJ   c                .    | j                  dd| d      S )NecocCollectionrh  z.ecocri  rj  s     rH   _ecoc_coll_namero  k  s     0HTF%2HIIrJ   )r%  wtimeoutr&  r0  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y	)
BaseObjectzA base class that provides attributes and methods common
    to multiple pymongo classes.

    SHOULD NOT BE USED BY DEVELOPERS EXTERNAL TO MONGODB.
    c                   t        |t              st        d      || _        t        |t              st        |d      || _        t        |t              st        d      || _        t        |t              st        d      || _	        y )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   re   _BaseObject__codec_optionsr"   _BaseObject__read_preferencer%   _BaseObject__write_concernr    _BaseObject__read_concern)selfcodec_optionsr<  write_concernread_concerns        rH   __init__zBaseObject.__init__z  s     -6bcc,/;7"% &  
 "1-6Y   -,4bcc*rJ   c                    | j                   S )zdRead only access to the :class:`~bson.codec_options.CodecOptions`
        of this instance.
        )ru  ry  s    rH   rz  zBaseObject.codec_options  s    
 ###rJ   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.
        )rw  r  s    rH   r{  zBaseObject.write_concern  s     ###rJ   c                B    |r|j                   rt        S | j                  S )zBRead only access to the write concern of this instance or session.)in_transactionr$   r{  ry  sessions     rH   _write_concern_forzBaseObject._write_concern_for  s!     w--((!!!rJ   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.
        )rv  r  s    rH   r<  zBaseObject.read_preference  s     %%%rJ   c                Z    |r|j                         xs | j                  S | j                  S )zDRead only access to the read preference of this instance or session.)_txn_read_preferencerv  r  s     rH   _read_preference_forzBaseObject._read_preference_for  s-     //1KT5K5KK%%%rJ   c                    | j                   S )zRead only access to the :class:`~pymongo.read_concern.ReadConcern`
        of this instance.

        .. versionadded:: 3.2
        )rx  r  s    rH   r|  zBaseObject.read_concern  s     """rJ   N)
rz  r   r<  r"   r{  r%   r|  r    r^  None)r^  r   )r^  r%   )r  Optional[ClientSession]r^  r%   )r^  r"   )r  r  r^  r"   )r^  r    )__name__
__module____qualname____doc__r}  propertyrz  r{  r  r<  r  r|  rR  rJ   rH   rs  rs  s  s    +#+ %+ $	+
 "+ 
+: $ $ $ $" & && # #rJ   rs  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d dZd!dZedd"d       Zed#d       Zdd$dZd%dZddZy
)&r_  c                T    i | _         i | _        | j                  t        |i |       y rQ  )%_CaseInsensitiveDictionary__casedkeys _CaseInsensitiveDictionary__datar   r   )ry  argskwargss      rH   r}  z#_CaseInsensitiveDictionary.__init__  s'    +-&(D$)&)*rJ   c                :    |j                         | j                  v S rQ  )rL   r  ry  rO   s     rH   __contains__z'_CaseInsensitiveDictionary.__contains__  s    yy{dkk))rJ   c                ,    t        | j                        S rQ  )r   r  r  s    rH   __len__z"_CaseInsensitiveDictionary.__len__  s    4;;rJ   c                (    d | j                   D        S )Nc              3      K   | ]  }|  y wrQ  rR  ).0rO   s     rH   	<genexpr>z6_CaseInsensitiveDictionary.__iter__.<locals>.<genexpr>  s     0//s   )r  r  s    rH   __iter__z#_CaseInsensitiveDictionary.__iter__  s    0t//00rJ   c                t    t        | D ci c]  }| j                  |   | j                  |   ! c}      S c c}w rQ  )r\   r  r  )ry  ks     rH   __repr__z#_CaseInsensitiveDictionary.__repr__  s7    FAD$$Q'Q7FGGFs   $5c                `    |j                         }|| j                  |<   || j                  |<   y rQ  rL   r  r  )ry  rO   r`   lc_keys       rH   __setitem__z&_CaseInsensitiveDictionary.__setitem__  s+    #& #FrJ   c                <    | j                   |j                            S rQ  )r  rL   r  s     rH   __getitem__z&_CaseInsensitiveDictionary.__getitem__  s    {{399;''rJ   c                X    |j                         }| j                  |= | j                  |= y rQ  r  )ry  rO   r  s      rH   __delitem__z&_CaseInsensitiveDictionary.__delitem__  s'    V$KKrJ   c                    t        |t        j                        st        S t	        |       t	        |      k7  ry|D ]  }| |   ||   k7  s y y)NFT)r[   r   r
   NotImplementedr   ry  otherrO   s      rH   __eq__z!_CaseInsensitiveDictionary.__eq__  sK    %-!!t9E
"CCyE#J&  rJ   Nc                V    | j                   j                  |j                         |      S rQ  )r  rM  rL   ry  rO   defaults      rH   rM  z_CaseInsensitiveDictionary.get  s    {{syy{G44rJ   c                    |j                         }| j                  j                  |d         | j                  j                  |g|i |S rQ  )rL   r  popr  )ry  rO   r  r  r  s        rH   r  z_CaseInsensitiveDictionary.pop  sB    VT*t{{v7777rJ   c                z    | j                   j                         \  }}| j                  j                  |      }||fS rQ  )r  popitemr  r  )ry  r  rX  r`   s       rH   r  z"_CaseInsensitiveDictionary.popitem  s8     ,,446	'%rJ   c                l    | j                   j                          | j                  j                          y rQ  )r  clearr  r  s    rH   r  z _CaseInsensitiveDictionary.clear   s$     rJ   c                     y rQ  rR  r  s      rH   
setdefaultz%_CaseInsensitiveDictionary.setdefault      rJ   c                     y rQ  rR  r  s      rH   r  z%_CaseInsensitiveDictionary.setdefault  r  rJ   c                    |j                         }|| v r| j                  |   S || j                  |<   || j                  |<   |S rQ  )rL   r  r  )ry  rO   r  r  s       rH   r  z%_CaseInsensitiveDictionary.setdefault  sF    $;;;v&&'*DV$")DKKNrJ   c                    t        |t              r|D ]  }||   | |j                  |      <    y |D ]
  }||   | |<    y rQ  )r[   r_  rX  r  s      rH   r   z!_CaseInsensitiveDictionary.update  sG    e78-23ZU__S)*  !#JS	 rJ   c                <    | j                   |j                            S rQ  )r  rL   r  s     rH   rX  z$_CaseInsensitiveDictionary.cased_key  s    		,,rJ   )r  r   r  r   )rO   r\   r^  r   )r^  r*   )r^  zIterator[str])r^  r\   )rO   r\   r`   r   r^  r  )rO   r\   r^  r   )rO   r\   r^  r  )r  r   r^  r   rQ  )rO   r\   r  Optional[Any]r^  r   )rO   r\   r  r   r  r   r^  r   )r^  tuple[str, Any])r^  r  )rO   r\   r  r  r^  r  )rO   r\   r  r   r^  r   )rO   r\   r  r  r^  r  )r  Mapping[str, Any]r^  r  )r  r  r  r}  r  r  r  r  r  r  r  r  rM  r  r  r  r   r  r   rX  rR  rJ   rH   r_  r_    s{    +
* 1H$
( 
	58
 
    '-rJ   r_  )rD   r\   r^  ztuple[str, int])rO   r\   rP   r   r^  r   )r_   r\   r`   r   r^  r   )r_   r\   r`   r   r^  r*   )r_   r\   r`   r   r^  zOptional[str])r_   r\   r`   r   r^  r3   )r_   r\   r`   r   r^  r\   )r_   r\   r`   r   r^  Union[int, str])r_   r   r`   r   r^  r  )r_   r\   r`   r   r^  r   )r_   r\   r`   r   r^  Optional[float])r_   r   r`   r   r^  r  )rP   r   r`   r   r^  r"   )rP   r   r`   r   r^  r*   )r   r\   r`   r   r^  zlist[dict[str, str]])r_   r\   r`   r   r^  zdict[str, Union[bool, str]])r_   r\   r`   r   r^  z2Union[Type[MutableMapping], Type[RawBSONDocument]])r_   r   r`   r   r^  zOptional[TypeRegistry])r_   r\   r`   r   r^  r   )r_   r   r`   r   r^  zOptional[list])r_   r   r`   r   r^  r  )r_   r\   r`   r   r^  r  )r_   r   r`   r   r^  zOptional[DriverInfo])r_   r   r`   r   r^  zOptional[ServerApi])r_   r   r`   r   r^  zOptional[Callable])r   r  r^  r  )r   r   r^  r  )rP   r   r`   r\   r^  r\   )rP   r   r`   r   r^  zOptional[datetime.tzinfo])r_   r   r`   r   r^  r  )r_   r   r`   r   r^  zOptional[DatetimeConversion])r_   r\   r`   r\   r^  r\   )r_   r\   r`   r   r^  r  )T)rY  r  ra  r   r^  zMutableMapping[str, Any])rk  r  r   r\   r^  r   )r  
__future__r   r   r   r`  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_MODErI   rM   rQ   UNSPECIFIEDSTANDARDPYTHON_LEGACYJAVA_LEGACYCSHARP_LEGACYr   ra   rf   rk   rm   rr   ru   rw   ro   rz   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,  r9  rC  rD  rE  r   r   optnamealiasesaliascopyrF  rG  rJ  rK  rI  re  rl  ro  WRITE_CONCERN_OPTIONSrs  r\   r_  rR  rJ   rH   <module>r     sm    @ "    (    &  * M M ) # + - 8 , ? ( W W4!$k 2~ 2 M) # )     %                    #' - & $( = ' %) M (     */  . %7 M 6       	6 &11"++&44$00&44 +	J48R*	V
c&2;
;;C4		*  8v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 .2++&*++\HJ
 ""Z[ S# S#lU-S!9 U-rJ   