+
    8i:W                       R t ^ RIHt ^ RIt^ RIHt ^ RIHtHtH	t	H
t
Ht ^ RIHt ^ RIHt ^ RIHtHt ]'       d   ^ RIHt ^ R	IHt ^ t^t^t^t^tR(t]	]]3,          t]]	]]3,          ,          tR
 R ltR R lt R R lt!R R lt" ! R R4      t# ! R R]#4      t$ ! R R]#4      t% ! R R]#4      t& ! R R]#4      t' ! R R]#4      t( ! R R4      t)]$]%]&]'](3t*R)R  R! llt+R*t, ! R" R#4      t-R$ R% lt. ! R& R'4      t/R# )+zUtilities for choosing which member of a replica set to read from.

.. seealso:: This module is compatible with both the synchronous and asynchronous PyMongo APIs.
)annotationsN)abc)TYPE_CHECKINGAnyMappingOptionalSequence)max_staleness_selectors)ConfigurationError) member_with_tags_server_selector#secondary_with_tags_server_selector)	Selection)TopologyDescriptionc                    V ^8  d   QhRRRR/# )   tag_setsOptional[_TagSets]return )formats   "V/var/www/html/photoedit/myenv/lib/python3.14/site-packages/pymongo/read_preferences.py__annotate__r   9   s      !3 8J     c                .   V f   V # \        V \        \        34      '       g   \        RV : R24      h\	        V 4      ^ 8X  d   \        RV : R24      hV  F3  p\        V\        P                  4      '       d   K%  \        RV: R24      h	  \        V 4      # )z$Validate tag sets for a MongoClient.z	Tag sets z invalid, must be a sequencez: invalid, must be None or contain at least one set of tagszTag set zg invalid, must be an instance of dict, bson.son.SON or other type that inherits from collection.Mapping)
isinstancelisttuple	TypeErrorlen
ValueErrorr   r   )r   tagss   & r   _validate_tag_setsr!   9   s    hu..)H</KLMM
8}|#]^
 	
 $,,4( #% %   >r   c                    V ^8  d   QhRRRR/# )r   max_stalenessr   r   strr   )r   s   "r   r   r   P   s     T Tc Tc Tr   c                    R V ,          # )z6maxStalenessSeconds must be a positive integer, not %sr   r#   s   &r   _invalid_max_staleness_msgr'   P   s    CmSSr   c                    V ^8  d   QhRRRR/# )r   r#   r   r   intr   )r   s   "r   r   r   U   s      3 3 r   c                    V R8X  d   R# \        V \        4      '       g   \        \        V 4      4      hV ^ 8:  d   \	        \        V 4      4      hV # )zValidate max_staleness.)r   r)   r   r'   r   r&   s   &r   _validate_max_stalenessr,   U   sL    	mS))2=ABB3MBCCr   c                    V ^8  d   QhRRRR/# )r   hedgeOptional[_Hedge]r   r   )r   s   "r   r   r   c   s      + 0@ r   c                    V f   R# \        V \        4      '       g   \        RV : 24      h\        P                  ! R\
        ^R7       V # )zValidate hedge.Nz hedge must be a dictionary, not The read preference 'hedge' option is deprecated in PyMongo 4.12+ because hedged reads are deprecated in MongoDB version 8.0+. Support for 'hedge' will be removed in PyMongo 5.0.
stacklevel)r   dictr   warningswarnDeprecationWarning)r.   s   &r   _validate_hedger8   c   sI    }eT"":5)DEEMM 	}
 Lr   c                  &   ] tR t^stRtR"tR#R R llt]R R l4       t]R R l4       t	]R	 R
 l4       t
]R R l4       t]R R l4       t]R R l4       t]R R l4       t]R R l4       tR R ltR R ltR R ltR R ltR R ltR R  ltR!tR# )$_ServerModez$Base class for all read preferences.Nc          
     ,    V ^8  d   QhRRRRRRRRRR	/# )
r   moder)   r   r   r#   r.   r/   r   Noner   )r   s   "r   r   _ServerMode.__annotate__x   s<     . .. %. 	.
  . 
