Ë
    Ü_Ëi:W  ã                  óÔ  — d Z ddlmZ ddlZddlmZ ddlmZmZm	Z	m
Z
mZ ddlmZ ddlmZ ddlmZmZ erdd	lmZ dd
lmZ dZdZdZdZdZdZe	eef   Zee	eef      Zd)d„Zd*d„Z d+d„Z!d,d„Z" G d„ d«      Z# G d„ de#«      Z$ G d„ de#«      Z% G d„ de#«      Z& G d„ de#«      Z' G d„ de#«      Z( G d „ d!«      Z)e$e%e&e'e(fZ*	 d-	 	 	 	 	 	 	 d.d"„Z+d#Z, G d$„ d%«      Z-d/d&„Z. G d'„ d(«      Z/y)0z¤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)ÚTopologyDescriptioné   é   é   é   )ÚprimaryÚprimaryPreferredÚ	secondaryÚsecondaryPreferredÚnearestc                ó  — | €| S t        | t        t        f«      st        d| ›d�«      ‚t	        | «      dk(  rt        d| ›d�«      ‚| D ]+  }t        |t        j                  «      rŒt        d|›d�«      ‚ t        | «      S )z$Validate tag sets for a MongoClient.z	Tag sets z invalid, must be a sequencer   z: 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   )Útag_setsÚtagss     ú[/var/www/pod-logistic/pod-api/venv/lib/python3.12/site-packages/pymongo/read_preferences.pyÚ_validate_tag_setsr#   9   sŸ   € àÐØˆä�h¤¤u Ô.Ü˜) H <Ð/KÐLÓMÐMÜ
ˆ8ƒ}˜ÒÜØ˜�|Ð#]Ð^ó
ð 	
ð ò ˆÜ˜$¤§¡Õ,ÜØ˜4˜(ð #%ð %óð ðô �‹>Ðó    c                ó   — d| z  S )Nz6maxStalenessSeconds must be a positive integer, not %s© ©Úmax_stalenesss    r"   Ú_invalid_max_staleness_msgr)   P   s   € ØCÀmÑSÐSr$   c                óŒ   — | dk(  ryt        | t        «      st        t        | «      «      ‚| dk  rt	        t        | «      «      ‚| S )zValidate max_staleness.éÿÿÿÿr   )r   Úintr   r)   r   r'   s    r"   Ú_validate_max_stalenessr-   U   sG   € à˜ÒØä�m¤SÔ)ÜÔ2°=ÓAÓBÐBà˜ÒÜÔ3°MÓBÓCÐCàÐr$   c                ó€   — | €yt        | t        «      st        d| ›�«      ‚t        j                  dt
        d¬«       | S )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.r   ©Ú
stacklevel)r   Údictr   ÚwarningsÚwarnÚDeprecationWarning)Úhedges    r"   Ú_validate_hedger7   c   sF   € à€}Øä�eœTÔ"ÜÐ:¸5¸)ÐDÓEÐEä‡M�Mð 	}ÜØõð
 €Lr$   c                  óö   — e Zd ZdZdZ	 	 	 d	 	 	 	 	 	 	 	 	 dd„Zedd„«       Zedd„«       Zedd„«       Z	edd„«       Z
