+
    4O|j·Y  ã                  ó  € 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# )+z¤Utilities 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   "ÚQC:\Users\alokc\chatbot\backend\venv\Lib\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   € ØCÀmÕ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   € à˜ÔØˆ	ä�m¤S×)Ò)ÜÔ2°=ÓAÓBÐBà˜ÔÜÔ3°MÓ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   € à‚}Ùä�eœT×"Ò"ÜÐ:¸5¹)ÐDÓEÐEä‡M‚Mð 	}ÜØõð
 €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Ð%Ñ&Ø�<‰<  b˜zÔ)ØŸ<™<ˆ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"   € ð( )-¯¯¨Œt�D—O‘OÓ$ÐA¸b¸TÐAr   c               ó   € V ^8„  d   QhRR/# r^   r   )r   s   "r   r   r>   ·   s   € ÷ $ñ $˜sñ $r   c                ó   € V P                   # )zÀThe 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 �<‰<Ò#Ü�MŠMð 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Ð5°AÐ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Ø�I‰IØ�O‰OØ× Ñ Ø�L‰Ló	
ð 	
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œ[×)Ò)à—	‘	˜UŸZ™ZÑ'÷ .ð .Ø—M‘M U§^¡^Ñ3÷.ð .à×&Ñ&¨%×*=Ñ*=Ñ=÷.ð .ð —J‘J %§+¡+Ñ-ð	ô Ð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   € ð �D—K‘KØ˜Ÿ™Ø˜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   € à˜F•mˆŒÜ*¨4¯;©;Õ7ˆÔÜ,¨U°:Õ->Ó?ˆŒÜ6°u¸_Õ7MÓNˆÔÜ& u¨W¥~Ó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Ô   † Ù.àW€I÷.ð ô'ó ð'ð ô"ó ð"ð ô	ó ð	ð ôó ðð ô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   ø€ ô 	‰ÑÔ+¨XÀeÖ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Ñ>PÐR[Ó\óð 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   ø€ ô 	‰Ñœ X¸eÖ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Ø�M‰MÔ2×9Ò9¸$×:LÑ:LÈiÓ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Ø�M‰MÔ2×9Ò9¸$×:LÑ:LÈiÓ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   ø€ ô 	‰Ñœ 8¸EÖ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,   € ä/Ø�M‰MÔ2×9Ò9¸$×:LÑ:LÈiÓ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á  zåAgg $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´^×5UÑ5U×VÒVßØ˜B”ä"0×"8Ñ"8ˆDÖà"&§)¡)ˆ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   € Ø$ T§Y¡Y¡M°Ð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ÔØ˜D 2 $˜<Ô'Ü$Ð%[Ó\Ð\Ø˜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 ‹i€GÙ(Ó*ÐÙ“€IÙ,Ó.ÐÙ‹i„Gr   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Œ:ÜÐ;¸F¸8ÐDÓEÐEØ�<‰<ÒØ!ŽLð  §¡Õ-°°fµÕ<ˆDŽLr   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�Õ	€Ø�G˜C ˜HÕ%Õ&€õõ.Tõ
õ÷ bñ bôJˆkô ô8,�{ô ,ô^$
�ô $
ôN-/˜ô -/ô`$
ˆkô $
÷N%2ñ %2ðP !Ð"2°IÐ?QÐSZÐ[Ð ÷@ð
€÷;ñ ;õ|%÷
ó r   