.r   c                	    \         V,          V n        Wn        \        V4      V n        \        V4      V n        \        V4      V n        R # N)	_MONGOS_MODES_ServerMode__mongos_mode_ServerMode__moder!   _ServerMode__tag_setsr,   _ServerMode__max_stalenessr8   _ServerMode__hedge)selfr<   r   r#   r.   s   &&&&&r   __init___ServerMode.__init__x   s;     +40,X66}E&u-r   c                   V ^8  d   QhRR/# r   r   r$   r   )r   s   "r   r   r>      s     ' 'c 'r   c                .    V P                   P                  # )z!The name of this read preference.)	__class____name__rG   s   &r   name_ServerMode.name   s     ~~&&&r   c                   V ^8  d   QhRR/# rK   r   )r   s   "r   r   r>      s     " "S "r   c                    V P                   # )z(The mongos mode of this read preference.)rB   rO   s   &r   mongos_mode_ServerMode.mongos_mode   s     !!!r   c                   V ^8  d   QhRR/# r   r   zdict[str, Any]r   )r   s   "r   r   r>      s     	 	. 	r   c                    RV P                   /pV P                  R/ .39  d   V P                  VR&   V P                  R8w  d   V P                  VR&   V P                  R/ 39  d   V P                  VR&   V# )zRead preference as a document.r<   Nr    maxStalenessSecondsr.   r+   )rB   rD   rE   rF   )rG   docs   & r   document_ServerMode.document   st      &t'9'9:??4",.//CK2%)-)=)=C%&<<bz)<<CL
r   c                   V ^8  d   QhRR/# r   r   r)   r   )r   s   "r   r   r>      s      c r   c                    V P                   # )z*The mode of this read preference instance.)rC   rO   s   &r   r<   _ServerMode.mode   s     {{r   c                   V ^8  d   QhRR/# )r   r   _TagSetsr   )r   s   "r   r   r>      s     B B( Br   c                V    V P                   '       d   \        V P                   4      # / .# )a  Set ``tag_sets`` to a list of dictionaries like [{'dc': 'ny'}] to
read only from members whose ``dc`` tag has the value ``"ny"``.
To specify a priority-order for tag sets, provide a list of
tag sets: ``[{'dc': 'ny'}, {'dc': 'la'}, {}]``. A final, empty tag
set, ``{}``, means "read from any member that matches the mode,
ignoring tags." MongoClient tries each set of tags in turn
until it finds a set of tags with at least one matching member.
For example, to only send a query to an analytic node::

   Nearest(tag_sets=[{"node":"analytics"}])

Or using :class:`SecondaryPreferred`::

   SecondaryPreferred(tag_sets=[{"node":"analytics"}])

   .. seealso:: `Data-Center Awareness
       <https://www.mongodb.com/docs/manual/data-center-awareness/>`_
)rD   r   rO   s   &r   r   _ServerMode.tag_sets   s"    ( )-tDOO$AbTAr   c                   V ^8  d   QhRR/# r^   r   )r   s   "r   r   r>      s     $ $s $r   c                    V P                   # )zThe maximum estimated length of time (in seconds) a replica set
secondary can fall behind the primary in replication before it will
no longer be selected for operations, or -1 for no maximum.
rE   rO   s   &r   r#   _ServerMode.max_staleness   s     ###r   c                   V ^8  d   QhRR/# )r   r   r/   r   )r   s   "r   r   r>      s      ' r   c                p    V P                   e   \        P                  ! R\        ^R7       V P                   # )a  **DEPRECATED** - The read preference 'hedge' option is deprecated in PyMongo 4.12+ because hedged reads are deprecated in MongoDB version 8.0+. Support for 'hedge' will be removed in PyMongo 5.0.

The read preference ``hedge`` parameter.

A dictionary that configures how the server will perform hedged reads.
It consists of the following keys:

- ``enabled``: Enables or disables hedged reads in sharded clusters.

Hedged reads are automatically enabled in MongoDB 4.4+ when using a
``nearest`` read preference. To explicitly enable hedged reads, set
the ``enabled`` key  to ``true``::

    >>> Nearest(hedge={'enabled': True})

