Ë
    V³h  ã                  ó    — d dl mZ d dlZd dlmZ d dlmZ d dlmZ  edd¬«       ed	d
¬«       edd¬«       G d„ de«      «       «       «       Z	y)é    )ÚannotationsN)Úversionchanged)ÚVersion)ÚRedisStoragez3.14.0z_
Dropped support for the :pypi:`redis-py-cluster` library
which has been abandoned/deprecated.
)ÚversionÚreasonz2.5.0aa  
Cluster support was provided by the :pypi:`redis-py-cluster` library
which has been absorbed into the official :pypi:`redis` client. By
default the :class:`redis.cluster.RedisCluster` client will be used
however if the version of the package is lower than ``4.2.0`` the implementation
will fallback to trying to use :class:`rediscluster.RedisCluster`.
z4.3ztAdded support for using the redis client from :pypi:`valkey` if :paramref:`uri` has the ``valkey+cluster://`` schemac                  óš   ‡ — e Zd ZU dZddgZ	 ddiZded<   	  ed«       ed	«      d
œZe	j                  df	 	 	 	 	 	 	 	 	 dˆ fd„Zdd„Zˆ xZS )ÚRedisClusterStoragez¦
    Rate limit storage with redis cluster as backend

    Depends on :pypi:`redis` (or :pypi:`valkey` if :paramref:`uri`
    starts with ``valkey+cluster://``).
    zredis+clusterzvalkey+clusterÚmax_connectionsiè  zdict[str, float | str | bool]ÚDEFAULT_OPTIONSz4.2.0z6.0)ÚredisÚvalkeyFc                ó  •— t         j                  j                  |«      }i }|j                  r|j                  |d<   |j                  r|j                  |d<   |j
                  j                  d«      dz   }g }|j
                  |d j                  d«      D ]2  }	|	j                  d«      \  }
}|j                  |
t        |«      f«       Œ4 || _
        d| _        |j                  d«      rdnd	| _        i | j                  ¥|¥|¥}| j                  | j                     j                   | _        |D cg c]%  } | j"                  j$                  j&                  |Ž ‘Œ' }}| j                  d	k(  r. | j"                  j$                  j(                  dd
|i|¤Ž| _        n- | j"                  j$                  j*                  dd
|i|¤Ž| _        | j                  sJ ‚| j-                  |«       t/        t0        | f  ||fi |¤Ž yc c}w )a¸  
        :param uri: url of the form
         ``redis+cluster://[:password]@host:port,host:port``

         If the uri scheme is ``valkey+cluster`` the implementation used will be from
         :pypi:`valkey`.
        :param key_prefix: the prefix for each key created in redis
        :param wrap_exceptions: Whether to wrap storage exceptions in
         :exc:`limits.errors.StorageError` before raising it.
        :param options: all remaining keyword arguments are passed
         directly to the constructor of :class:`redis.cluster.RedisCluster`
        :raise ConfigurationError: when the :pypi:`redis` library is not
         available or if the redis cluster cannot be reached.
        ÚusernameÚpasswordú@é   Nú,ú:r   r   Ústartup_nodes© )ÚurllibÚparseÚurlparser   r   ÚnetlocÚfindÚsplitÚappendÚintÚ
key_prefixÚstorageÚ
startswithÚtarget_serverr   ÚdependenciesÚmoduleÚ
dependencyÚclusterÚClusterNodeÚRedisClusterÚValkeyClusterÚinitialize_storageÚsuperr   Ú__init__)ÚselfÚurir    Úwrap_exceptionsÚoptionsÚparsedÚparsed_authÚsepÚcluster_hostsÚlocÚhostÚportÚmerged_optionsÚcr   Ú	__class__s                  €új/var/www/catia.catastroantioquia-mas.com/tasa/lib/python3.12/site-packages/limits/storage/redis_cluster.pyr-   zRedisClusterStorage.__init__8   sà  ø€ ô* —‘×&Ñ& sÓ+ˆØ57ˆà?Š?Ø&,§o¡oˆK˜
Ñ#Ø?Š?Ø&,§o¡oˆK˜
Ñ#àm‰m× Ñ  Ó%¨Ñ)ˆØˆØ—=‘=  Ð&×,Ñ,¨SÓ1ò 	4ˆCØŸ™ 3›‰JˆD$Ø× Ñ  $¬¨D«	Ð!2Õ3ð	4ð %ˆŒØˆŒØ),¯©¸Ô)A™XÀwˆÔØK˜D×0Ñ0ÐK°KÐKÀ7ÐKˆØ×+Ñ+¨D×,>Ñ,>Ñ?×FÑFˆŒØJWÖXÀQÐ<˜Ÿ™×0Ñ0×<Ñ<¸aÒ@ÐXˆÐXØ×Ñ Ò(Ø?˜4Ÿ?™?×2Ñ2×?Ñ?ñ Ø+ðØ/=ñˆDLð A˜4Ÿ?™?×2Ñ2×@Ñ@ñ Ø+ðØ/=ñˆDŒLð |Š|Ðˆ|Ø×Ñ Ô$ÜŒl˜DÑ*¨3°ÑKÀ7ÓKùò Ys   Ä2*G=c                ó@  — | j                  d«      }d}| j                  j                  «       D ]h  }| j                  j                  |«      }|j	                  |«      }|t        |D cg c]"  }|j                  |j                  d«      «      ‘Œ$ c}«      z  }Œj |S c c}w )aé  
        Redis Clusters are sharded and deleting across shards
        can't be done atomically. Because of this, this reset loops over all
        keys that are prefixed with :paramref:`RedisClusterStorage.prefix` and
        calls delete on them one at a time.

        .. warning::
         This operation was not tested with extremely large data sets.
         On a large production based system, care should be taken with its
         usage as it could be slow on very large data setsÚ*r   zutf-8)Úprefixed_keyr!   Úget_primariesÚget_redis_connectionÚkeysÚsumÚdeleteÚdecode)r.   ÚprefixÚcountÚprimaryÚnoderB   Úks          r<   ÚresetzRedisClusterStorage.resetn   s’   € ð ×"Ñ" 3Ó'ˆØˆØ—|‘|×1Ñ1Ó3ò 	IˆGØ—<‘<×4Ñ4°WÓ=ˆDØ—9‘9˜VÓ$ˆDØ”SÀ$ÖG¸Q˜$Ÿ+™+ a§h¡h¨wÓ&7Õ8ÒGÓHÑH‰Eð	Ið ˆùò Hs   Á''B)
r/   Ústrr    rL   r0   Úboolr1   zfloat | str | boolÚreturnÚNone)rN   z
int | None)Ú__name__Ú
__module__Ú__qualname__Ú__doc__ÚSTORAGE_SCHEMEr   Ú__annotations__r   ÚDEPENDENCIESr   ÚPREFIXr-   rK   Ú__classcell__)r;   s   @r<   r
   r
      s›   ø… ñ2ð &Ð'7Ð8€NØ.ð 	˜4ð6€OÐ2ó ð Iñ ˜Ó!Ù˜%“.ñ€Lð '×-Ñ-Ø %ð	4Làð4Lð ð4Lð ð	4Lð
 &ð4Lð 
õ4L÷ló    r
   )
Ú
__future__r   r   Údeprecated.sphinxr   Úpackaging.versionr   Úlimits.storage.redisr   r
   r   rY   r<   ú<module>r^      sn   ðÝ "ã å ,Ý %å -ñ Øðôñ Øðô	ñ Øð	Côô]˜,ó ]óó	óñ0]rY   