https://t.me/RX1948
Server : Apache
System : Linux iad1-shared-b8-43 6.6.49-grsec-jammy+ #10 SMP Thu Sep 12 23:23:08 UTC 2024 x86_64
User : dh_edsupp ( 6597262)
PHP Version : 8.2.26
Disable Function : NONE
Directory :  /lib/python3/dist-packages/django/template/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //lib/python3/dist-packages/django/template/__pycache__/context.cpython-310.pyc
o

�a�"�@s�ddlmZddlmZdZGdd�de�ZGdd�de�ZGdd	�d	�ZGd
d�de�Z	Gdd
�d
e�Z
Gdd�de	�Zddd�ZdS)�)�contextmanager)�copy)z'django.template.context_processors.csrfc@seZdZdZdS)�ContextPopExceptionz,pop() has been called more times than push()N)�__name__�
__module__�__qualname__�__doc__�r	r	�9/usr/lib/python3/dist-packages/django/template/context.pyrsrcs,eZdZ�fdd�Zdd�Zdd�Z�ZS)�ContextDictcs(t�j|i|��|j�|�||_dS�N)�super�__init__�dicts�append�context)�selfr�args�kwargs��	__class__r	r
rs
zContextDict.__init__cCs|Srr	�rr	r	r
�	__enter__szContextDict.__enter__cOs|j��dSr)r�pop)rrrr	r	r
�__exit__�zContextDict.__exit__)rrrrrr�
__classcell__r	r	rr
r
srcs�eZdZd$dd�Zd$dd�Z�fdd�Zdd	�Zd
d�Zdd
�Zdd�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zd$dd�Zd$dd�Zd$dd�Zd d!�Zd"d#�Z�ZS)%�BaseContextNcCs|�|�dSr)�_reset_dicts)r�dict_r	r	r
rrzBaseContext.__init__cCs0dddd�}|g|_|dur|j�|�dSdS)NTF)�True�False�None)rr)r�value�builtinsr	r	r
rs
�zBaseContext._reset_dictscstt��}|jdd�|_|Sr)rr
r�r�	duplicaterr	r
�__copy__%s
zBaseContext.__copy__cC�
t|j�Sr)�reprrrr	r	r
�__repr__*�
zBaseContext.__repr__cCr(r��reversedrrr	r	r
�__iter__-r+zBaseContext.__iter__cOsLg}|D]}t|t�r||jdd�7}q|�|�qt|g|�Ri|��S�N�)�
isinstancerrrr)rrrr�dr	r	r
�push0s
zBaseContext.pushcCst|j�dkr	t�|j��Sr/)�lenrrrrr	r	r
r9s
zBaseContext.popcCs||jd|<dS)z%Set a variable in the current context���N�r)r�keyr#r	r	r
�__setitem__>szBaseContext.__setitem__cCs6|jd}t|j�D]
}||vr|}nq
|||<dS)z|
        Set a variable in one of the higher contexts if it exists there,
        otherwise in the current context.
        r5N)rr-)rr7r#rr2r	r	r
�
set_upwardBs
�zBaseContext.set_upwardcCs,t|j�D]}||vr||Sqt|��)zHGet a variable's value, starting at the current context and going upward)r-r�KeyError)rr7r2r	r	r
�__getitem__Ns
�zBaseContext.__getitem__cCs|jd|=dS)z*Delete a variable from the current contextr5Nr6�rr7r	r	r
�__delitem__UszBaseContext.__delitem__cst�fdd�|jD��S)Nc3s�|]}�|vVqdSrr	)�.0r2�r7r	r
�	<genexpr>Zs�z+BaseContext.__contains__.<locals>.<genexpr>)�anyrr<r	r?r
�__contains__YszBaseContext.__contains__cCs(t|j�D]}||vr||Sq|Srr,)rr7�	otherwiser2r	r	r
�get\s
�zBaseContext.getcCs(z||WSty|||<Y|Swr)r:)rr7�defaultr	r	r
�
setdefaultbs

�zBaseContext.setdefaultcCst|�}|�|�|S)z{
        Return a new context with the same properties, but with only the
        values given in 'values' stored.
        )rr�r�values�new_contextr	r	r
�newis
zBaseContext.newcCsi}|jD]}|�|�q|S)z6
        Return self.dicts as one dictionary.
        )r�update)r�flatr2r	r	r