To explicitly disable hedged reads, set the ``enabled`` key  to
``False``::

    >>> Nearest(hedge={'enabled': False})

.. versionadded:: 3.11
r1   r2   )rF   r5   r6   r7   rO   s   &r   r.   _ServerMode.hedge   s2    0 <<#MM E"
 ||r   c                   V ^8  d   QhRR/# r^   r   )r   s   "r   r   r>      s     
6 
6# 
6r   c                ,    V P                   R8X  d   ^ # ^# )aR  The wire protocol version the server must support.

Some read preferences impose version requirements on all servers (e.g.
maxStalenessSeconds requires MongoDB 3.4 / maxWireVersion 5).

All servers' maxWireVersion must be at least this read preference's
`min_wire_version`, or the driver raises
:exc:`~pymongo.errors.ConfigurationError`.
r+   rg   rO   s   &r   min_wire_version_ServerMode.min_wire_version   s     ((B.q5A5r   c                   V ^8  d   QhRR/# rK   r   )r   s   "r   r   r>      s     
 
# 
r   c                	z    R P                  V P                  V P                  V P                  V P                  4      # )z1{}(tag_sets={!r}, max_staleness={!r}, hedge={!r}))r   rP   rD   rE   rF   rO   s   &r   __repr___ServerMode.__repr__   s3    BIIIIOO  LL	
 	
r   c                    V ^8  d   QhRRRR/# r   otherr   r   boolr   )r   s   "r   r   r>      s      C D r   c                	2   \        V\        4      '       d}   V P                  VP                  8H  ;'       d\    V P                  VP                  8H  ;'       d;    V P                  VP                  8H  ;'       d    V P
                  VP
                  8H  # \        # r@   )r   r:   r<   r   r#   r.   NotImplementedrG   rv   s   &&r   __eq___ServerMode.__eq__   s    e[))		UZZ' . .MMU^^3. .&&%*=*==. . JJ%++-	 r   c                    V ^8  d   QhRRRR/# ru   r   )r   s   "r   r   r>      s     ! !C !D !r   c                	    W8X  * # r@   r   rz   s   &&r   __ne___ServerMode.__ne__   s      r   c                   V ^8  d   QhRR/# rW   r   )r   s   "r   r   r>      s     

 

n 

r   c                f    RV P                   RV P                  RV P                  RV P                  /# )zUReturn value of object for pickling.

Needed explicitly because __slots__() defined.
r<   r   r#   r.   )rC   rD   rE   rF   rO   s   &r   __getstate___ServerMode.__getstate__   s4     DKKT11T\\	
 	
r   c                    V ^8  d   QhRRRR/# )r   valuezMapping[str, Any]r   r=   r   )r   s   "r   r   r>     s     7 7"3 7 7r   c                    VR,          V n         \        V P                   ,          V n        \        VR,          4      V n        \        VR,          4      V n        \        VR,          4      V n        R# )zRestore from pickling.r<   r   r#   r.   N)	rC   rA   rB   r!   rD   r,   rE   r8   rF   )rG   r   s   &&r   __setstate___ServerMode.__setstate__  sQ    Fm*4;;7,U:->?6u_7MN&uW~6r   c                    V ^8  d   QhRRRR/# r   	selectionr   r   r   )r   s   "r   r   r>     s      ) 	 r   c                	    V# r@   r   rG   r   s   &&r   __call___ServerMode.__call__  s    r   )__hedge__max_staleness__mode__mongos_mode
__tag_sets)r   r   r   r   r   Nr+   N)rN   
__module____qualname____firstlineno____doc__	__slots__rH   propertyrP   rT   r[   r<   r   r#   r.   rn   rr   r{   r   r   r   r   __static_attributes__r   r   r   r:   r:   s   s    .WI. ' ' " " 	 	   B B* $ $  > 
6 
6
!

7 r   r:   c                  Z   a  ] tR tRtRtRtR V 3R lltR R ltR R ltR	 R
 lt	Rt
V ;t# )Primaryi  a/  Primary read preference.

* When directly connected to one mongod queries are allowed if the server
  is standalone or a replica set primary.
