+\hG2dZddlmZddlmZmZmZmZmZm Z ddl m Z ddl m Z ddlmZddlmZddlmZmZdd lmZdd lmZdd lmZmZmZdd lmZdd lm Z ddl!m"Z"m#Z#erddl m$Z$ddl%m&Z&ddl'm(Z(ddl)m*Z*ddl+m,Z, ddZ-ddZ.ddZ/d dZ0 d!dZ1 d"dZ2GddZ3y)#zTools to parse mongo client options. .. seealso:: This module is compatible with both the synchronous and asynchronous PyMongo APIs. ) annotations) TYPE_CHECKINGAnyMappingOptionalSequencecast)_parse_codec_options)common)CompressionSettings)ConfigurationError)_EventListener_EventListeners) PoolOptions) ReadConcern) _ServerModemake_read_preferenceread_pref_mode_from_name)any_server_selector)get_ssl_context) WriteConcernvalidate_boolean) CodecOptions)MongoCredential)AutoEncryptionOpts) SSLContext)_ServerSelectorc|jd|rdnd}|jd}|s|rddlm}|||||||Sy)z!Parse authentication credentials. authmechanismDEFAULTN authsourcer)_build_credentials_tuple)getpymongo.auth_sharedr")usernamepassworddatabaseoptions mechanismsourcer"s Y/root/niggaflix-v3/playground/venv/lib/python3.12/site-packages/pymongo/client_options.py_parse_credentialsr,/sG O(YMI [[ &F9@' 68XwX`aa cd|vr|dS|jdd}t|}|jd}|jdd}t|||S)zParse read preference options.read_preferencereadpreferenceprimaryreadpreferencetagsmaxstalenessseconds)r#rr)r(namemodetags max_stalenesss r+_parse_read_preferencer9<s`G#()) ;;' 3D #D )D ;;+ ,DKK 5r:M dM ::r-c|jd}|jd}|jd}|jd}t||||S)zParse write concern options.w wtimeoutmsjournalfsync)r#r)r(concernwtimeoutjr>s r+_parse_write_concernrBHsKkk#G{{<(H IA KK E 1e 44r-c:|jd}t|S)zParse read concern options.readconcernlevel)r#r)r(r?s r+_parse_read_concernrEQskk,-G w r-c H|jd}| td||jd}|jd}|jd}|jd}|jdd}|jd d}|jd d} g} d D]} | |vs|| s| j|  d D]} | |vs|| r| j|  | r$|d }n|stddj | z|rt ||||||| |} | |fSd|fS)zParse ssl options.tlsNtlscertificatekeyfiletlscertificatekeyfilepassword tlscafile tlscrlfiletlsallowinvalidcertificatesFtlsallowinvalidhostnamestlsdisableocspendpointcheck)rHrIrJrK)rLrMrNTzmTLS has not been enabled but the following tls parameters have been set: %s. Please set `tls=True` or remove.z, )r#rappendr joinr) r(is_syncuse_tlscertfile passphraseca_certscrlfileallow_invalid_certificatesallow_invalid_hostnamesdisable_ocsp_endpoint_checkenabled_tls_optsoptctxs r+_parse_ssl_optionsr]Wslkk% G({{23H<=J{{;'Hkk,'G!(-JE!R%kk*DeL")++.KU"S) '>gcl  # #C ()) '>'#,  # #C () ?G$79=CS9TU       & # '   +++ ( ((r-ct||||}|jdtj}|jdtj}|jdtj }|||kDr t d|jdtj} |jd} |jdtj} tttt|jd} |jd } |jd }|jd }t|jd g|jd d}t||\}}|jd}|jdtj}t!|||| | | ||t#| | |||||||S)zParse connection pool options. maxpoolsize minpoolsize maxidletimemsz3minPoolSize must be smaller or equal to maxPoolSizeconnecttimeoutmssockettimeoutmswaitqueuetimeoutmsevent_listenersappnamedriver server_api compressorszlibcompressionlevelr4 loadbalanced maxconnecting)max_connectingrh load_balanced credentialsrQ)r,r#r MAX_POOL_SIZE MIN_POOL_SIZEMAX_IDLE_TIME_SEC ValueErrorCONNECT_TIMEOUTWAIT_QUEUE_TIMEOUTr rrrr r]MAX_CONNECTINGrr)r%r&r'r(rQro max_pool_size min_pool_sizemax_idle_time_secondsconnect_timeoutsocket_timeoutwait_queue_timeoutrerfrgrhcompression_settings ssl_contexttls_allow_invalid_hostnamesrnrms r+_parse_pool_optionsrs%Xx7KKKK v/C/CDMKK v/C/CDM#KK9Q9QR ]]%BNOOkk"4f6L6LMO[[!23N %96;T;TU8H^$<=w{{K\?]^Okk)$G [[ "F\*J. M2& 4JB(O0B'7/S,K,KK/M[[&2G2GHN #(%## r-ceZdZdZ d ddZeddZeddZeddZeddZ eddZ eddZ edd Z edd Z edd Zed d Zed!d Zed"dZed#dZed$dZed%dZed%dZed&dZeddZed'dZed(dZy)) ClientOptionsa&Read only configuration options for an AsyncMongoClient/MongoClient. Should not be instantiated directly by application developers. Access a client's options via :attr:`pymongo.mongo_client.AsyncMongoClient.options` or :attr:`pymongo.mongo_client.MongoClient.options` instead. c||_t||_|jd|_|jdt j |_|jdt j|_ t||||||_ t||_ |jd|_t||_t#||_|jd|_|jdt j(|_|jdt j,|_|jdt j0|_|jd t4|_|jd |_|jd |_|jd |_|jd t j>|_ y)Ndirectconnectionlocalthresholdmsserverselectiontimeoutms replicasetconnectheartbeatfrequencyms retrywrites retryreadsserver_selectorauto_encryption_optsrk timeoutmsservermonitoringmode)!_ClientOptions__optionsr _ClientOptions__codec_optionsr#!_ClientOptions__direct_connectionr LOCAL_THRESHOLD_MS"_ClientOptions__local_threshold_msSERVER_SELECTION_TIMEOUT(_ClientOptions__server_selection_timeoutr_ClientOptions__pool_optionsr9_ClientOptions__read_preference _ClientOptions__replica_set_namerB_ClientOptions__write_concernrE_ClientOptions__read_concern_ClientOptions__connectHEARTBEAT_FREQUENCY#_ClientOptions__heartbeat_frequency RETRY_WRITES_ClientOptions__retry_writes RETRY_READS_ClientOptions__retry_readsr_ClientOptions__server_selector$_ClientOptions__auto_encryption_opts_ClientOptions__load_balanced_ClientOptions__timeoutSERVER_MONITORING_MODE&_ClientOptions__server_monitoring_mode)selfr%r&r'r(rQs r+__init__zClientOptions.__init__ss!3G<#*;;/A#B $+KK0BFD]D]$^!+2++ &(G(G+ '2(HhPWY`a!7!@")++l";3G<1': Y/%,[[1GIcIc%d"%kk-9L9LM$[[v7I7IJ!(->@S!T&-kk2H&I#&{{>: [1(/ "F$A$A) %r-c|jS)z7The original options used to create this ClientOptions.)rrs r+_optionszClientOptions._options~~r-c|jS)z>Whether to begin discovering a MongoDB topology automatically.)rrs r+rzClientOptions.connectrr-c|jS)z5A :class:`~bson.codec_options.CodecOptions` instance.)rrs r+ codec_optionszClientOptions.codec_options###r-c|jS)z:Whether to connect to the deployment in 'Single' topology.)rrs r+direct_connectionzClientOptions.direct_connections'''r-c|jS)z&The local threshold for this instance.)rrs r+local_threshold_msz ClientOptions.local_threshold_mss(((r-c|jS)z:The server selection timeout for this instance in seconds.)rrs r+server_selection_timeoutz&ClientOptions.server_selection_timeouts...r-c|jS)N)rrs r+rzClientOptions.server_selector s%%%r-c|jS)z$The monitoring frequency in seconds.)rrs r+heartbeat_frequencyz!ClientOptions.heartbeat_frequencys)))r-c|jS)z.A :class:`~pymongo.pool.PoolOptions` instance.)rrs r+ pool_optionszClientOptions.pool_options"""r-c|jS)zA read preference instance.)rrs r+r/zClientOptions.read_preferences%%%r-c|jS)zReplica set name or None.)rrs r+replica_set_namezClientOptions.replica_set_name s&&&r-c|jS)z8A :class:`~pymongo.write_concern.WriteConcern` instance.)rrs r+ write_concernzClientOptions.write_concern%rr-c|jS)z6A :class:`~pymongo.read_concern.ReadConcern` instance.)rrs r+ read_concernzClientOptions.read_concern*rr-c|jS)z_The configured timeoutMS converted to seconds, or None. .. versionadded:: 4.2 )rrs r+timeoutzClientOptions.timeout/s ~~r-c|jS)z9If this instance should retry supported write operations.)rrs r+ retry_writeszClientOptions.retry_writes7rr-c|jS)z8If this instance should retry supported read operations.)rrs r+ retry_readszClientOptions.retry_reads<s!!!r-c|jS)z:A :class:`~pymongo.encryption.AutoEncryptionOpts` or None.)rrs r+rz"ClientOptions.auto_encryption_optsAs***r-c|jS)z@True if the client was configured to connect to a load balancer.)rrs r+rnzClientOptions.load_balancedFrr-cz|jjJ|jjjS)zThe event listeners registered for this client. See :mod:`~pymongo.monitoring` for details. .. versionadded:: 4.0 )r_event_listenersrers r+rezClientOptions.event_listenersKs7""33???""33CCEEr-c|jS)zSThe configured serverMonitoringMode option. .. versionadded:: 4.5 )rrs r+server_monitoring_modez$ClientOptions.server_monitoring_modeVs ,,,r-N)T) r%strr&rr' Optional[str]r(Mapping[str, Any]rQbool)returnr)rzOptional[bool])rr)rint)rr)rr)rr)rr)rr)rr)rzOptional[float])rr)rzOptional[AutoEncryptionOpts])rzlist[_EventListeners])rr)__name__ __module__ __qualname____doc__rpropertyrrrrrrrrrr/rrrrrrrrnrerr-r+rrs        #    D$$(())//&&**##&&''$$####""++$$FF--r-rN) r%rr&rr'rr(rrzOptional[MongoCredential])r(rrr)r(rrr)r(rrr)r(rrQrrz!tuple[Optional[SSLContext], bool]) r%rr&rr'rr(rrQrrr)4r __future__rtypingrrrrrr bson.codec_optionsr pymongor pymongo.compression_supportr pymongo.errorsr pymongo.monitoringrrpymongo.pool_optionsrpymongo.read_concernrpymongo.read_preferencesrrrpymongo.server_selectorsrpymongo.ssl_supportrpymongo.write_concernrrrr$rpymongo.encryption_optionsrpymongo.pyopenssl_contextrpymongo.topology_descriptionrr,r9rBrEr]rrrr-r+rs#HH3;->,, 9/@/3=4<    ,9 DU   ;5 ;) ;))-;)&;)|---- -  -  -`W-W-r-