edd	„«       Zedd
„«       Zedd„«       Zedd„«       Zdd„Zdd„Zdd„Zdd„Zdd„Zdd„Zy)Ú_ServerModez$Base class for all read preferences.)Ú__mongos_modeÚ__modeÚ
__tag_setsÚ__max_stalenessÚ__hedgeNc                óŽ   — t         |   | _        || _        t        |«      | _        t        |«      | _        t        |«      | _        y ©N)	Ú_MONGOS_MODESÚ_ServerMode__mongos_modeÚ_ServerMode__moder#   Ú_ServerMode__tag_setsr-   Ú_ServerMode__max_stalenessr7   Ú_ServerMode__hedge)ÚselfÚmoder    r(   r6   s        r"   Ú__init__z_ServerMode.__init__x   s=   € ô +¨4Ñ0ˆÔØˆŒÜ,¨XÓ6ˆŒÜ6°}ÓEˆÔÜ& uÓ-ˆ�r$   c                ó.   — | j                   j                  S )z!The name of this read preference.)Ú	__class__Ú__name__©rG   s    r"   Únamez_ServerMode.name…   s   € ð �~‰~×&Ñ&Ð&r$   c                ó   — | j                   S )z(The mongos mode of this read preference.)rB   rM   s    r"   Úmongos_modez_ServerMode.mongos_modeŠ   s   € ð ×!Ñ!Ð!r$   c                óÜ   — d| j                   i}| j                  di gfvr| j                  |d<   | j                  dk7  r| j                  |d<   | j                  di fvr| j                  |d<   |S )zRead preference as a document.rH   Nr!   r+   ÚmaxStalenessSecondsr6   )rB   rD   rE   rF   )rG   Údocs     r"   Údocumentz_ServerMode.document�   st   € ð  & t×'9Ñ'9Ð:ˆØ�?‰? 4¨"¨ ,Ñ.ØŸ/™/ˆC�‰KØ×Ñ 2Ò%Ø)-×)=Ñ)=ˆCÐ%Ñ&Ø�<‰<  b˜zÑ)ØŸ<™<ˆC�‰LØˆ
r$   c                ó   — | j                   S )z*The mode of this read preference instance.)rC   rM   s    r"   rH   z_ServerMode.mode›   s   € ð �{‰{Ðr$   c                óJ   — | j                   rt        | j                   «      S i gS )aW  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   rM   s    r"   r    z_ServerMode.tag_sets    s    € ð( )-¯ªŒt�D—O‘OÓ$ÐA¸b¸TÐAr$   c                ó   — | j                   S )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   rM   s    r"   r(   z_ServerMode.max_staleness¶   s   € ð ×#Ñ#Ð#r$   c                ój   — | j                   �t        j                  dt        d¬«       | j                   S )am  **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
        r/   r   r0   )rF   r3   r4   r5   rM   s    r"   r6   z_ServerMode.hedge¾   s2   € ð0 �<‰<Ð#Ü�M‰Mð EÜ"Øõð
 �|‰|Ðr$   c                ó(   — | j                   dk(  rdS dS )a‚  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+   r   é   rX   rM   s    r"   Úmin_wire_versionz_ServerMode.min_wire_versionÞ   s   € ð ×(Ñ(¨BÒ.ˆqÐ5°AÐ5r$   c                óz   — dj                  | j                  | j                  | j                  | j                  «      S )Nz1{}(tag_sets={!r}, max_staleness={!r}, hedge={!r}))ÚformatrN   rD   rE   rF   rM   s    r"   Ú__repr__z_ServerMode.__repr__ë   s3   € ØB×IÑIØ�I‰IØ�O‰OØ× Ñ Ø�L‰Ló	
ð 	
r$   c                ó  — t        |t        «      rj| j                  |j                  k(  xrO | j                  |j                  k(  xr4 | j                  |j                  k(  xr | j
                  |j
                  k(  S t        S r@   )r   r9   rH   r    r(   r6   ÚNotImplemented©rG   Úothers     r"   Ú__eq__z_ServerMode.__eq__ó   sn   € Ü�eœ[Ô)à—	‘	˜UŸZ™ZÑ'ò .Ø—M‘M U§^¡^Ñ3ò.à×&Ñ&¨%×*=Ñ*=Ñ=ò.ð —J‘J %§+¡+Ñ-ð	ô Ðr$   c                ó   — | |k(   S r@   r&   rb   s     r"   Ú__ne__z_ServerMode.__ne__ý   s   € Ø˜5‘=Ð Ð r$   c                ó`   — | j                   | j                  | j                  | j                  dœS )zeReturn value of object for pickling.

        Needed explicitly because __slots__() defined.
        )rH   r    r(   r6   )rC   rD   rE   rF   rM   s    r"   Ú__getstate__z_ServerMode.__getstate__   s,   € ð —K‘KØŸ™Ø!×1Ñ1Ø—\‘\ñ	
ð 	
r$   c                óº   — |d   | _         t        | j                      | _        t        |d   «      | _        t        |d   «      | _        t        |d   «      | _        y)zRestore from pickling.rH   r    r(   r6   N)	rC   rA   rB   r#   rD   r-   rE   r7   rF   )rG   Úvalues     r"   Ú__setstate__z_ServerMode.__setstate__  sQ   € à˜F‘mˆŒÜ*¨4¯;©;Ñ7ˆÔÜ,¨U°:Ñ->Ó?ˆŒÜ6°u¸_Ñ7MÓNˆÔÜ& u¨W¡~Ó6ˆ�r$   c                ó   — |S r@   r&   ©rG   Ú	selections     r"   Ú__call__z_ServerMode.__call__  s   € ØÐr$   ©Nr+   N)
rH   r,   r    úOptional[_TagSets]r(   r,   r6   úOptional[_Hedge]ÚreturnÚNone©rs   Ústr)rs   zdict[str, Any])rs   r,   )rs   Ú_TagSets)rs   rr   ©rc   r   rs   Úbool)rj   zMapping[str, Any]rs   rt   ©rn   r   rs   r   )rL   Ú
__module__Ú__qualname__Ú__doc__Ú	__slots__rI   ÚpropertyrN   rP   rT   rH   r    r(   r6   r\   r_   rd   rf   rh   rk   ro   r&   r$   r"   r9   r9   s   s
  „ Ù.àW€Ið
 (,ØØ"&ð.àð.ð %ð.ð ð	.ð
  ð.ð 
ó.ð ò'ó ð'ð ò"ó ð"ð ò	ó ð	ð òó ðð òBó ðBð* ò$ó ð$ð òó ðð> ò
6ó ð
6ó
óó!ó

ó7ôr$   r9   c                  ó@   ‡ — e Zd ZdZdZdˆ fd„Zdd„Zd	d„Zd
d„Zˆ xZ	S )ÚPrimaryaG  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.
    r&   c                ó,   •— t         ‰| �  t        «       y r@   )ÚsuperrI   Ú_PRIMARY)rG   rK   s    €r"   rI   zPrimary.__init__$  s   ø€ Ü‰ÑœÕ"r$   c                ó   — |j                   S ©z*Apply this read preference to a Selection.)Úprimary_selectionrm   s     r"   ro   zPrimary.__call__'  s   € à×*Ñ*Ð*r$   c                 ó   — y)Nz	Primary()r&   rM   s    r"   r_   zPrimary.__repr__+  s   € Ør$   c                óT   — t        |t        «      r|j                  t        k(  S t        S r@   )r   r9   rH   r„   ra   rb   s     r"   rd   zPrimary.__eq__.  s!   € Ü�eœ[Ô)Ø—:‘:¤Ñ)Ð)ÜÐr$   ©rs   rt   rz   ru   rx   )
rL   r{   r|   r}   r~   rI   ro   r_   rd   Ú__classcell__©rK   s   @r"   r�   r�     s#   ø„ ñð €Iõ#ó+ó÷r$   r�   c                  óF   ‡ — e Zd ZdZdZ	 	 	 d	 	 	 	 	 	 	 dˆ fd„Zdd„Zˆ xZS )ÚPrimaryPreferreda“  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.
    r&   c                ó2   •— t         ‰| �  t        |||«       y r@   )rƒ   rI   Ú_PRIMARY_PREFERRED©rG   r    r(   r6   rK   s       €r"   rI   zPrimaryPreferred.__init__Q  s   ø€ ô 	‰ÑÔ+¨X°}ÀeÕLr$   c                óš   — |j                   r|j                  S t        | j                  t	        j
                  | j                  |«      «      S ©z(Apply this read preference to Selection.)r   r‡   r   r    r
   Úselectr(   rm   s     r"   ro   zPrimaryPreferred.__call__Y  sB   € à×ÒØ×.Ñ.Ð.ä6Ø—‘Ô6×=Ñ=¸d×>PÑ>PÐR[Ó\óð r$   rp   ©r    rq   r(   r,   r6   rr   rs   rt   rz   ©rL   r{   r|   r}   r~   rI   ro   r‹   rŒ   s   @r"   rŽ   rŽ   4  sO   ø„ ñð4 €Ið (,ØØ"&ð	Mà$ðMð ðMð  ð	Mð
 
õM÷r$   rŽ   c                  óF   ‡ — e Zd ZdZdZ	 	 	 d	 	 	 	 	 	 	 dˆ fd„Zdd„Zˆ xZS )Ú	SecondaryaÞ  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.
    r&   c                ó2   •— t         ‰| �  t        |||«       y r@   )rƒ   rI   Ú
_SECONDARYr‘   s       €r"   rI   zSecondary.__init__{  s   ø€ ô 	‰Ñœ X¨}¸eÕDr$   c                ój   — t        | j                  t        j                  | j                  |«      «      S r“   )r   r    r
   r”   r(   rm   s     r"   ro   zSecondary.__call__ƒ  s,   € ä2Ø�M‰MÔ2×9Ñ9¸$×:LÑ:LÈiÓXó
ð 	
r$   rp   r•   rz   r–   rŒ   s   @r"   r˜   r˜   c  sO   ø„ ñð* €Ið (,ØØ"&ð	Eà$ðEð ðEð  ð	Eð
 
õE÷
r$   r˜   c                  óF   ‡ — e Zd ZdZdZ	 	 	 d	 	 	 	 	 	 	 dˆ fd„Zdd„Zˆ xZS )ÚSecondaryPreferreda   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.
    r&   c                ó2   •— t         ‰| �  t        |||«       y r@   )rƒ   rI   Ú_SECONDARY_PREFERREDr‘   s       €r"   rI   zSecondaryPreferred.__init__¦  s   ø€ ô 	‰ÑÔ-¨x¸ÈÕNr$   c                óŠ   — t        | j                  t        j                  | j                  |«      «      }|r|S |j
                  S r“   )r   r    r
   r”   r(   r‡   )rG   rn   Úsecondariess      r"   ro   zSecondaryPreferred.__call__®  s@   € ä9Ø�M‰MÔ2×9Ñ9¸$×:LÑ:LÈiÓXó
ˆñ ØÐà×.Ñ.Ð.r$   rp   r•   rz   r–   rŒ   s   @r"   r�   r�   Š  sO   ø„ ñð2 €Ið (,ØØ"&ð	Oà$ðOð ðOð  ð	Oð
 
õO÷	/r$   r�   c                  óF   ‡ — e Zd ZdZdZ	 	 	 d	 	 	 	 	 	 	 dˆ fd„Zdd„Zˆ xZS )ÚNearestay  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.
    r&   c                ó2   •— t         ‰| �  t        |||«       y r@   )rƒ   rI   Ú_NEARESTr‘   s       €r"   rI   zNearest.__init__Ò  s   ø€ ô 	‰Ñœ 8¨]¸EÕBr$   c                ój   — t        | j                  t        j                  | j                  |«      «      S r“   )r   r    r
   r”   r(   rm   s     r"   ro   zNearest.__call__Ú  s,   € ä/Ø�M‰MÔ2×9Ñ9¸$×:LÑ:LÈiÓXó
ð 	
r$   rp   r•   rz   r–   rŒ   s   @r"   r£   r£   º  sO   ø„ ñð* €Ið (,ØØ"&ð	Cà$ðCð ðCð  ð	Cð
 
õC÷
r$   r£   c                  ó<   — e Zd ZdZdZd	d„Zd
d„Zdd„Zdd„Zdd„Z	y)Ú_AggWritePrefzù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+.
    )ÚprefÚeffective_prefc                ó<   — || _         t        j                  | _        y r@   )r©   ÚReadPreferenceÚPRIMARYrª   )rG   r©   s     r"   rI   z_AggWritePref.__init__í  s   € ØˆŒ	Ü+9×+AÑ+AˆÕr$   c                ó¶   — |j                   }|j                  t        j                  «      r|r|dk  rt        j                  | _        y | j                  | _        y )Né   )Úcommon_wire_versionÚhas_readable_serverr¬   ÚPRIMARY_PREFERREDr­   rª   r©   )rG   Útopology_descriptionÚ	common_wvs      r"   Úselection_hookz_AggWritePref.selection_hookñ  sE   € Ø(×<Ñ<ˆ	à ×4Ñ4´^×5UÑ5UÔVÙØ˜B’ä"0×"8Ñ"8ˆDÕà"&§)¡)ˆDÕr$   c                ó$   — | j                  |«      S r†   )rª   rm   s     r"   ro   z_AggWritePref.__call__ü  s   € à×"Ñ" 9Ó-Ð-r$   c                ó"   — d| j                   ›d�S )Nz_AggWritePref(pref=ú))r©   rM   s    r"   r_   z_AggWritePref.__repr__   s   € Ø$ T§Y¡Y M°Ð3Ð3r$   c                ó.   — t        | j                  |«      S r@   )Úgetattrrª   )rG   rN   s     r"   Ú__getattr__z_AggWritePref.__getattr__  s   € Ü�t×*Ñ*¨DÓ1Ð1r$   N)r©   r9   )r³   r   rs   rt   rz   ru   )rN   rv   rs   r   )
rL   r{   r|   r}   r~   rI   rµ   ro   r_   r»   r&   r$   r"   r¨   r¨   á  s(   „ ñð +€IóBó	,ó.ó4ô
2r$   r¨   c                óŠ   — | t         k(  r,|d i gfvrt        d«      ‚|dk7  rt        d«      ‚t        «       S t        |    ||«      S )Nz4Read preference primary cannot be combined with tagsr+   zCRead preference primary cannot be combined with maxStalenessSeconds)r„   r   r�   Ú_ALL_READ_PREFERENCES)rH   r    r(   s      r"   Úmake_read_preferencer¾     sZ   € ð ŒxÒØ˜D 2 $˜<Ñ'Ü$Ð%[Ó\Ð\Ø˜BÒÜ$ØUóð ô ‹yÐÜ  Ñ& x°Ó?Ð?r$   )r­   r²   Ú	SECONDARYÚSECONDARY_PREFERREDÚNEARESTc                  óV   — e Zd ZdZ e«       Z e«       Z e«       Z	 e
«       Z e«       Zy)r¬   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.
    N)rL   r{   r|   r}   r�   r­   rŽ   r²   r˜   r¿   r�   rÀ   r£   rÁ   r&   r$   r"   r¬   r¬   #  s1   „ ñ4ñl ‹i€GÙ(Ó*ÐÙ“€IÙ,Ó.ÐÙ‹i�Gr$   r¬   c                ó,   — t         j                  | «      S )z2Get the read preference mode from mongos/uri name.)rA   Úindex)rN   s    r"   Úread_pref_mode_from_namerÅ   a  s   € ä×Ñ˜tÓ$Ð$r$   c                  ó<   — e Zd ZU dZded<   d	d„Zd
d„Zdd„Zd	d„Zy)ÚMovingAveragez0Tracks an exponentially-weighted moving average.úOptional[float]Úaveragec                ó   — d | _         y r@   ©rÉ   rM   s    r"   rI   zMovingAverage.__init__k  ó	   € Øˆ�r$   c                ó†   — |dk  rt        d|› �«      ‚| j                  €|| _        y d| j                  z  d|z  z   | _        y )Nr   zduration cannot be negative gš™™™™™é?gš™™™™™É?)r   rÉ   )rG   Úsamples     r"   Ú
add_samplezMovingAverage.add_samplen  sH   € Ø�AŠ:ÜÐ;¸F¸8ÐDÓEÐEØ�<‰<ÐØ!ˆD�Lð  §¡Ñ-°°f±Ñ<ˆD�Lr$   c                ó   — | j                   S )z6Get the calculated average, or None if no samples yet.rË   rM   s    r"   ÚgetzMovingAverage.getx  s   € à�|‰|Ðr$   c                ó   — d | _         y r@   rË   rM   s    r"   ÚresetzMovingAverage.reset|  rÌ   r$   NrŠ   )rÎ   Úfloatrs   rt   )rs   rÈ   )	rL   r{   r|   r}   Ú__annotations__rI   rÏ   rÑ   rÓ   r&   r$   r"   rÇ   rÇ   f  s   … Ù:àÓóó=óôr$   rÇ   )r    rq   rs   rq   )r(   r   rs   rv   )r(   r   rs   r,   )r6   rr   rs   rr   )r+   )rH   r,   r    rq   r(   r,   rs   r9   )rN   rv   rs   r,   )0r}   Ú
__future__r   r3   Úcollectionsr   Útypingr   r   r   r   r	   Úpymongor
   Úpymongo.errorsr   Úpymongo.server_selectorsr   r   r   Úpymongo.topology_descriptionr   r„   r�   rš   rŸ   r¥   rA   rv   Ú_Hedgerw   r#   r)   r-   r7   r9   r�   rŽ   r˜   r�   r£   r¨   r½   r¾   Ú_MODESr¬   rÅ   rÇ   r&   r$   r"   ú<module>rß      sM  ðñõ
 #ã Ý ß BÕ Bå +Ý -÷ñ
 Ý2Ý@ð €ØÐ Ø€
ØÐ Ø€ð€ð 
��c�Ñ	€Ø�G˜C ˜HÑ%Ñ&€óó.Tó
ó÷ bñ bôJˆkô ô8,�{ô ,ô^$
�ô $
ôN-/˜ô -/ô`$
ˆkô $
÷N%2ñ %2ðP !Ð"2°IÐ?QÐSZÐ[Ð ð CEð@Ø
ð@Ø+ð@Ø<?ð@àó@ð
€÷;ñ ;ó|%÷
ò r$   