* When connected to a mongos queries are sent to the primary of a shard.
* When connected to a replica set queries are sent to the primary of
  the replica set.
c                   V ^8  d   QhRR/# r   r   r=   r   )r   s   "r   r   Primary.__annotate__$  s     # #$ #r   c                	.   < \         SV `  \        4       R # r@   )superrH   _PRIMARY)rG   rM   s   &r   rH   Primary.__init__$  s    "r   c                    V ^8  d   QhRRRR/# r   r   )r   s   "r   r   r   '  s     + +) +	 +r   c                    VP                   # z*Apply this read preference to a Selection.)primary_selectionr   s   &&r   r   Primary.__call__'  s    ***r   c                   V ^8  d   QhRR/# rK   r   )r   s   "r   r   r   +  s      # r   c                	    R # )z	Primary()r   rO   s   &r   rr   Primary.__repr__+  s    r   c                    V ^8  d   QhRRRR/# ru   r   )r   s   "r   r   r   .  s      C D r   c                	`    \        V\        4      '       d   VP                  \        8H  # \        # r@   )r   r:   r<   r   ry   rz   s   &&r   r{   Primary.__eq__.  s$    e[))::))r   r   )rN   r   r   r   r   r   rH   r   rr   r{   r   __classcell__rM   s   @r   r   r     s-     I# #+ r   r   c                  F   a  ] tR tRtRtRtRR V 3R llltR R ltRtV ;t	# )	PrimaryPreferredi4  aC  PrimaryPreferred read preference.

* When directly connected to one mongod queries are allowed to standalone
  servers, to a replica set primary, or to replica set secondaries.
* When connected to a mongos queries are sent to the primary of a shard if
  available, otherwise a shard secondary.
* When connected to a replica set queries are sent to the primary if
  available, otherwise a secondary.

.. note:: When a :class:`~pymongo.mongo_client.MongoClient` is first
  created reads will be routed to an available secondary until the
  primary of the replica set is discovered.

:param tag_sets: The :attr:`~tag_sets` to use if the primary is not
    available.
:param max_staleness: (integer, in seconds) The maximum estimated
    length of time a replica set secondary can fall behind the primary in
    replication before it will no longer be selected for operations.
    Default -1, meaning no maximum. If it is set, it must be at least
    90 seconds.
:param hedge: **DEPRECATED** - The :attr:`~hedge` for this read preference.

.. versionchanged:: 3.11
   Added ``hedge`` parameter.
c               (    V ^8  d   QhRRRRRRRR/# 	r   r   r   r#   r)   r.   r/   r   r=   r   )r   s   "r   r   PrimaryPreferred.__annotate__Q  s8     M M$M M  	M
 
Mr   c                	2   < \         SV `  \        WV4       R # r@   )r   rH   _PRIMARY_PREFERREDrG   r   r#   r.   rM   s   &&&&r   rH   PrimaryPreferred.__init__Q  s     	+XeLr   c                    V ^8  d   QhRRRR/# r   r   )r   s   "r   r   r   Y  s      ) 	 r   c                    VP                   '       d   VP                  # \        V P                  \        P
                  ! V P                  V4      4      # z(Apply this read preference to Selection.)primaryr   r   r   r	   selectr#   r   s   &&r   r   PrimaryPreferred.__call__Y  sE    ...66==d>P>PR[\ r   r   r   
rN   r   r   r   r   r   rH   r   r   r   r   s   @r   r   r   4  s%    4 IM M r   r   c                  F   a  ] tR tRtRtRtRR V 3R llltR R ltRtV ;t	# )		Secondaryic  a  Secondary read preference.

* When directly connected to one mongod queries are allowed to standalone
  servers, to a replica set primary, or to replica set secondaries.
* When connected to a mongos queries are distributed among shard
  secondaries. An error is raised if no secondaries are available.
* When connected to a replica set queries are distributed among
  secondaries. An error is raised if no secondaries are available.

:param tag_sets: The :attr:`~tag_sets` for this read preference.
:param max_staleness: (integer, in seconds) The maximum estimated
    length of time a replica set secondary can fall behind the primary in
    replication before it will no longer be selected for operations.
    Default -1, meaning no maximum. If it is set, it must be at least
    90 seconds.
:param hedge: **DEPRECATED** - The :attr:`~hedge` for this read preference.

.. versionchanged:: 3.11
   Added ``hedge`` parameter.
c               (    V ^8  d   QhRRRRRRRR/# r   r   )r   s   "r   r   Secondary.__annotate__{  s8     E E$E E  	E
 
Er   c                	2   < \         SV `  \        WV4       R # r@   )r   rH   
_SECONDARYr   s   &&&&r   rH   Secondary.__init__{  s     	XeDr   c                    V ^8  d   QhRRRR/# r   r   )r   s   "r   r   r          
 
) 
	 
r   c                l    \        V P                  \        P                  ! V P                  V4      4      # r   )r   r   r	   r   r#   r   s   &&r   r   Secondary.__call__  s,    2MM299$:L:LiX
 	
r   r   r   r   r   s   @r   r   r   c  s%    * IE E
 
r   r   c                  F   a  ] tR tRtRtRtRR V 3R llltR R ltRtV ;t	# )	SecondaryPreferredi  aT  SecondaryPreferred read preference.

