+\h:dZddlmZddlZddlZddlZddlmZmZm Z m Z ddl m Z ddl mZddlmZddlmZmZdd ZGd d ZGd d eeZy)z2Helpers for the 'hello' and legacy hello commands.) annotationsN)AnyGenericMappingOptional)ObjectId)common) SERVER_TYPE) ClusterTime _DocumentTypec|jdstjS|jdrtjS|jdrtjS|jdr|jdrtj S|jt jrtjS|jt jrtjS|jdrtjS|jdrtjStj S|jdd k(rtjStjS) z0Determine the server type from a hello response.ok serviceId isreplicasetsetNamehidden secondary arbiterOnlymsgisdbgrid)getr Unknown LoadBalancerRSGhostRSOther HelloCompatPRIMARY RSPrimaryLEGACY_PRIMARY RSSecondary RSArbiterMongos Standalone)docs P/root/niggaflix-v3/playground/venv/lib/python3.12/site-packages/pymongo/hello.py_get_server_typer&s  774=""" ww{'''  """   778 && & WW[(( )(( ( WW[// 0(( ( WW[ !** * WW] #(( (&& & : %!!!%%%c eZdZdZdZdZdZdZy)rhelloismasterisWritablePrimaryz not masterN)__name__ __module__ __qualname__CMD LEGACY_CMDrr LEGACY_ERRORr'r%rr9s CJ!GNLr'rceZdZdZdZd d!dZed"dZed#dZed$dZ ed%dZ ed&dZ ed'd Z ed#d Z ed#d Zed#d Zed#d Zed#dZed(dZed)dZed*dZed(dZed+dZed+dZed&dZed,dZed-dZed.dZed/dZed/dZed+dZed)dZed+dZ ed(dZ!y)0HellozHParse a hello response from the server. .. versionadded:: 3.12 )_doc _server_type _is_writable _is_readable _awaitablec>t||_||_|jtjtj tj tjfv|_|jtjk(xs |j|_ ||_ yN) r&r6r5r rr#r"rr7 server_typer r8r9)selfr$ awaitables r%__init__zHello.__init__Is,S1#&  --  ! !  " "     $ $ 2  !,, 0G0GG\4K\K\#r'c@tj|jS)zUThe complete hello command response document. .. versionadded:: 3.4 )copyr5r=s r%documentzHello.documentVs yy##r'c|jSr;)r6rBs r%r<zHello.server_type^   r'c tttjt j |j jdg|j jdg|j jdgS)z;List of hosts, passives, and arbiters known to this server.hostspassivesarbiters)setmapr clean_node itertoolschainr5rrBs r% all_hostszHello.all_hostsbsd !!IIMM'2.IIMM*b1IIMM*b1   r'c:|jjdiS)z&Replica set member tags or empty dict.tagsr5rrBs r%rQz Hello.tagspsyy}}VR((r'c~|jjdr"tj|jdSy)z8This server's opinion about who the primary is, or None.primaryN)r5rr partition_noderBs r%rTz Hello.primaryus1 99== #((9)=> >r'c8|jjdS)zReplica set name or None.rrRrBs r%replica_set_namezHello.replica_set_name}syy}}Y''r'cV|jjdtjS)NmaxBsonObjectSize)r5rr MAX_BSON_SIZErBs r% max_bson_sizezHello.max_bson_sizesyy}}0&2F2FGGr'cV|jjdtjS)NmaxMessageSizeBytes)r5rr MAX_MESSAGE_SIZErBs r%max_message_sizezHello.max_message_sizesyy}}2F4K4KLLr'cV|jjdtjS)NmaxWriteBatchSize)r5rr MAX_WRITE_BATCH_SIZErBs r%max_write_batch_sizezHello.max_write_batch_sizesyy}}0&2M2MNNr'cV|jjdtjS)NminWireVersion)r5rr MIN_WIRE_VERSIONrBs r%min_wire_versionzHello.min_wire_versionyy}}-v/F/FGGr'cV|jjdtjS)NmaxWireVersion)r5rr MAX_WIRE_VERSIONrBs r%max_wire_versionzHello.max_wire_versionrhr'c8|jjdS)N setVersionrRrBs r% set_versionzHello.set_versionyy}}\**r'c8|jjdS)N electionIdrRrBs r% election_idzHello.election_idrpr'c8|jjdS)Nz $clusterTimerRrBs r% cluster_timezHello.cluster_timeyy}}^,,r'c8|jjdS)NlogicalSessionTimeoutMinutesrRrBs r%logical_session_timeout_minutesz%Hello.logical_session_timeout_minutessyy}};<>> hello.sasl_supported_mechs ["SCRAM-SHA-1", "SCRAM-SHA-256"] saslSupportedMechsrRrBs r%sasl_supported_mechszHello.sasl_supported_mechssyy}}1266r'c8|jjdS)z"The speculativeAuthenticate field.speculativeAuthenticaterRrBs r%speculative_authenticatezHello.speculative_authenticatesyy}}677r'c8|jjdS)NtopologyVersionrRrBs r%topology_versionzHello.topology_versionsyy}}.//r'c|jSr;)r9rBs r%r>zHello.awaitables r'c8|jjdS)NrrRrBs r% service_idzHello.service_idsyy}}[))r'c:|jjddS)NhelloOkFrRrBs r%hello_okzHello.hello_oksyy}}Y..r'c8|jjdS)N connectionIdrRrBs r% connection_idzHello.connection_idrvr'N)F)r$r r>boolreturnNone)rr )rint)rzset[tuple[str, int]])rMapping[str, Any])rzOptional[tuple[str, int]])rz Optional[str])rz Optional[int])rzOptional[ObjectId])rzOptional[ClusterTime])rr)rzOptional[datetime.datetime])rzOptional[list[str]])rz list[str])rzOptional[Mapping[str, Any]])"r,r-r.__doc__ __slots__r?propertyrCr<rOrQrTrWr[r_rcrgrlrorsruryr{r}rrrrrrr>rrrr2r'r%r4r4As< WI $$$!!    ))((HHMMOOHHHH++++--==!!!! CC,, 7 78800**//--r'r4)r$rrr)r __future__rrAdatetimerMtypingrrrr bson.objectidrpymongor pymongo.server_typer pymongo.typingsr r r&rr4r2r'r%rsJ9" 22"+6&8  _-GM "_-r'