o
    ;hu                     @  sP   d dl mZ d dlZd dlmZmZ d dlmZ d dlm	Z	 G dd deZ
dS )    )annotationsN)ABCabstractmethod)
ModuleType)get_package_datac                   @  sh  e Zd ZdZee dZee dZee dZee dZee dZ	ee dZ
dIddZdJddZedKddZedLddZedMd d!ZedMd"d#ZeedNd%d&Ze	'dOdPd+d,ZedQd-d.ZedRd/d0ZedSd3d4ZedTd8d9Ze	'dOdUd:d;Ze	'dOdVd<d=ZedWd?d@ZedXdAdBZedYdDdEZedYdFdGZdHS )ZRedisBridgezresources/redis/lua_scriptsz/moving_window.luaz/acquire_moving_window.luaz/clear_keys.luaz/incr_expire.luaz/sliding_window.luaz/acquire_sliding_window.luauristr
dependencyr   
key_prefixreturnNonec                 C  s\   || _ tj| j | _|| _i | _|| _| jjr| jj| jd< | jj	r,| jj	| jd< d S d S )Nusernamepassword)
r   urllibparseurlparseZ
parsed_urir
   Zparsed_authr   r   r   )selfr   r
   r    r   R/var/www/html/venv/lib/python3.10/site-packages/limits/aio/storage/redis/bridge.py__init__   s   zRedisBridge.__init__keyc                 C  s   | j  d| S )N:)r   r   r   r   r   r   prefixed_key(   s   zRedisBridge.prefixed_keyc                 C     d S Nr   r   r   r   r   register_scripts+      zRedisBridge.register_scriptsservice_name
str | Noneuse_replicasboolsentinel_kwargs$dict[str, str | float | bool] | Noneoptionsstr | float | boolc                 K  r   r   r   )r   r    r"   r$   r&   r   r   r   use_sentinel.   s   zRedisBridge.use_sentinelc                 K  r   r   r   r   r&   r   r   r   	use_basic7   r   zRedisBridge.use_basicc                 K  r   r   r   r)   r   r   r   use_cluster:   r   zRedisBridge.use_cluster-type[Exception] | tuple[type[Exception], ...]c                 C  r   r   r   r   r   r   r   base_exceptions=   s   zRedisBridge.base_exceptions   expiryintamountc                      d S r   r   )r   r   r/   r1   r   r   r   incrC   s   zRedisBridge.incrc                   r2   r   r   r   r   r   r   getK      zRedisBridge.getc                   r2   r   r   r   r   r   r   clearN   r5   zRedisBridge.clearlimittuple[float, int]c                   r2   r   r   )r   r   r7   r/   r   r   r   get_moving_windowQ      zRedisBridge.get_moving_windowprevious_keycurrent_keytuple[int, float, int, float]c                   r2   r   r   )r   r;   r<   r/   r   r   r   get_sliding_windowV   r:   zRedisBridge.get_sliding_windowc                   r2   r   r   )r   r   r7   r/   r1   r   r   r   acquire_entry[   s   zRedisBridge.acquire_entryc                   r2   r   r   )r   r;   r<   r7   r/   r1   r   r   r   acquire_sliding_window_entryd   s   z(RedisBridge.acquire_sliding_window_entryfloatc                   r2   r   r   r   r   r   r   
get_expiryn   r5   zRedisBridge.get_expiryc                   r2   r   r   r   r   r   r   checkq   r5   zRedisBridge.check
int | Nonec                   r2   r   r   r   r   r   r   resett   r5   zRedisBridge.resetc                   r2   r   r   r   r   r   r   	lua_resetw   r5   zRedisBridge.lua_resetN)r   r	   r
   r   r   r	   r   r   )r   r	   r   r	   )r   r   )
r    r!   r"   r#   r$   r%   r&   r'   r   r   )r&   r'   r   r   )r   r,   )r.   )r   r	   r/   r0   r1   r0   r   r0   )r   r	   r   r0   )r   r	   r   r   )r   r	   r7   r0   r/   r0   r   r8   )r;   r	   r<   r	   r/   r0   r   r=   )
r   r	   r7   r0   r/   r0   r1   r0   r   r#   )r;   r	   r<   r	   r7   r0   r/   r0   r1   r0   r   r#   )r   r	   r   rA   )r   r#   )r   rD   )__name__
__module____qualname__ZRES_DIRr   ZSCRIPT_MOVING_WINDOWZSCRIPT_ACQUIRE_MOVING_WINDOWZSCRIPT_CLEAR_KEYSZSCRIPT_INCR_EXPIREZSCRIPT_SLIDING_WINDOWZSCRIPT_ACQUIRE_SLIDING_WINDOWr   r   r   r   r(   r*   r+   propertyr-   r3   r4   r6   r9   r>   r?   r@   rB   rC   rE   rF   r   r   r   r   r   
   sd    

	r   )
__future__r   r   abcr   r   typesr   Zlimits.utilr   r   r   r   r   r   <module>   s    