* When directly connected to one mongod queries are allowed to standalone
  servers, to a replica set primary, or to replica set secondaries.
* When connected to a mongos queries are distributed among shard
  secondaries, or the shard primary if no secondary is available.
* When connected to a replica set queries are distributed among
  secondaries, or the primary if no secondary is available.

.. note:: When a :class:`~pymongo.mongo_client.MongoClient` is first
  created reads will be routed to the primary of the replica set until
  an available secondary is discovered.

:param tag_sets: The :attr:`~tag_sets` for this read preference.
:param max_staleness: (integer, in seconds) The maximum estimated
    length of time a replica set secondary can fall behind the primary in
    replication before it will no longer be selected for operations.
    Default -1, meaning no maximum. If it is set, it must be at least
    90 seconds.
:param hedge: **DEPRECATED** - The :attr:`~hedge` for this read preference.

.. versionchanged:: 3.11
   Added ``hedge`` parameter.
c               (    V ^8  d   QhRRRRRRRR/# r   r   )r   s   "r   r   SecondaryPreferred.__annotate__  s8     O O$O O  	O
 
Or   c                	2   < \         SV `  \        WV4       R # r@   )r   rH   _SECONDARY_PREFERREDr   s   &&&&r   rH   SecondaryPreferred.__init__  s     	-xNr   c                    V ^8  d   QhRRRR/# r   r   )r   s   "r   r   r     s     	/ 	/) 	/	 	/r   c                    \        V P                  \        P                  ! V P                  V4      4      pV'       d   V# VP
                  # r   )r   r   r	   r   r#   r   )rG   r   secondariess   && r   r   SecondaryPreferred.__call__  s@    9MM299$:L:LiX
 ...r   r   r   r   r   s   @r   r   r     s%    2 IO O	/ 	/r   r   c                  F   a  ] tR tRtRtRtRR V 3R llltR R ltRtV ;t	# )	Nearesti  a9  Nearest read preference.

* When directly connected to one mongod queries are allowed to standalone
  servers, to a replica set primary, or to replica set secondaries.
* When connected to a mongos queries are distributed among all members of
  a shard.
* When connected to a replica set queries are distributed among all
  members.

:param tag_sets: The :attr:`~tag_sets` for this read preference.
:param max_staleness: (integer, in seconds) The maximum estimated
    length of time a replica set secondary can fall behind the primary in
    replication before it will no longer be selected for operations.
    Default -1, meaning no maximum. If it is set, it must be at least
    90 seconds.
:param hedge: **DEPRECATED** - The :attr:`~hedge` for this read preference.

.. versionchanged:: 3.11
   Added ``hedge`` parameter.
c               (    V ^8  d   QhRRRRRRRR/# r   r   )r   s   "r   r   Nearest.__annotate__  s8     C C$C C  	C
 
Cr   c                	2   < \         SV `  \        WV4       R # r@   )r   rH   _NEARESTr   s   &&&&r   rH   Nearest.__init__  s     	8EBr   c                    V ^8  d   QhRRRR/# r   r   )r   s   "r   r   r     r   r   c                l    \        V P                  \        P                  ! V P                  V4      4      # r   )r   r   r	   r   r#   r   s   &&r   r   Nearest.__call__  s,    /MM299$:L:LiX
 	
r   r   r   r   r   s   @r   r   r     s%    * IC C
 
r   r   c                  Z    ] tR tRtRtRtR R ltR R ltR R ltR	 R
 lt	R R lt
