fD  UddlmZddlZddlZddlZddlZddlZddlZddlZddl Z ddl Z ddl Z ddl Z ddl Z ddlmZddlmZmZmZmZmZmZmZmZmZddlZddlmZddlmZmZmZddl m!Z!ddl"m#Z#m$Z$m%Z%m&Z&m'Z'm(Z(m)Z)m*Z*m+Z+m,Z,dd l-m.Z.m/Z/m0Z0m1Z1m2Z2m3Z3m4Z4m5Z5m6Z6m7Z7m8Z8m9Z9dd l:m;Z;mZ>dd l?m@Z@dd lAmBZBmCZCmDZDmEZEddlFmGZGmHZHmIZIddlJmKZKmLZLddlMmNZNddlOmPZPddlQmRZRddlSmTZTddlUmVZVmWZWerfddlmXZXddlYmZZZddl[m\Z\m]Z]ddl m^Z^ddl_m`Z`maZambZbmcZcddldmeZeddlfmgZgmhZhddlimjZjmkZkddllmmZmmnZnddlompZpddlMmqZqdd lOmrZrdd!lsmtZtmuZumvZvdd"lwmxZx dd#lymzZzm{Z{m|Z|myZydnd$Z}d&Zd'Zd(Ze jd)k(rI ddlZd*Z ej ej d+5Zeed,d-Zeed.d/Zdddd0Zndod1Zdpd2Zd3d4ed5iZd6ed7<e jjd8r>ej Zeeej$ej&d9ed:<ne jd;k(rOej ej ej$ej(dd9ed:<nXe jd)k(rse j*Zdj3eeedd?d@edAxsdBzd9ed:<ne jjdCr$ej8dA\ZZZeeeed9ed:<nej<ej ej&ej>Zej dDj3eddEDcgc]}|s| c}ej$edEd9ed:<ejBjdFrpdDj3ejBd>j3eee jDdGd>j3eee jFzfedH<ne jjdCrdDj3ejBd>j3eee jFdIdDj3ej ej&fzfedH<nIdDj3ejBd>j3eee jFfedH<dJZdKZdLZdMZdqdNZdrdOZdrdPZdrdQZdrdRZdrdSZdsdTZdtdUZdVZdudWZdXjedY dv dwdZZdxd[Zdyd]Zdzd^ZGd_d\ZGd`daZGdbdcZd{ddZd|deZGdfdge7ZGdhdiZGdjdkZGdldmZy#e~$rdnd%Z}YwxYw#e~$rddlZYwxYw#1swYuxYw#e$rd-Zd/ZYwxYwcc}w)}) annotationsN)Path) TYPE_CHECKINGAnyIteratorMappingMutableMappingNoReturnOptionalSequenceUnion)DEFAULT_CODEC_OPTIONS) __version___csothelpers)_validate_session_write_concern) MAX_BSON_SIZEMAX_CONNECTINGMAX_IDLE_TIME_SECMAX_MESSAGE_SIZE MAX_POOL_SIZEMAX_WIRE_VERSIONMAX_WRITE_BATCH_SIZE MIN_POOL_SIZE ORDERED_TYPESWAIT_QUEUE_TIMEOUT) AutoReconnectConfigurationErrorConnectionFailureDocumentTooLargeExecutionTimeoutInvalidOperationNetworkTimeoutNotPrimaryErrorOperationFailure PyMongoErrorWaitQueueTimeoutError_CertificateError)Hello HelloCompat)_handle_reauth) _create_lock)_CONNECTION_LOGGER_ConnectionStatusMessage _debug_log _verbose_connection_error_reason)ConnectionCheckOutFailedReasonConnectionClosedReason_EventListeners)commandreceive_message)ReadPreference)_add_to_command) SERVER_TYPE) SocketChecker)HAS_SNISSLError) CodecOptions)ObjectId)MongoCredential _AuthContext) ClientSession)CompressionSettings SnappyContext ZlibContext ZstdContext) DriverInfo)_OpMsg_OpReply) MongoClient_MongoClientErrorHandler) SSLContext_sslConn) ReadConcern) _ServerMode) ServerApi) ClusterTime_Address _CollationIn) WriteConcern)F_GETFDF_SETFD FD_CLOEXECfcntlcTt|t}t|t|tzy)z8Set the close-on-exec flag on the given file descriptor.N)rVrSrTrU)fdflagss U/var/lib/jenkins/workspace/mettalog/venv/lib/python3.12/site-packages/pymongo/pool.py_set_non_inheritable_non_atomicr[usb'" b'5:-.cy)z6Dummy function for platforms that don't provide fcntl.N)rXs rZr[r[~sr\x win32cz tj||\}}t|S#ttf$r|cYSwxYwN)winreg QueryValueExintOSError ValueError)keynamedefaultvalue_s rZ_queryrosB **35HE1u: $ N s #&::z2SYSTEM\CurrentControlSet\Services\Tcpip\Parameters KeepAliveTimeimKeepAliveIntervalctttdz}tttdz}|tks |tkr$|j t jd||fyy)Nrr)min_WINDOWS_TCP_IDLE_MS_MAX_TCP_KEEPIDLE_WINDOWS_TCP_INTERVAL_MS_MAX_TCP_KEEPINTVLioctlsocketSIO_KEEPALIVE_VALS)sockidle_ms interval_mss rZ_set_keepalive_timesrsZ*,=,DE24F4MN ) )[;S-S JJv001g{2K L.Tr\ctt|rYtt|} |jtj|}||kDr"|j tj||yyy#t $rYywxYwrd)hasattrr{getattr getsockopt IPPROTO_TCP setsockoptrh)r} tcp_option max_valuesockoptrls rZ_set_tcp_optionrsq 6: &fj1G //&*<*r\driverPyMongo)rkversiondict[str, Any] _METADATAlinux)typerk architecturerosdarwinWindowsPROCESSOR_ARCHITECTURE.z-SP0java PyPyz (Python %s)platformz(%s)z /.dockerenvKUBERNETES_SERVICE_HOSTdocker kubernetesci}ttjr t|d<t j t r t|d<|S)zReturns the runtime and orchestrator of a container. If neither value is present, the metadata client.env.container field will be omitted.runtime orchestrator)rDOCKER_ENV_PATHexistsRUNTIME_NAME_DOCKERrgetenv ENV_VAR_K8SORCHESTRATOR_NAME_K8S) containers rZget_container_env_infors@I O##%2 ) yy$9 .! r\ctjdrytjd}|r|jdSy)NAWS_LAMBDA_RUNTIME_APITAWS_EXECUTION_ENV AWS_Lambda_F)rr startswith)envs rZ _is_lambdars6 yy)* ))' (C ~~m,, r\c>ttjdS)NFUNCTIONS_WORKER_RUNTIMEboolrrr^r\rZ_is_azure_funcr&s  45 66r\clttjdxstjdS)N K_SERVICE FUNCTION_NAMErr^r\rZ _is_gcp_funcr*s$  +&D"))O*D EEr\c>ttjdS)NVERCELrr^r\rZ _is_vercelr.s  (# $$r\c^txs"txstxs tSrd)rrrrr^r\rZ_is_faasr2s < M>+ M|~ MMr\chtj|}|sy t|S#t$rYywxYw)zMLike os.getenv but returns an int, or None if the value is missing/malformed.N)rrrgri)rjvals rZ _getenv_intr6s5 ))C.C 3x s % 11c8i}t}|r||d<tttt fj ddk7r|Str5d|d<t jd}|r||d<td}|||d <|Strd |d<|StrGd |d<t jd }|r||d<td }|||d <td}|||d<|St r!d|d<t jd}|r||d<|S)NrTrtz aws.lambdark AWS_REGIONregionAWS_LAMBDA_FUNCTION_MEMORY_SIZE memory_mbz azure.funczgcp.funcFUNCTION_REGIONFUNCTION_MEMORY_MBFUNCTION_TIMEOUT_SEC timeout_secvercel VERCEL_REGION) rrrrrcountrrr)rrrrrs rZ _metadata_envrAs@C&(I$K n&  EKKDQUVV |"F <( "CM AB  (C & J%  "F " J!  F ,- "CM 45  (C !"89  "!,C  J F ?+ "CM Jr\ic~ttj|tkry|j dij d}|rd|i|d<ttj|tkry|j dij d}|rd|i|d<ttj|tkry|j ddttj|}|tkry|tz }|j dd}|r|d| }|r||d<y|j ddy)zPerform metadata truncation.Nrrkrrr)lenbsonencode_MAX_METADATA_SIZEgetpop)metadataenv_nameos_type encoded_sizeoverflowplats rZ_truncate_metadatarjs 4;;x !%77||E2&**62H!8, 4;;x !%77ll4$((0G '* 4;;x !%77 LLt{{8,-L))00H << B 'D JhY # Z&r\fooidnac|\}}| d|||fz}n|d|}|r||z}d|vr|t|z }t|tjr t ||t|t rdt |vr t ||t||)z9Convert a socket.error to ConnectionFailure and raise it.z %s:%d: %s: zconfigured timeouts timed out)format_timeout_details isinstancer{timeoutr#r;strr)addresserror msg_prefixtimeout_detailshostportmsgs rZ_raise_connection_failurersJD$ T4//b 3C' %o66%(S!u, E8 $E )B S!u,C e+r\cZ|r|tjz nd}|j|Srd)time monotonicwait) conditiondeadliners rZ _cond_waitrs&-5h))4G >>' ""r\ PoolOptionsci}tj}|j}|j}|r|dz|d<|r |s|dz|d<|r|dz|d<|S)Nrr timeoutMSsocketTimeoutMSconnectTimeoutMS)r get_timeoutsocket_timeoutconnect_timeout)optionsdetailsrrrs rZ_get_timeout_detailsr siG!G++N--O&~ g%3d%:!"&5&<"# Nr\cbd}|r*|dz }dD]}||vs|d|d||dz }|dd}|dz }|S) Nrz (configured timeouts:)rrrrrzms,r)r^)rresultrs rZrrsb F**KG'!AgYb)9(:#>>L#  Mr\ceZdZdZdZeeeddedddddde ddddf ddZ e ddZ e ddZ e dd Ze dd Ze dd Ze dd Ze d d Ze d!dZe d!dZe d dZe d"dZe ddZe d#dZe d$dZe d%dZe d&dZe ddZe d'dZe d(dZy))raYRead only connection pool options for a MongoClient. Should not be instantiated directly by application developers. Access a client's pool options via :attr:`~pymongo.client_options.ClientOptions.pool_options` instead:: pool_opts = client.options.pool_options pool_opts.max_pool_size pool_opts.min_pool_size )__max_pool_size__min_pool_size__max_idle_time_seconds__connect_timeout__socket_timeout__wait_queue_timeout __ssl_context__tls_allow_invalid_hostnames__event_listeners __appname__driver __metadata__compression_settings__max_connecting__pause_enabled __server_api__load_balanced __credentialsNFTc8||_||_||_||_||_||_||_||_| |_| |_ | |_ | |_ | |_ ||_ ||_||_||_t#j$t&|_| rd| i|j(d<| r| j*r6dj-t&dd| j*|j(dd<| j.r6dj-t&dd| j.|j(dd<| j0r0dj-t&d| j0|j(d<t3}|r||j(d<t5|j(y)Nrk applicationz{}|{}rrrr)_PoolOptions__max_pool_size_PoolOptions__min_pool_size#_PoolOptions__max_idle_time_seconds_PoolOptions__connect_timeout_PoolOptions__socket_timeout _PoolOptions__wait_queue_timeout_PoolOptions__ssl_context)_PoolOptions__tls_allow_invalid_hostnames_PoolOptions__event_listeners_PoolOptions__appname_PoolOptions__driver"_PoolOptions__compression_settings_PoolOptions__max_connecting_PoolOptions__pause_enabled_PoolOptions__server_api_PoolOptions__load_balanced_PoolOptions__credentialscopydeepcopyr_PoolOptions__metadatarkformatrrrr)self max_pool_size min_pool_sizemax_idle_time_secondsrrwait_queue_timeout ssl_contexttls_allow_invalid_hostnamesevent_listenersappnamercompression_settingsmax_connecting pause_enabled server_api load_balanced credentialsrs rZ__init__zPoolOptions.__init__sw( -,'<$!0 .$6!(-H*!0  &:# .,&,(-- 2 .4g->DOOM * {{4;NNh'/KK5)&1~~7>~~h' 2NN8))4.5nnYz=RTZTcTc.d +o %(DOOE "4??+r\c|jS)z;A :class:`~pymongo.auth.MongoCredentials` instance or None.)r2r7s rZ _credentialszPoolOptions._credentials4!!!r\ci}|jtk7r|j|d<|jtk7r|j|d<|jt k7r |jJ|jdz|d<|j tk7r |j J|j dz|d<|jtk7r|j|d<|S)zqThe non-default options this pool was created with. Added for CMAP's :class:`PoolCreatedEvent`. maxPoolSize minPoolSizerr maxIdleTimeMSwaitQueueTimeoutMS maxConnecting) r"rr#rr$rr'rr.r)r7optss rZnon_default_optionszPoolOptions.non_default_options9s    = 0"&"6"6D    = 0"&"6"6D   ' '+< <//; ;;$($@$@4$GD !  $ $(: :,,8 88)-)B)BT)ID% &  N 2$($9$9D ! r\c|jS)aQThe maximum allowable number of concurrent connections to each connected server. Requests to a server will block if there are `maxPoolSize` outstanding connections to the requested server. Defaults to 100. Cannot be 0. When a server's pool has reached `max_pool_size`, operations for that server block waiting for a socket to be returned to the pool. If ``waitQueueTimeoutMS`` is set, a blocked operation will raise :exc:`~pymongo.errors.ConnectionFailure` after a timeout. By default ``waitQueueTimeoutMS`` is not set. )r"rHs rZr8zPoolOptions.max_pool_sizeNs###r\c|jS)zThe minimum required number of concurrent connections that the pool will maintain to each connected server. Default is 0. )r#rHs rZr9zPoolOptions.min_pool_size]s ###r\c|jS)zgThe maximum number of concurrent connection creation attempts per pool. Defaults to 2. )r.rHs rZrAzPoolOptions.max_connectingds $$$r\c|jSrd)r/rHs rZrBzPoolOptions.pause_enabledks###r\c|jS)zThe maximum number of seconds that a connection can remain idle in the pool before being removed and replaced. Defaults to `None` (no limit). )r$rHs rZr:z!PoolOptions.max_idle_time_secondsos +++r\c|jS)z>How long a connection can take to be opened before timing out.)r%rHs rZrzPoolOptions.connect_timeoutw%%%r\c|jS)zBHow long a send or receive on a socket can take before timing out.)r&rHs rZrzPoolOptions.socket_timeout|s$$$r\c|jS)zhHow long a thread will wait for a socket from the pool if the pool has no free sockets. )r'rHs rZr;zPoolOptions.wait_queue_timeouts (((r\c|jS)zAn SSLContext instance or None.)r(rHs rZ _ssl_contextzPoolOptions._ssl_contextrJr\c|jS)z If True skip ssl.match_hostname.)r)rHs rZr=z'PoolOptions.tls_allow_invalid_hostnamess111r\c|jS)z2An instance of pymongo.monitoring._EventListeners.)r*rHs rZ_event_listenerszPoolOptions._event_listenersrYr\c|jS)zAThe application name, for sending with hello in server handshake.)r+rHs rZr?zPoolOptions.appnames~~r\c|jS)z=Driver name and version, for sending with hello in handshake.)r,rHs rZrzPoolOptions.drivers}}r\c|jSrd)r-rHs rZ_compression_settingsz!PoolOptions._compression_settingss***r\c6|jjS)zCA dict of metadata about the application, driver, os, and platform.)r5r3rHs rZrzPoolOptions.metadatas##%%r\c|jS)z'A pymongo.server_api.ServerApi or None.)r0rHs rZrCzPoolOptions.server_apis   r\c|jS)z6True if this Pool is configured in load balanced mode.)r1rHs rZrDzPoolOptions.load_balanceds###r\)"r8rgr9rgr: Optional[int]rOptional[float]rrir;rhr<Optional[SSLContext]r=rr>Optional[_EventListeners]r? Optional[str]rOptional[DriverInfo]r@Optional[CompressionSettings]rArgrBrrCOptional[ServerApi]rDOptional[bool]rEOptional[MongoCredential])returnrqrrrrrfloatrrrgrrr)rrrh)rrri)rrrj)rrrk)rrrl)rrrm)rrrn)rrro)rrrp)__name__ __module__ __qualname____doc__ __slots__rrrrrrFpropertyrIrRr8r9rArBr:rrr;r]r=r`r?rrdrrCrDr^r\rZrrs I.+*/@+/*.,>,0,159!%'+>B,"*.(,15%C,C,C, - C, ) C, ( C,*C,*C,&*C,3C,C,%C,<C,C,C, (!C,"&#C,$/%C,J""( $ $$$ %% $$,,&&%%)) ""22&&++&&!!$$r\c.eZdZddZddZeddZy)_CancellationContextcd|_yNF _cancelledrHs rZrFz_CancellationContext.__init__s r\cd|_y)zCancel this context.TNrrHs rZcancelz_CancellationContext.cancels r\c|jS)zWas cancel called?rrHs rZ cancelledz_CancellationContext.cancelledsr\NrrNonerw)rxryrzrFrr}rr^r\rZrrs  r\rceZdZdZ d$dZd%dZ d&dZd'dZd'dZd'dZ d(dZ d)d Z d*d Z d(d Z eej ed d d d dd d d dd d df d+dZd,dZd-dZd.dZd/dZ d0dZd1d2dZ d3dZd4dZd'dZd5dZ d6dZd7dZd'dZd8dZ d9dZ!d:dZ"d;d Z#d;d!Z$d ConnectionzStore a connection with some metadata. :param conn: a raw connection object :param pool: a Pool instance :param address: the server's (host, port) :param id: the id of this socket in it's pool ctj||_||_||_||_d|_tj|_ d|_ d|_ t|_ t|_t |_t$|_d|_d|_d|_d|_|j0j2|_|j6|_|j8|_|j0j:|_d|_tA|_!d|_"d|_#d|_$|jJ|_&|jLjO|_(d|_)tU|_+|j0|_d|_,d|_-d|_.d|_/d|_0d|_1|j0jd|_3d|_4|jj|_5tj|_6y)NFg)7weakrefrefpool_refconnridclosedrrlast_checkin_timeperformed_handshake is_writablermax_wire_versionr max_bson_sizermax_message_sizermax_write_batch_sizesupports_sessionshello_ok is_mongosop_msg_enabledrQr` listenersenabled_for_cmapenabled_for_loggingrdr@compression_contextr9socket_checkeroidc_token_gen_idnegotiated_mechsauth_ctxgenpool_gen get_overall generationreadyrcancel_context more_to_come service_idserver_connection_id pinned_txn pinned_cursoractiver last_timeout connect_rtt _client_id creation_time)r7rpoolrrs rZrFzConnection.__init__s D)    !%!1#( !& 0* 0$8!!&# #33 $ 5 5#'#;#; $(II$C$C!Y] -:_045904  --335 4H4JII "'.237! "  II44//!^^-r\ch||jk(ry||_|jj|y)z?Cache last timeout to avoid duplicate calls to conn.settimeout.N)rr settimeout)r7rs rZset_conn_timeoutzConnection.set_conn_timeouts- d'' ' # W%r\ctj}|2|js%|j|jj ytj }| |j}||z }|dkrIt|j}t|}d|dd|dd|}t|dd|dd|j|t|dz|d <|j||S) Nrz5operation would exceed time limit, remaining timeout:z.5fz <= network round trip time:r2okerrmsgcoderr maxTimeMS) r remainingrrrQrget_rttrr rr!rrg) r7clientcmdrrtt max_time_msr formattedrs rZ apply_timeoutzConnection.apply_timeouts//# ?$$%%dii&>&>?mmo ;""Cm ?2499=O.?ILWUXMYuvyz}u~~AJ@KLF"FB7%%   ?";#56C  g&r\c.d|_|jrJyNT)rrrHs rZpin_txnzConnection.pin_txn%s%%%%%r\c.d|_|jrJyr)rrrHs rZ pin_cursorzConnection.pin_cursor)s!??""?r\c|j}|r|j|y|jtjyrd)rcheckin close_connr2STALE)r7rs rZunpinzConnection.unpin-s/}}  LL  OO288 9r\c|jjs"|js|jjrd|_t j diSt jdddiS)NTrthelloOk)rQrCrrDrr*CMD LEGACY_CMDrHs rZ hello_cmdzConnection.hello_cmd4sO 99  4==DII4K4K"&D OOQ' '**Ay$? ?r\c(|jdddSrd)_hellorHs rZhellozConnection.hello=s{{4t,,r\c|j}|j }d}|rad|_|jj|d<|jr|jj |d<|jj rbd|d<n\|Z||d<|Jt|dz|d<d}|jjr(|j|jj|z|s|||d <|jj}|r|jd k(r+|jr|jd z|jz|d <d dlm}|j j#||j$} | r| j'} | | |d<nd} |rt)j*} |j-d|d|} |rt)j* z |_t1| |} | j2|_| j4|_| j6|_| j8|_| j:|_| j<duxr | j>|_ | j<|_| jB|_!| jDtFjHtFjJtFjLtFjNtFjPfv|_)| jDtFjTk(|_+| jDtFjXk(|_-|r8|jr,|jj]| j }||_/d|_0| jb|_2|r| jf|_4| r(| jk| | jmr| |_7|jj rR| jps tsd| jp|_8|jtjw|jp|_<| S)NFTr compression loadBalancedtopologyVersionrrmaxAwaitTimeMSz $clusterTimeDEFAULTrsaslSupportedMechsrauthspeculativeAuthenticateadmin)publish_eventsexhaust_allowed) awaitablez`Driver attempted to initialize in load balancing mode, but the server does not support this mode)=rrrQrr@ compressorsrDrgrrrI mechanismusernamesourcepymongorr?from_credentialsrspeculate_commandrrr4rr)rrrrrlogical_session_timeout_minutes is_readablerr server_typer8 RSPrimary RSSecondary RSArbiterRSOtherRSGhostis_repl Standalone is_standaloneMongosrget_compression_contextrr connection_idrsasl_supported_mechsrparse_responsespeculate_succeededrrrrrr)r7 cluster_timetopology_versionheartbeat_frequencyrperforming_handshakercredsrrspeculative_authenticatestartdocrctxs rZrzConnection._hello@s nn#'#;#;; '+D $ II..CM((%)%>%>%J%JM"yy&&&*N#  )%5C! "&2 22$'(;d(B$CC !Iyy((%%dii&?&?BU&UV# (@".C  && )+,1LL3,>,O() $((99%NH+3+E+E+G(+75MC12H NN$Ell7CylY #~~/%7D cY/ ,, % 6 6"00 % 6 6$)$>$>!  1 1 = S%BSBS ?D>c>c, ((  ! !  # #  ! !       -   #..+2H2HH**k.@.@@ D$=$=++CCEDUDUVC'*D $"$)$7$7! $)$>$>D !   # #E *++- ( 99 " "##(A$..DO"mm//@DO r\c|jd}|j|_|j}|d}tj||j |SNr)r5runpack_responser_check_command_responser)r7reply unpacked_docs response_docs rZ _next_replyzConnection._next_replysT$$T*!..--/ $Q' '' d6K6KLr\TNFc|j| | t| |} t|ts t |}||j s | t d|j|| r| j|| |||j|| | |r |jnd}t|xr |j }|jr|j| t||||j||| | |||j ||j"|| | |j$|j||||S#t&t(f$rt*$r}|j-|Yd}~yd}~wwxYw)aExecute a command or raise an error. :param dbname: name of the database on which to run the command :param spec: a command document as a dict, SON, or mapping object :param read_preference: a read preference :param codec_options: a CodecOptions instance :param check: raise OperationFailure if there are errors :param allowable_errors: errors to ignore if `check` is True :param read_concern: The read concern for this command. :param write_concern: The write concern for this command. :param parse_write_concern_error: Whether to parse the ``writeConcernError`` field in the command response. :param collation: The collation for this command. :param session: optional ClientSession instance. :param client: optional MongoClient for gossipping $clusterTime. :param retryable_write: True if this command is a retryable write. :param publish_events: Should we publish events for this command? :param user_fields: Response fields that should be decoded using the TypeDecoders from codec_options, passed to bson._decode_all_selective. Nz3Collation is unsupported for unacknowledged writes.)parse_write_concern_error collationcompression_ctx use_op_msgunacknowledged user_fieldsr write_concern)validate_sessionrrrdict acknowledgedradd_server_api _apply_tosend_cluster_timerrr_raise_if_not_writabler4rrrrr%r$ BaseExceptionr)r7dbnamespecread_preference codec_optionscheckallowable_errors read_concernrrrsessionrretryable_writerrrrrrs rZr4zConnection.commandsiR fg.1'=I$ .:D%)C)CyGX$%Z[ [ D!    dO_d K tWf5&4DNN$ mNM4N4N0NO     ' ' 7 2  ""*C# $ 8 8..-' /+- 0!/2   2  * *5 1 1 2sAD**EEEc|j)||jkDrtd||jfz |jj|y#t$r}|j |Yd}~yd}~wwxYw)z}Send a raw BSON message or raise ConnectionFailure. If a network exception is raised, the socket is closed. NzfBSON document too large (%d bytes) - the connected server supports BSON document sizes up to %d bytes.)rr rsendallr!r)r7message max_doc_sizers rZ send_messagezConnection.send_messages|    )lT=O=O.O"?BNPTPbPbAcd   2 II  g & 2  * *5 1 1 2sA A7A22A7c t|||jS#t$r}|j|Yd}~yd}~wwxYw)zzReceive a raw BSON message or raise ConnectionFailure. If any exception is raised, the socket is closed. N)r5rr!r)r7 request_idrs rZr5zConnection.receive_message s=  2"4T5J5JK K 2  * *5 1 1 2s =8=cB|r|jstdddddyy)z^Raise NotPrimaryError on unacknowledged write if this socket is not writable. z not primaryri{'rN)rr$)r7rs rZr z!Connection._raise_if_not_writables+ $"2"2!-]\a1bc c#3>r\cJ|jd|j||y)zSend unack OP_MSG. Can raise ConnectionFailure or InvalidDocument. :param msg: bytes, an OP_MSG message. :param max_doc_size: size in bytes of the largest document in `msg`. TN)r r/)r7rr.s rZ unack_writezConnection.unack_writes" ##D) #|,r\c|j|d|j|}|j|}tj||j |S)zSend "insert" etc. command, returning response as a dict. Can raise ConnectionFailure or OperationFailure. :param request_id: an int. :param msg: bytes, the command message. r)r/r5command_responserr r)r7r1rr%rr s rZ write_commandzConnection.write_command(sQ #q!$$Z0'' 6 ''0E0EF r\c |r|jrd|_d|_|js)|jj}|rddlm}|j|||d|_tj|jz }|jr?|jJ|jj|j|j||j rwt#j$t&j(rSt+t"|j,t.j0|jd|jd|j|yyyy) zhAuthenticate to the server if needed. Can raise ConnectionFailure or OperationFailure. NFrr)reauthenticateTrtclientIdr- serverHost serverPortdriverConnectionId durationMS)rrrrQrIrr authenticaterrrrrpublish_connection_readyrrrr- isEnabledForloggingDEBUGr/rr. CONN_READY)r7r9rrdurations rZr@zConnection.authenticate:s '' $ DJzzII**E(!!%n!MDJ~~'$*<*<,K,KGMM,Z&!__4??#||A#||A'+ww'-['r\c<|r|j|ur tdyy)zValidate this session before use with client. Raises error if the client is not the one that created the session. z9Can only use session with the MongoClient that started itN)_clientr")r7rr)s rZrzConnection.validate_session\s) f,&'bcc- r\c |jry|j|r|jr?|jJ|jj |j |j ||jrtjtjr]tt|jtj|j d|j d|j t!||yyyy)z$Close this connection with a reason.Nrrtr;r-r<r=r>reasonr)r _close_connrrpublish_connection_closedrrrr-rBrCrDr/rr. CONN_CLOSEDr0)r7rKs rZrzConnection.close_conngs ;;   $$~~11188twwPVW'',>,K,KGMM,Z&!__4@@#||A#||A'+ww;FC  -[' r\c|jryd|_|jj |jj y#t $rYywxYw)zClose this connection.NT)rrrrclose ExceptionrHs rZrLzConnection._close_conn|sJ ;;   ""$  IIOO    sA AAcL|jj|jS)z?Return True if we know socket has been closed, False otherwise.)r socket_closedrrHs rZ conn_closedzConnection.conn_closeds""00;;r\c.|r|j||yy)zAdd $clusterTime.N)_send_cluster_time)r7r4r)rs rZrzConnection.send_cluster_times   % %gw 7 r\cr|jjr!t||jjyy)zAdd server_api parameters.N)rQrCr7)r7r4s rZrzConnection.add_server_apis( 99   GTYY%9%9 : r\c6tj|_yrdrrrrHs rZupdate_last_checkin_timez#Connection.update_last_checkin_times!%!1r\c||_yrd)r)r7rs rZupdate_is_writablezConnection.update_is_writables &r\cDtj|jz S)z9Seconds since this socket was last checked into its pool.rYrHs rZidle_time_secondszConnection.idle_time_secondss~~$"8"888r\c|jrd}ntj}|j|t |t t tfr.t|j}t|j||y)Nr) rr2ERRORrrIOErrorrhr;r rQrr)r7rrKrs rZrz$Connection._raise_connection_failuresY ::F+11F  egw9 :*4995G %dllE7 S r\c4|j|jk(Srd)rr7others rZ__eq__zConnection.__eq__syyEJJ&&r\c||k( Srdr^rds rZ__ne__zConnection.__ne__s5=  r\c,t|jSrd)hashrrHs rZ__hash__zConnection.__hash__sDIIr\cdjt|j|jxrdxsdt |S)NzConnection({}){} at {}z CLOSEDr)r6reprrrrrHs rZ__repr__zConnection.__repr__s8'.. O KK %I + tH  r\)rUnion[socket.socket, _sslConn]rPoolrztuple[str, int]rrg)rrirrr)rrHrz"Optional[MutableMapping[str, Any]]rrrirrs)rrHello[dict[str, Any]])rzOptional[ClusterTime]rz Optional[Any]rrhrrrq)"r"rr#MutableMapping[str, Any]r$rMr%r<r&rr'z#Optional[Sequence[Union[str, int]]]r(zOptional[ReadConcern]rzOptional[WriteConcern]rrrzOptional[_CollationIn]r)Optional[ClientSession]rOptional[MongoClient]r*rrrrzOptional[Mapping[str, Any]]rrrrr)r-bytesr.rgrrr)r1rhrrzUnion[_OpReply, _OpMsg])rrrrr)rrur.rgrrr)r1rgrrur%r<rrr)F)r9rrrr)rrtr)rsrrr)rKrlrrrrw)r4rrr)rsrrtrrr)r4rrrrr)rrrrrrt)rr!rrr )rerrrrrv)rrr)'rxryrzr{rFrrrrrrrrrr+r6PRIMARYrr4r/r5r r4r7r@rrrLrTrrrZr\r^rrfrhrkrnr^r\rZrrsi1.21.:>1.IX1.^a1.f&!(J >&#:@-W+W(W+ W  Wr (6'='=&;@D.204*/,0+/(, %#37 %#W2W2'W2% W2 $ W2  W2>W2,W2.W2$(W2*W2)W2&W2W2W2 1!W2"#W2$ %W2W2r2 2d -$):F $ D d+ d6M d  d* <8)8)8& 8  8; 2'98'! r\rc |\}}|jdrkttds tdtjtj}t |j  |j||Stj}tjr|dk7rtj}d}tj|||tjD]}|\}} } } } tj|| ttddz| }t |j  |j!tj"tj$dt'j(} | |j*} n| dkrtj,d |j/| |j!tj0tj2d t5||j| |cS||td #t$r|jwxYw#t$rtj|| | }Y7wxYw#t$r}|}|jYd}~d}~wwxYw) zGiven (host, port) and PoolOptions, connect and return a socket object. Can raise socket.error. This is a modified version of create_connection from CPython >= 2.7. z.sockAF_UNIXz-UNIX-sockets are not supported on this system localhostN SOCK_CLOEXECrrtrTzgetaddrinfo failed)endswithrr{rrxr[filenoconnectrhrPAF_INEThas_ipv6 AF_UNSPEC getaddrinfo SOCK_STREAMrrr TCP_NODELAYrrrrr SOL_SOCKET SO_KEEPALIVEr)rrrrr}familyerrresafsocktypeprotodummysares rZ_create_connectionrs JD$ }}Wvy)#$ST T}}V^^,' 6  LL K^^F 4;.!! C!!$ff6H6HI),&HeUB 6==XPQ0R%RTYZD ( 6  OOF..0B0BA Foo'G!11Ann[11 OOG $ OOF--v/B/BD I  & LL K3J<  *++c  JJL  & 6==Xu5D 6& C JJLL s7/H ,)H)/C I H&) I  I  I6I11I6ct||}|j}||j|j|S|d} tr|j ||}n|j |}|jr>|js2|js& tj j#|j|j|S#t $r|jttf$r4}|jt|}t||d|Yd}~d}~wwxYw#t $rjwxYw)zGiven (host, port) and PoolOptions, return a configured socket. Can raise socket.error, ConnectionFailure, or _CertificateError. Sets socket's SSL and timeout options. Nr)server_hostnamezSSL handshake failed: r`)hostname)rr]rrr: wrap_socketr(rPrhr;r r verify_modecheck_hostnamer=sslmatch_hostname getpeercert)rrr}r<rssl_sockexcrs rZ_configured_socketrs; gw /D&&K ../ 1:Dc "..tT.JH"..t4H **33    x335 E  ../ O1    X c 'w/!'30HZabb c!  NN   s#+C%D/(D,8*D''D,/E ceZdZdZy)_PoolClosedErrorzZInternal error raised when a thread tries to get a connection from a closed pool. N)rxryrzr{r^r\rZrrKsr\rc4eZdZddZddZd dZd dZd dZy) _PoolGenerationcNtjt|_d|_yr ) collections defaultdictrg _generations _generationrHs rZrFz_PoolGeneration.__init__Rs1<1H1H1Mr\c<| |jS|j|S)z,Get the generation for the given service_id.rrr7rs rZrz_PoolGeneration.getXs%  ## #  ,,r\c|jS)z"Get the Pool's overall generation.)rrHs rZrz_PoolGeneration.get_overall^sr\c|xjdz c_|)|jD]}|j|xxdz cc<y|j|xxdz cc<y)z2Increment the generation for the given service_id.rtNrrs rZincz_PoolGeneration.incbsW A  "// !!*-2-0   j )Q . )r\c*||j|k7S)z?Return if the given generation for a given service_id is stale.)rr7rrs rZstalez_PoolGeneration.staleksdhhz***r\Nr)rOptional[ObjectId]rrrgrv)rrrrrrrgrrrrr)rxryrzrFrrrrr^r\rZrrQs -  /+r\rceZdZdZdZdZy) PoolStatertrrN)rxryrzPAUSEDREADYCLOSEDr^r\rZrrps F E Fr\rceZdZ d ddZddZeddZ d ddZddZ d ddZ ddZ dd Z dd Z dd Z dd d Zej dd!d Zd"dZ d d#dZd$dZd%dZd&dZddZy)'rpNc|jrtj|_ntj|_d|_t j|_t|_ t|_ d|_ d|_d|_t!|_t%j&|_||_||_||_|j.xr:|j,j0duxr |j,j0j2|_|j.|_t7j8|j|_d|_|j,j>|_|j>stAd|_t7j8|j|_!|j,jD|_#d|_$||_%|j2r\|j,j0J|j,j0jM|j*|j,jN|j4r~tQjRtTjVr[tYtPf|jJtZj\|j*d|j*dd|j,jNd|_/t|_0d|_1d|_2y)z :param address: a (hostname, port) tuple :param options: a PoolOptions instance :param handshake: whether to call hello for each new Connection rtrNinfr;r-r<r=)3rBrrstater_check_interval_secondsrdequeconnssetactive_contextsr,lockactive_socketsnext_connection_idrrrrgetpidpidrrQ handshaker`rr threading Condition size_condrequestsr8ru_max_connecting_condrA_max_connecting_pendingrpublish_pool_createdrRr-rBrCrDr/r. POOL_CREATEDoperation_count_Pool__pinned_socketsncursorsntxns)r7rrr client_ids rZrFz Pool.__init__ys<  "))DJ"DJ()$)4(9(9(; :=% N "#+/ #$99;  " NN < **$6 < **;;  $(>> #,,TYY7 !YY44!!!&uD %.$7$7 $B!#yy77 #  99--9 99 II & & ; ; dii;;   # #(:(G(G (V " 0==<<?<<?   ))//  %&25  r\c :|j5|jtjk7rtj|_|jrG|j j J|j j j|j|jritjtjrFtt|jt j"|jd|jddddy#1swYyxYw)Nrrtr)rrrrrrQr`publish_pool_readyrrr-rBrCrDr/rr. POOL_READYrHs rZrz Pool.readys YY zzY__,&__ ((9955AAAII..AA$,,O++0B0O0OPWP]P]0^*!% 8 C C#'<<?#'<<?    s C;DDc<|jtjk(Srd)rrrrHs rZrz Pool.closedszzY----r\cd|j}|j5|jr dddy|jjr:|r8|jj s"|jt jc}|_|jj|tj}|j|k7r||_ d|_ d|_|'|jt!j"c}|_ntt!j"}t!j"} |jD]4} | j$|k(r|j'| $| j'| 6|}| |_|rt j(|_|j*j-|jj-|r!|j.D]} | j1ddd|jj2} |rD]!} | j5t6j8#|j:r| J| j=|j>|j@rktCjDtFjHrGtKtB|jLtNj8|j>d|j>dyyy|t jk7r|j:r"| J| jQ|j>|||j@rjtCjDtFjHrGtKtB|jLtNjR|j>d|j>d|D]!} | j5t6jT#y#1swYxYw)Nrrtr)rinterrupt_connections)r;r-r<r= serviceId)+rrrrQrBrDrrrrrrrrrrrrrappendrr notify_allrrr`rr2 POOL_CLOSEDrpublish_pool_closedrrr-rBrCrDr/rr.publish_pool_cleared POOL_CLEAREDr) r7rPpauserr old_statenewpidsocketsdiscardkeeprcontextrs rZ_resetz Pool._resetsJJ ^^ %{{ % %yy&&59P9P(, I4D4D% 4: HHLL $YY[Fxx6!!&'#'($!&*jj+2C2C2E#-8->->-@*5*;*;*= JJD*4t, D) ' "! &--  % % 0 0 2 NN % % '$#33GNN$ 4? %DII..   6 B BC $$ ,,,--dll;'',>,K,KGMM,Z&!__4@@#||A#||A -['I,,,(($00022 #-.C3 ++0B0O0OPWP]P]0^*!% 8 E E#'<<?#'<<?",   6 < <= M % %sN%F.N%%N/c||_|j5|jD]}|j|j dddy#1swYyxYw)zXUpdates the is_writable attribute on all sockets currently in the Pool. N)rrrr\)r7r_sockets rZr\zPool.update_is_writable4sJ' YY =::**4+;+;<& = = =s -A  Ac,|jd||y)NF)rPrrr)r7rrs rZresetz Pool.reset=s %JNc dr\c*|jddy)NF)rPrrrHs rZreset_without_pausezPool.reset_without_pauseBs %u -r\c(|jdy)NT)rPrrHs rZrPz Pool.closeEs $ r\c:|jj||Srd)rrrs rZstale_generationzPool.stale_generationHsxx~~c:..r\c |j5|jtjk7r dddy ddd|jj |j5|j r|j dj|jj kDrz|j j}|jtj|j r5|j dj|jj kDrzddd |j5t|j |jz|jjk\r dddy|j |jjk\r dddy|xj dz c_dddd} |j"5|j$|j&k\r ddd|rD|j"5|xj$dzc_|j"j)ddd|j5|xj dzc_|jj)dddy|xj$dz c_d}ddd|j+}|j5|j,j/|k7r|jtj0 ddd|rD|j"5|xj$dzc_|j"j)ddd|j5|xj dzc_|jj)dddy|j j3||j4j7|j8ddd|rD|j"5|xj$dzc_|j"j)ddd|j5|xj dzc_|jj)ddd7#1swY'xYw#1swYOxYw#1swYxYw#1swYVxYw#1swYyxYw#1swY xYw#1swYpxYw#1swYyxYw#1swYxYw#1swYxYw#1swYxYw#|rQ|j"5|xj$dzc_|j"j)dddn #1swYnxYw|j5|xj dzc_|jj)dddw#1swYwxYwxYw)zRemoves stale sockets then adds new ones if pool is too small and has not been reset. The `reference_generation` argument specifies the `generation` at the point in time this operation was requested on the pool. NrTrtF)rrrrrQr:rr^rrr2IDLErrrr9rrrrnotifyr}rrr appendleftrrr)r7reference_generationr incrementeds rZremove_stale_socketszPool.remove_stale_socketsKsiYY zzY__,  ,  99 * * 6 AJJ 288:TYY=\=\\::>>+DOO$:$?$?@ JJ 288:TYY=\=\\ A #tzz?T%8%88DII(D(DE F22; * 1188:;^^,MMQ&MNN))+,,JJ))$/((001D1DEF22; * 1188:;^^,MMQ&MNN))+,C    A A # #8;;,,/''&;;,,FF;;,, 22; * 1188:;;;^^,MMQ&MNN))+,,,sQ B:Q(0;Q54$Q5!Q5 S% R(S%>0R0R;R$S%6>S4S% 0R(0R5ASS%0S !0SQ%(Q25Q?R RR% S%(R25R>S S% SS"%V 40T-$ V -T6 2V 0U>5 V >V V c b|j5|j}|xjdz c_ddd|jj}|jr |J|j |j |jrjtjtjrGtt|jtj|j d|j d t!|j |j}t;|||j }|j5|j<j?|j@ddd |jBr!|jE|jF|_#|r|jI|d|jK|S#1swYxYw#t"$r&}|jr/|J|j%|j t&j(|jrtjtjrntt|jtj*|j d|j dt-t&j(t&j(t/|t0t2t4fr-t7|j}t9|j ||d}~wwxYw#1swYxYw#t"$r!|jMt&j(wxYw) zConnect to Mongo and return a new Connection. Can raise ConnectionFailure. Note that the pool does not keep a reference to the socket -- you must call checkin() when you're done with it. rtNrr;r-r<r=r>rJr`F)completed_handshake)'rrrQr`rpublish_connection_createdrrr-rBrCrDr/rr. CONN_CREATEDrr!rMr2rarNr0rrbrhr;r rrraddrrrrcontribute_socketr@r)r7handlerconn_idrr}rrrs rZr}z Pool.connectsYY )--G  # #q ( # )II..  ( ((  0 0w G  # #(:(G(G (V "0==<<?<<?#*   %dllDII>D0$dllG< YY :  $ $T%8%8 9 : ~~ #'#3#3 ))$E)J      u ) )( $$ ,,,33LL'+A+G+G'',>,K,KGMM,Z&!__4@@#||A#||A'.;.tyy9)$,,wW + 0 : :  OO288 9  s="F70 G4&K7#AL7G K4D!K//K47L*L.c #K|jj}tj}|jr|J|j |j |jritjtjrFtt|jtj|j d|j d|j!||}tj|z }|jr+|J|j#|j |j$||jrutjtjrRtt|jtj&|j d|j d|j$| |j(5|j*j-|j.ddd||j2rF|j(5|j@j-||xjBdz c_!dddy|j4rF|j(5|j@j-||xjDdz c_"dddy|j<r|j?|yy#1swYxYw#t0$rg|j2xs |j4}|r*t7j8\}}} |j;|||s|j<r|j?|wxYw#1swYyxYw#1swYyxYww)aGet a connection from the pool. Use with a "with" statement. Returns a :class:`Connection` object wrapping a connected :class:`socket.socket`. This method should always be used in a with-statement:: with pool.get_conn() as connection: connection.send_message(msg) data = connection.receive_message(op_code, request_id) Can raise ConnectionFailure or OperationFailure. :param handler: A _MongoClientErrorHandler. Nrrtrrr:)#rQr`rrr$publish_connection_check_out_startedrrr-rBrCrDr/rr.CHECKOUT_STARTED _get_connpublish_connection_checked_outrCHECKOUT_SUCCEEDEDrrrrr!rrsysexc_infohandlerrrrr) r7rrcheckout_started_timerrFpinnedexc_typeexc_valrns rZcheckoutz Pool.checkouts"II.. $ 0  ( ((  : :4<< H  # #(:(G(G (V "0AA<<?<<?  ~~3W~E>>#&;;  ( ((  4 4T\\477H U  # #(:(G(G (V "0CC<<?<<?#'77#   >$$(()<)<= >J ?? %%))$/ a      #%%))$/ "  # #[[ LL 3 > >  __:(:(:F(+||~$'1x1dkk T"     # #sgF-M0 J=<&J1" J=.M1L07!M1L< (M1J:6J==A0L--M0L95M<MMc |jtjk7r:|rtj|z }|j rW|j jJ|j jj|jtj||jrztjtj rWt#t|j$t&j(|jd|jddtj|t+|j }t-|jt/d|yy)Nrrt>+.CC((9955AAAII..RR &D&O&OQY++0B0O0OPWP]P]0^*!% 8 H H#'<<?#'<<?]<GG#+ +4995G % m,DEW^ + )r\c  |jtjk7r|j|jr t j |z }|jrW|jjJ|jjj|jtj||jrztj t"j$rWt't|j(t*j,|jd|jddtj|t/d|j05|xj2dz c_dddt5j6rt5j8}nD|jj:r,t j |jj:z}nd}|j<5|j?|d|j@|jBkstE|j<|sD|j@|jBkr|j<jG|jI||j?|d|j@|jBks|xj@dz c_ dddd}d }d } |j05|xjJdz c_%d}ddd|{|jL5|j?|d |jNs|jP|jRkstE|jL|sR|jNs|jP|jRkr|jLjGd}|jI||j?|d |jNs|jP|jRks |jNjU}ddd|r|jY|r[d}# |j[| }|jL5|xjPdzc_(|jLjGddd|{d|_3|S#1swYxYw#1swYxYw#1swYxYw#tV$r|xjPdz c_(YwxYw#1swYxYw#1swYmxYw#|jL5|xjPdzc_(|jLjGdddw#1swYwxYwxYw#t\$r|r|j_t`jb|j<5|xj@dzc_ |r|xjJdzc_%|j<jGdddn #1swYnxYw|st j |z }|jrW|jjJ|jjj|jtjd||jrztj t"j$rWt't|j(t*j,|jd|jdd tjd|wxYw) z8Get or create a Connection. Can raise ConnectionFailure.NrrtzConnection pool was closedrz?Attempted to check out a connection from closed connection poolT)rFrr)4rrrrrrrrrQr`rrr1rrr-rBrCrDr/rr.rrrrrr get_deadliner;rrrr8rr_raise_wait_queue_timeoutrrrrrpopleft IndexError _perishedr}r!rr2rarr)r7r rrFrrr emitted_events rZrzPool._get_conn.so 88ryy{ "  $ $ & ;;~~'*??H$$yy11=== **NNLL"@"L"Lh'',>,K,KGMM,Z&!__4DD#||A#||A78DD' #Q YY &  A %  &    ))+H YY ) )~~'$))*F*FFHH ^^   $ $%:t $ L}}t'9'99!$..(;}}t'9'99--/223HI(()>4(P}}t'9'99 MMQ M   >  ###q(#"  #,..+,,-Bu,U#zzT]]T=Q=Q-Q)$*C*CXN $zzT]]T=Q=Q-Q $ 9 9 @ @ B,0M ::;PQ001FSX0Y $zzT]]T=Q=Q-Q+#zz113+ ~~d+# ?#||G|<!66? MMQ.M 55<<>?7,x  y & &  " # #(&+ * +++0??T66? MMQ.M 55<<>???  6 < <= ( " ''1,'%%'  ( ( ( !>>+.CC((9955AAAII..RR &D&O&OQY++0B0O0OPWP]P]0^*!% 8 H H#'<<?#'<<?]<GG#+  9 sQ8-B3R!R T0R)T0CSR5T0S' T030S# T08RRRT0S=S?SSS T0ST0 T-(0T! T-!T* &T--T007['AV7. [7W  ( ()<)< = >  ( ((  3 3DLL$'' J  # #(:(G(G (V "0::<<?<<?#'77   88ryy{ "  $ $ &{{ 6 B BC(($00077 dgg/E/K/K++0B0O0OPWP]P]0^*!% 8 D D#'<<?#'<<?+/77?@V@\@\]4:: YY ;,,T__dooN(>(D(DE557//T5E5E0FG --d31188: ;^^ $ a  " MMQ M   1 $   A % NN ! ! # $ $e > >L ; ; $ $s&+&P 6B0P:B P% PP"%P.c|j}|jj9||jjkDr |jtj y|j N|j dk(s||j kDr0|jr |jtjy|j|j|jr |jtjyy)aReturn True and close the connection if it is "perished". This side-effecty function checks if this socket has been idle for for longer than the max idle time, or if the socket has been closed by some external network error, or if the socket's generation is outdated. Checking sockets lets us avoid seeing *some* :class:`~pymongo.errors.AutoReconnect` exceptions on server hiccups, etc. We only check if the socket was closed by an external error if it has been > 1 second since the socket was checked into the pool, to keep performance reasonable - we can't avoid AutoReconnects completely anyway. TrF) r^rQr:rr2rrrTrarrrr)r7rr^s rZrzPool._perisheds!224 II + + 7!DII$C$CC OO277 8  ' ' 3  ( (A -1BTEaEa1a! 6 < <=  $// B OO288 9r\c |jj}tj|z }|jr/|J|j |j tj||jrztjtjrWtt|jt j"|j d|j ddtj|t%j&xs|jj(}|jj*rl|j,|j.z |j0z }t3dj5|jj6|j.|j0||t3d|jj6d|)NrrtzBWait queue timeout elapsed without a connection becoming availablerzTimeout waiting for connection from the connection pool. maxPoolSize: {}, connections in use by cursors: {}, connections in use by transactions: {}, connections in use by other operations: {}, timeout: {}zMTimed out while checking out a connection from connection pool. maxPoolSize: z , timeout: )rQr`rrrrrr1TIMEOUTrr-rBrCrDr/rr.rrrr;rDrrrr'r6r8)r7r rrFr other_opss rZrzPool._raise_wait_queue_timeoutsmII.. >>#&;;  ( ((  9 9 <DDh   # #(:(G(G (V "0@@<<?<<?[4<<# ##%E)E)E 99 " "++dmm;djjHI'78>vII++MMJJ 8  $  II334Ky J  r\cH|jD]}|jdyrd)rr)r7rs rZ__del__z Pool.__del__?sJJD OOD !r\)TN)rrPrrrrrrrrw)TNF) rPrrrrrrrrrr)rrprrrr)rrrrrrrr)rrgrrrrd)r"Optional[_MongoClientErrorHandler]rrr)rr+rrzIterator[Connection])r rurrrrr)r rurr+rrr)rrrrr)rrrrr)r rurrr )rxryrzrFrr}rrr\rrrPrrr} contextlibcontextmanagerrrrrrrr*r^r\rZrprpxsG (, SSS S & Sj".. )-&+ O>O>O>' O> $ O>  O>b=TYe,eLPe e . /7,rBHIIV6[_|%*|5W| ||F$P"H% N"r\rp)rXrgrrr)r} socket.socketrrrrgrrr)r}r.rrr)rrzdict[str, str]rw)rjrrrrhrs)rrrrrr)NN) rrrrQrrlrOptional[dict[str, float]]rrr )rzthreading.Conditionrrirrr)rrrrzdict[str, float])rr/rrr)rrPrrrrr.)rrPrrrrro) __future__rrr,r3rCrrr{rr rrrpathlibrtypingrrrrr r r r r rrrrrrpymongo.client_sessionrpymongo.commonrrrrrrrrrrpymongo.errorsrrrr r!r"r#r$r%r&r'r( pymongo.hellor)r*pymongo.helpersr+ pymongo.lockr,pymongo.loggerr-r.r/r0pymongo.monitoringr1r2r3pymongo.networkr4r5pymongo.read_preferencesr6pymongo.server_apir7pymongo.server_typer8pymongo.socket_checkerr9pymongo.ssl_supportr:r;r< bson.objectidr= pymongo.authr>r?r@pymongo.compression_supportrArBrCrDpymongo.driver_inforEpymongo.messagerFrGpymongo.mongo_clientrHrIpymongo.pyopenssl_contextrJrKpymongo.read_concernrLrMrNpymongo.typingsrOrPrQpymongo.write_concernrRrVrSrTrUr[ ImportErrorrwryr_winregreroOpenKeyHKEY_LOCAL_MACHINErjrvrxrhrrr__annotations__rsystem_namemachinereleasemac_vergetwindowsversion_verenvironrjoinmaprjava_ver_arch system_aliasr_aliasedpython_implementationpypy_version_info version_inforrrrrrrrrrrrrrrrrr rrrrrrrrrrp)parts0rZrbs#        &//B       -*%  53.+01!&:4 /0J>04,CC2 E99/<<7  ( V^^  % %'\  N #)##H '-c3F'M $  NM ? & k'RS >S<<7# HOO E(((*#8##% IdO \\X!!(((*$8##%a( IdO \\W 3 "D '?@VDTHDTDTDV88CT"1X./CRC7H2II IdO \\V$***,R0E4IdO%x$$_X__%68H8H8H8JL\HL\L\L^_H!8BQ<@44$@A(((*A; IdO"8!!#..v6HH *H * * , HHSc334 5 CHHSc.>.>%?@ @ Ij \\V$HH *H * * , HHSc../ 0 SXXx02B(2B2B2DEF F Ij HH ' ' ' )388CS=M=M4N+OPIj ' $ 7F%N"J'H V !%26 , , ,,0 ,  ,:#  e$e$P  M M `D,N.b| ++>L "L "}'EE E  N N ( '#' (fAsZXX" X?*X2?X?Y Y  XX" X/.X/2X<7X?? Y  Y