
    Vh                     d    d dl Z d dlmZmZmZmZmZ d dlmZm	Z	  G d de
      Z G d de
      Zy)    N)CallableIteratorListOptionalUnion)RateLimitItem
parse_manyc                       e Zd ZdZdededef   deeeedef   f      de	dee
e      deeeedef   f      d	eede	f      d
eeedef   f   de	ddfdZede	fd       Zedefd       Zy)Limitz@
    simple wrapper to encapsulate limits and their context
    limitkey_func.scope
per_methodmethodserror_messageexempt_whencostoverride_defaultsreturnNc
                     || _         || _        || _        || _        || _        || _        || _        || _        |	| _        y N)	r   r   _Limit__scoper   r   r   r   r   r   )
selfr   r   r   r   r   r   r   r   r   s
             ^/var/www/catia.catastroantioquia-mas.com/tasa/lib/python3.12/site-packages/slowapi/wrappers.py__init__zLimit.__init__   sF     
 $*&	!2    c                 >    | j                   | j                         S dS )zg
        Check if the limit is exempt.
        Return True to exempt the route from the limit.
        F)r   r   s    r   	is_exemptzLimit.is_exempt"   s#     &*%5%5%At!LuLr   c                     | j                   yt        | j                         r| j                  t        j                        S | j                   S )N )r   callablerequestendpointr   s    r   r   zLimit.scope*   sF     << DLL) W--. \\r   )__name__
__module____qualname____doc__r   r   strr   r   boolr   intr   propertyr   r    r   r   r   r      s
   33 38$3 c8CH#5567	3
 3 $s)$3  c8CH+=&= >?3 hsDy123 C#s(++,3  3 
3, M4 M M 
s 
 
r   r   c                       e Zd ZdZdeeedef   f   dedef   deeeedef   f      dedee	e      deeeedef   f      d	eedef      d
ee
ede
f   f   defdZdee   fdZd Zy)
LimitGroupzb
    represents a group of related limits either from a string or a callable that returns one
    limit_provider.key_functionr   r   r   r   r   r   r   c
                     || _         || _        || _        || _        |xr |D 
cg c]  }
|
j	                          c}
xs || _        || _        || _        || _        |	| _	        d | _
        y c c}
w r   )_LimitGroup__limit_provider_LimitGroup__scoper1   r   lowerr   r   r   r   r   r#   )r   r0   r1   r   r   r   r   r   r   r   ms              r   r   zLimitGroup.__init__=   sp     !/($?w#?!AGGI#?J7*&	!2 $@s   A,r   c              #     K   t        | j                        rdt        j                  | j                        j                  j                         v rdt        j                  | j                        j                  j                         v sJ d| j                  j                   d       | j                  t        d      | j                  | j                  | j                              }n| j                         }n| j                  }t        |      }|D ]g  }t        || j                  | j                  | j                  | j                  | j                  | j                   | j"                  | j$                  	       i y w)Nkeyr#   zLimit provider function z needs a `request` argumentz`request` object can't be None)r"   r3   inspect	signature
parameterskeysr1   r%   r#   	Exceptionr	   r   r4   r   r   r   r   r   r   )r   	limit_rawlimit_itemsr   s       r   __iter__zLimitGroup.__iter__T   sD    D))*))$*?*?@KKPPRR!2!243D3D!E!P!P!U!U!WWf-d.?.?.H.H-IIdefW<<'#$DEE 11$2C2CDLL2QR	 113	--I+5i+@  	E!!""  		&&
 
	s   E>F c                     || _         | S r   )r#   )r   r#   s     r   with_requestzLimitGroup.with_requesto   s    r   N)r%   r&   r'   r(   r   r)   r   r   r*   r   r+   r   r   r   r@   rB   r-   r   r   r/   r/   8   s    c8CH#556 sCx( c8CH#5567	
  $s)$  c8CH+=&= >? hsDy12 C#s(++,  .(5/ 6r   r/   )r9   typingr   r   r   r   r   limitsr   r	   objectr   r/   r-   r   r   <module>rF      s*     < < ,.F .b9 9r   