RtR# )_AggWritePrefi  zAgg $out/$merge write preference.

* If there are readable servers and there is any pre-5.0 server, use
  primary read preference.
* Otherwise use `pref` read preference.

:param pref: The read preference to use on MongoDB 5.0+.
c                   V ^8  d   QhRR/# )r   prefr:   r   )r   s   "r   r   _AggWritePref.__annotate__  s     B B[ Br   c                	<    Wn         \        P                  V n        R # r@   )r   ReadPreferencePRIMARYeffective_pref)rG   r   s   &&r   rH   _AggWritePref.__init__  s    	+9+A+Ar   c                    V ^8  d   QhRRRR/# )r   topology_descriptionr   r   r=   r   )r   s   "r   r   r     s     	, 	,3F 	,4 	,r   c                	    VP                   pVP                  \        P                  4      '       d'   V'       d   V^8  d   \        P                  V n        R# V P                  V n        R# )   N)common_wire_versionhas_readable_serverr   PRIMARY_PREFERREDr   r   r   )rG   r   	common_wvs   && r   selection_hook_AggWritePref.selection_hook  sH    (<<	 44^5U5UVVB"0"8"8D"&))Dr   c                    V ^8  d   QhRRRR/# r   r   )r   s   "r   r   r     s     . .) .	 .r   c                $    V P                  V4      # r   )r   r   s   &&r   r   _AggWritePref.__call__  s    ""9--r   c                   V ^8  d   QhRR/# rK   r   )r   s   "r   r   r      s     4 4# 4r   c                	$    R V P                   : R2# )z_AggWritePref(pref=))r   rO   s   &r   rr   _AggWritePref.__repr__   s    $TYYM33r   c                    V ^8  d   QhRRRR/# )r   rP   r$   r   r   r   )r   s   "r   r   r     s     2 2 2 2r   c                	.    \        V P                  V4      # r@   )getattrr   )rG   rP   s   &&r   __getattr___AggWritePref.__getattr__  s    t**D11r   )r   r   N)r   r   )rN   r   r   r   r   r   rH   r   r   rr   r  r   r   r   r   r   r     s-     +IB	,.4
2 2r   r   c               (    V ^8  d   QhRRRRRRRR/# )r   r<   r)   r   r   r#   r   r:   r   )r   s   "r   r   r     s2     @ @
@+@<?@@r   c                    V \         8X  d2   VR / .39  d   \        R4      hVR8w  d   \        R4      h\        4       # \        V ,          ! W4      # )Nz4Read preference primary cannot be combined with tagszCRead preference primary cannot be combined with maxStalenessSecondsr+   )r   r
   r   _ALL_READ_PREFERENCES)r<   r   r#   s   &&&r   make_read_preferencer    sX     xD2$<'$%[\\B$U  y &x??r   c                  `    ] tR tRtRt]! 4       t]! 4       t]	! 4       t
]! 4       t]! 4       tRtR# )r   i#  a  An enum that defines some commonly used read preference modes.

Apps can also create a custom read preference, for example::

   Nearest(tag_sets=[{"node":"analytics"}])

See `Read and Write Settings <https://www.mongodb.com/docs/languages/python/pymongo-driver/current/crud/configure/#read-and-write-settings>`_ for code examples.

A read preference is used in three cases:

:class:`~pymongo.mongo_client.MongoClient` connected to a single mongod:

- ``PRIMARY``: Queries are allowed if the server is standalone or a replica
  set primary.
- All other modes allow queries to standalone servers, to a replica set
  primary, or to replica set secondaries.

