
    &g                        S r SSKJr  SSKrSSKrSSKrSSKJrJrJ	r	J
r
  SSKJr  SSKJr  SSKJr  SSKJrJr  SS	 jr " S
 S5      r " S S\\   5      rg)z2Helpers for the 'hello' and legacy hello commands.    )annotationsN)AnyGenericMappingOptional)ObjectId)common)SERVER_TYPE)ClusterTime_DocumentTypec                P   U R                  S5      (       d  [        R                  $ U R                  S5      (       a  [        R                  $ U R                  S5      (       a  [        R                  $ U R                  S5      (       a  U R                  S5      (       a  [        R
                  $ U R                  [        R                  5      (       a  [        R                  $ U R                  [        R                  5      (       a  [        R                  $ U R                  S5      (       a  [        R                  $ U R                  S5      (       a  [        R                  $ [        R
                  $ U R                  S5      S	:X  a  [        R                  $ [        R                  $ )
z0Determine the server type from a hello response.ok	serviceIdisreplicasetsetNamehidden	secondaryarbiterOnlymsgisdbgrid)getr
   UnknownLoadBalancerRSGhostRSOtherHelloCompatPRIMARY	RSPrimaryLEGACY_PRIMARYRSSecondary	RSArbiterMongos
Standalone)docs    RC:\Suresh\moveshuttle\MDcreated\moveengine\venv\Lib\site-packages\pymongo/hello.py_get_server_typer&      s'   774=="""
ww{'''		 	 """			778&&&WW[(())(((WW[//00(((WW[!!***WW]##(((&&&	:	%!!!%%%    c                  (    \ rS rSrSrSrSrSrSrSr	g)r   9   helloismasterisWritablePrimaryz
not master N)
__name__
__module____qualname____firstlineno__CMD
LEGACY_CMDr   r   LEGACY_ERROR__static_attributes__r-   r'   r%   r   r   9   s    
CJ!GNLr'   r   c                  F   \ rS rSrSrSrS"S#S jjr\S$S j5       r\S%S j5       r	\S&S j5       r
\S'S j5       r\S(S	 j5       r\S)S
 j5       r\S%S j5       r\S%S j5       r\S%S j5       r\S%S j5       r\S%S j5       r\S*S j5       r\S+S j5       r\S,S j5       r\S*S j5       r\S-S j5       r\S-S j5       r\S(S j5       r\S.S j5       r\S/S j5       r\S0S j5       r\S1S j5       r\S1S j5       r\S-S j5       r\S+S j5       r \S-S j5       r!\S*S j5       r"S r#g!)2HelloA   z@Parse a hello response from the server.

.. versionadded:: 3.12
)_doc_server_type_is_writable_is_readable
_awaitablec                F   [        U5      U l        Xl        U R                  [        R                  [        R
                  [        R                  [        R                  4;   U l        U R                  [        R                  :H  =(       d    U R                  U l        X l        g N)r&   r:   r9   r
   r   r#   r"   r   r;   server_typer    r<   r=   )selfr$   	awaitables      r%   __init__Hello.__init__I   s{    ,S1#&	 --!!""$$	2
 
 !,,0G0GG\4K\K\#r'   c                B    [         R                   " U R                  5      $ )zEThe complete hello command response document.

.. versionadded:: 3.4
)copyr9   rA   s    r%   documentHello.documentV   s     yy##r'   c                    U R                   $ r?   )r:   rG   s    r%   r@   Hello.server_type^          r'   c                   [        [        [        R                  [        R
                  " U R                  R                  S/ 5      U R                  R                  S/ 5      U R                  R                  S/ 5      5      5      5      $ )z;List of hosts, passives, and arbiters known to this server.hostspassivesarbiters)setmapr	   
clean_node	itertoolschainr9   r   rG   s    r%   	all_hostsHello.all_hostsb   sd     !!IIMM'2.IIMM*b1IIMM*b1	
 		
r'   c                :    U R                   R                  S0 5      $ )z&Replica set member tags or empty dict.tagsr9   r   rG   s    r%   rY   
Hello.tagsp   s     yy}}VR((r'   c                    U R                   R                  S5      (       a#  [        R                  " U R                   S   5      $ g)z8This server's opinion about who the primary is, or None.primaryN)r9   r   r	   partition_noderG   s    r%   r]   Hello.primaryu   s4     99==##((9)=>>r'   c                8    U R                   R                  S5      $ )zReplica set name or None.r   rZ   rG   s    r%   replica_set_nameHello.replica_set_name}   s     yy}}Y''r'   c                V    U R                   R                  S[        R                  5      $ )NmaxBsonObjectSize)r9   r   r	   MAX_BSON_SIZErG   s    r%   max_bson_sizeHello.max_bson_size   s    yy}}0&2F2FGGr'   c                V    U R                   R                  S[        R                  5      $ )NmaxMessageSizeBytes)r9   r   r	   MAX_MESSAGE_SIZErG   s    r%   max_message_sizeHello.max_message_size   s    yy}}2F4K4KLLr'   c                V    U R                   R                  S[        R                  5      $ )NmaxWriteBatchSize)r9   r   r	   MAX_WRITE_BATCH_SIZErG   s    r%   max_write_batch_sizeHello.max_write_batch_size   s    yy}}0&2M2MNNr'   c                V    U R                   R                  S[        R                  5      $ )NminWireVersion)r9   r   r	   MIN_WIRE_VERSIONrG   s    r%   min_wire_versionHello.min_wire_version       yy}}-v/F/FGGr'   c                V    U R                   R                  S[        R                  5      $ )NmaxWireVersion)r9   r   r	   MAX_WIRE_VERSIONrG   s    r%   max_wire_versionHello.max_wire_version   rw   r'   c                8    U R                   R                  S5      $ )N
setVersionrZ   rG   s    r%   set_versionHello.set_version       yy}}\**r'   c                8    U R                   R                  S5      $ )N
electionIdrZ   rG   s    r%   election_idHello.election_id   r   r'   c                8    U R                   R                  S5      $ )Nz$clusterTimerZ   rG   s    r%   cluster_timeHello.cluster_time       yy}}^,,r'   c                8    U R                   R                  S5      $ )NlogicalSessionTimeoutMinutesrZ   rG   s    r%   logical_session_timeout_minutes%Hello.logical_session_timeout_minutes   s    yy}};<<r'   c                    U R                   $ r?   )r;   rG   s    r%   is_writableHello.is_writable   rL   r'   c                    U R                   $ r?   )r<   rG   s    r%   is_readableHello.is_readable   rL   r'   c                t    U R                   R                  S5      nU(       a  [        R                  " U5      $ g )Nme)r9   r   r	   rS   )rA   r   s     r%   r   Hello.me   s+    YY]]4 $$R((r'   c                X    U R                   R                  S0 5      R                  S5      $ )N	lastWritelastWriteDaterZ   rG   s    r%   last_write_dateHello.last_write_date   s"    yy}}["-11/BBr'   c                8    U R                   R                  S5      $ )NcompressionrZ   rG   s    r%   compressorsHello.compressors   s    yy}}]++r'   c                :    U R                   R                  S/ 5      $ )zSupported authentication mechanisms for the current user.

For example::

    >>> hello.sasl_supported_mechs
    ["SCRAM-SHA-1", "SCRAM-SHA-256"]

saslSupportedMechsrZ   rG   s    r%   sasl_supported_mechsHello.sasl_supported_mechs   s     yy}}1266r'   c                8    U R                   R                  S5      $ )z"The speculativeAuthenticate field.speculativeAuthenticaterZ   rG   s    r%   speculative_authenticateHello.speculative_authenticate   s     yy}}677r'   c                8    U R                   R                  S5      $ )NtopologyVersionrZ   rG   s    r%   topology_versionHello.topology_version   s    yy}}.//r'   c                    U R                   $ r?   )r=   rG   s    r%   rB   Hello.awaitable   s    r'   c                8    U R                   R                  S5      $ )Nr   rZ   rG   s    r%   
service_idHello.service_id   s    yy}}[))r'   c                :    U R                   R                  SS5      $ )NhelloOkFrZ   rG   s    r%   hello_okHello.hello_ok   s    yy}}Y..r'   c                8    U R                   R                  S5      $ )NconnectionIdrZ   rG   s    r%   connection_idHello.connection_id   r   r'   )r=   r9   r<   r;   r:   N)F)r$   r   rB   boolreturnNone)r   r   )r   int)r   zset[tuple[str, int]])r   Mapping[str, Any])r   zOptional[tuple[str, int]])r   zOptional[str])r   zOptional[int])r   zOptional[ObjectId])r   zOptional[ClusterTime])r   r   )r   zOptional[datetime.datetime])r   zOptional[list[str]])r   z	list[str])r   zOptional[Mapping[str, Any]])$r.   r/   r0   r1   __doc__	__slots__rC   propertyrH   r@   rV   rY   r]   ra   rf   rk   rp   ru   r{   r   r   r   r   r   r   r   r   r   r   r   r   rB   r   r   r   r5   r-   r'   r%   r7   r7   A   s<   
 WI$ $ $ ! ! 
 
 ) )   ( ( H H M M O O H H H H + + + + - - = = ! ! ! !   C C , , 	7 	7 8 8 0 0   * * / / - -r'   r7   )r$   r   r   r   )r   
__future__r   rF   datetimerT   typingr   r   r   r   bson.objectidr   pymongor	   pymongo.server_typer
   pymongo.typingsr   r   r&   r   r7   r-   r'   r%   <module>r      sJ    9 "    2 2 "  + 6&8   _-GM" _-r'   