�flattenrs
zBaseContext.flattencCst|t�stS|��|��kS)zN
        Compare two contexts by comparing theirs 'dicts' attributes.
        )r1r�NotImplementedrM)r�otherr	r	r
�__eq__{s
zBaseContext.__eq__r)rrrrrr'r*r.r3rr8r9r;r=rBrDrFrJrMrPrr	r	rr
rs$

	


		rcsBeZdZdZd�fdd�	Zedd��Z�fdd	�Zd
d�Z�Z	S)
�Contextz&A stack container for variable contextNTcs6||_||_||_d|_t�|_d|_t��|�dS)N�unknown)	�
autoescape�use_l10n�use_tz�
template_name�
RenderContext�render_context�templater
r)rrrSrTrUrr	r
r�szContext.__init__ccs6�|jdur
td��||_z	dVWd|_dSd|_w�Nz&Context is already bound to a template)rY�RuntimeError)rrYr	r	r
�
bind_template�s�
zContext.bind_templatecst���}t|j�|_|Sr)r
r'rrXr%rr	r
r'�s
zContext.__copy__cCs8t|d�s	td��t|t�r|jdd���}t||�S)z;Push other_dict to the stack of dictionaries in the Contextr;z6other_dict must be a mapping (dictionary-like) object.r0N)�hasattr�	TypeErrorr1rrrr)r�
other_dictr	r	r
rK�s



zContext.update)NTNN)
rrrrrrr\r'rKrr	r	rr
rQ�s
	rQc@sDeZdZdZdZdd�Zdd�Zddd�Zd	d
�Ze	ddd
��Z
dS)rWa�
    A stack container for storing Template state.

    RenderContext simplifies the implementation of template Nodes by providing a
    safe place to store state between invocations of a node's `render` method.

    The RenderContext also provides scoping rules that are more sensible for
    'template local' variables. The render context stack is pushed before each
    template is rendered, creating a fresh scope with nothing in it. Name
    resolution fails if a variable is not found at the top of the RequestContext
    stack. Thus, variables are local to a specific template and don't affect the
    rendering of other templates as they would if they were stored in the normal
    template context.
    Nccs�|jdEdHdS�Nr5r6rr	r	r
r.�s�zRenderContext.__iter__cCs||jdvSr`r6r<r	r	r
rB�rzRenderContext.__contains__cCs|jd�||�Sr`)rrD)rr7rCr	r	r
rD�szRenderContext.getcCs|jd|Sr`r6r<r	r	r
r;�rzRenderContext.__getitem__TccsT�|j}||_|r
|��zdVW||_|r|��dSdS||_|r)|��wwr)rYr3r)rrY�isolated_context�initialr	r	r
�
push_state�s���
�zRenderContext.push_stater)T)rrrrrYr.rBrDr;rrcr	r	r	r
rW�s
rWcs<eZdZdZd
�fdd�	Zedd��Zd�fdd	�	Z�ZS)�RequestContextz�
    This subclass of template.Context automatically populates itself using
    the processors defined in the engine's configuration.
    Additional processors can be specified as a list of callables
    using the "processors" keyword argument.
    NTcsTt�j||||d�||_|durdnt|�|_t|j�|_|�i�|�i�dS)N)rTrUrSr	)	r
r�request�tuple�_processorsr4r�_processors_indexrK)rrer�
processorsrTrUrSrr	r
r�s
zRequestContext.__init__c	cs��|jdur
td��||_|jj|j}i}|D]
}|�||j��q||j|j<zdVWd|_i|j|j<dSd|_i|j|j<wrZ)	rYr[�engine�template_context_processorsrgrKrerrh)rrYri�updates�	processorr	r	r
r\�s"�
��zRequestContext.bind_templatecst��|�}t|d�r
|`|S)Nrh)r
rJr]rhrGrr	r
rJ�s
zRequestContext.new)NNNNTr)	rrrrrrr\rJrr	r	rr
rd�s
rdNcKsd|durt|t�std|jj��|durt|fi|��}|S|}t|fi|��}|r0|�|�|S)zT
    Create a suitable Context from a plain dict and optionally an HttpRequest.
    Nz&context must be a dict rather than %s.)r1�dictr^rrrQrdr3)rrer�original_contextr	r	r
�make_contexts�
rpr)
�
contextlibrr�_builtin_context_processors�	ExceptionrrnrrrQrWrdrpr	r	r	r
�<module>sj%+2

https://t.me/RX1948 - 2025