:class:`~pymongo.mongo_client.MongoClient` initialized with the
``replicaSet`` option:

- ``PRIMARY``: Read from the primary. This is the default, and provides the
  strongest consistency. If no primary is available, raise
  :class:`~pymongo.errors.AutoReconnect`.

- ``PRIMARY_PREFERRED``: Read from the primary if available, or if there is
  none, read from a secondary.

- ``SECONDARY``: Read from a secondary. If no secondary is available,
  raise :class:`~pymongo.errors.AutoReconnect`.

- ``SECONDARY_PREFERRED``: Read from a secondary if available, otherwise
  from the primary.

- ``NEAREST``: Read from any member.

:class:`~pymongo.mongo_client.MongoClient` connected to a mongos, with a
sharded cluster of replica sets:

- ``PRIMARY``: Read from the primary of the shard, or raise
  :class:`~pymongo.errors.OperationFailure` if there is none.
  This is the default.

- ``PRIMARY_PREFERRED``: Read from the primary of the shard, or if there is
  none, read from a secondary of the shard.

- ``SECONDARY``: Read from a secondary of the shard, or raise
  :class:`~pymongo.errors.OperationFailure` if there is none.

- ``SECONDARY_PREFERRED``: Read from a secondary of the shard if available,
  otherwise from the shard primary.

- ``NEAREST``: Read from any shard member.
r   N)rN   r   r   r   r   r   r   r   r   r   	SECONDARYr   SECONDARY_PREFERREDr   NEARESTr   r   r   r   r   r   #  s1    4l iG(*I,.iGr   r   c                    V ^8  d   QhRRRR/# )r   rP   r$   r   r)   r   )r   s   "r   r   r   a  s     % %3 %3 %r   c                ,    \         P                  V 4      # )z2Get the read preference mode from mongos/uri name.)rA   index)rP   s   &r   read_pref_mode_from_namer  a  s    t$$r   c                  V    ] tR tRt$ RtR]R&   R R ltR R ltR	 R
 ltR R lt	Rt
R# )MovingAverageif  z0Tracks an exponentially-weighted moving average.Optional[float]averagec                   V ^8  d   QhRR/# r   r   )r   s   "r   r   MovingAverage.__annotate__k  s      $ r   c                	    R V n         R # r@   r  rO   s   &r   rH   MovingAverage.__init__k  	    r   c                    V ^8  d   QhRRRR/# )r   samplefloatr   r=   r   )r   s   "r   r   r  n  s     = = =4 =r   c                	    V^ 8  d   \        RV 24      hV P                  f	   Wn        R# RV P                  ,          RV,          ,           V n        R# )    zduration cannot be negative Ng?g?)r   r  )rG   r  s   &&r   
add_sampleMovingAverage.add_samplen  sF    A:;F8DEE<<!L -f<DLr   c                   V ^8  d   QhRR/# )r   r   r  r   )r   s   "r   r   r  x  s      _ r   c                    V P                   # )z6Get the calculated average, or None if no samples yet.r  rO   s   &r   getMovingAverage.getx  s    ||r   c                   V ^8  d   QhRR/# r   r   )r   s   "r   r   r  |  s      t r   c                	    R V n         R # r@   r  rO   s   &r   resetMovingAverage.reset|  r  r   r  N)rN   r   r   r   r   __annotations__rH   r  r#  r'  r   r   r   r   r  r  f  s$    := r   r  )r   primaryPreferred	secondarysecondaryPreferrednearest)r+   )r   r   r	  r
  r  )0r   
__future__r   r5   collectionsr   typingr   r   r   r   r   pymongor	   pymongo.errorsr
   pymongo.server_selectorsr   r   r   pymongo.topology_descriptionr   r   r   r   r   r   rA   r$   _Hedgerb   r!   r'   r,   r8   r:   r   r   r   r   r   r   r  r  _MODESr   r  r  r   r   r   <module>r7     s"  
 #   B B + -
 2@  
  
c	GCH%&.T
 b bJk 8,{ ,^$
 $
N-/ -/`$
k $
N%2 %2P !"2I?QSZ[ @
; ;|%
 r   