HEX
Server: Apache
System: Linux pdx1-shared-a1-38 6.6.104-grsec-jammy+ #3 SMP Tue Sep 16 00:28:11 UTC 2025 x86_64
User: mmickelson (3396398)
PHP: 8.1.31
Disabled: NONE
Upload Files
File: //usr/lib/python3/dist-packages/django/utils/__pycache__/decorators.cpython-310.pyc
o

3�a��@svdZddlmZmZmZGdd�de�Zdd�Zdd�Zdd
d�Z	dd
�Z
dd�Zdd�Zdd�Z
dd�Zdd�ZdS)zCFunctions that help with dynamically creating decorators for views.�)�partial�update_wrapper�wrapscseZdZd�fdd�	Z�ZS)�classonlymethodNcs|durtd��t��||�S)Nz=This method is available only on the class, not on instances.)�AttributeError�super�__get__)�self�instance�cls��	__class__��9/usr/lib/python3/dist-packages/django/utils/decorators.pyrszclassonlymethod.__get__�N)�__name__�
__module__�__qualname__r�
__classcell__rrrrrsrcCs|dd��}t||�dS)Nc_sdSrr)�args�kwargsrrr�dummysz%_update_method_wrapper.<locals>.dummy)r)�_wrapper�	decoratorrrrr�_update_method_wrapper
s
rcsPt�d�r
�ddd��n�g���fdd�}�D]}t||�qt|��|S)z�
    Decorate `method` with one or more function decorators. `decorators` can be
    a single decorator or an iterable of decorators.
    �__iter__N���cs4t��|t|���}�D]}||�}q||i|��Sr)rr�type)r	rr�bound_method�dec��
decorators�methodrrr#s
z!_multi_decorate.<locals>._wrapper)�hasattrrr)r!r"rrrr r�_multi_decorates

r$�csF��fdd�}t�d�st|��t�d�r�n�j}d|j|_|S)z>
    Convert a function decorator into a method decorator
    cspt|t�s
t�|�S�rt|��std|�f��t|��}t|�s+td�||f��t�|�}t|�|�|S)NzfThe keyword argument `name` must be the name of a method of the decorated class: %s. Got '%s' instead.zACannot decorate '%s' as it isn't a callable attribute of %s (%s).)	�
isinstancerr$r#�
ValueError�getattr�callable�	TypeError�setattr)�objr"r�r�namerr�_dec=s$

��
��
zmethod_decorator.<locals>._decrrzmethod_decorator(%s))r#rr
r)rr.r/r,rr-r�method_decorator5s

r0cCst|�S)a<
    Like decorator_from_middleware, but return a function
    that accepts the arguments to be passed to the middleware_class.
    Use like::

         cache_page = decorator_from_middleware_with_args(CacheMiddleware)
         # ...

         @cache_page(3600)
         def my_view(request):
             # ...
    ��make_middleware_decorator��middleware_classrrr�#decorator_from_middleware_with_argsYs
r5cCs
t|��S)z�
    Given a middleware class (not an instance), return a view decorator. This
    lets you use middleware functionality on a per-view basis. The middleware
    is created with no params passed.
    r1r3rrr�decorator_from_middlewareis
r6cs�fdd�}|S)Ncs���fdd�}|S)Ncs0��g��Ri����t����fdd��}|S)Nc
st�d�r����}|dur|St�d�r#����||�}|dur#|Sz
��g|�Ri|��}Wn$tyT}zt�d�rO���|�}|durO|WYd}~S�d}~wwt|d�r}t|j�r}t�d�rj���|�}t�d�r{��fdd�}|�|�|St�d�r���	�|�S|S)	N�process_request�process_view�process_exception�render�process_template_response�process_responsecs���|�Sr)r<)�response)�
middleware�requestrr�callback�szomake_middleware_decorator.<locals>._make_decorator.<locals>._decorator.<locals>._wrapped_view.<locals>.callback)
r#r7r8�	Exceptionr9r)r:r;�add_post_render_callbackr<)r?rr�resultr=�er@�r>�	view_func)r?r�
_wrapped_viewws8



��



�z]make_middleware_decorator.<locals>._make_decorator.<locals>._decorator.<locals>._wrapped_view)r)rFrG)�m_args�m_kwargsr4rEr�
_decoratortszFmake_middleware_decorator.<locals>._make_decorator.<locals>._decoratorr)rHrIrJr3)rHrIr�_make_decoratorss#z2make_middleware_decorator.<locals>._make_decoratorr)r4rKrr3rr2rs%r2cCsd|_d|_|S)zj
    Mark a middleware factory as returning a hybrid middleware supporting both
    types of request.
    T��sync_capable�
async_capable��funcrrr�sync_and_async_middleware��rQcC�d|_d|_|S)z\
    Mark a middleware factory as returning a sync middleware.
    This is the default.
    TFrLrOrrr�sync_only_middleware�rRrTcCrS)z;Mark a middleware factory as returning an async middleware.FTrLrOrrr�async_only_middleware�srUN)r%)�__doc__�	functoolsrrr�classmethodrrr$r0r5r6r2rQrTrUrrrr�<module>s	
$	)