Spamworldpro Mini Shell
Spamworldpro


Server : Apache/2.4.52 (Ubuntu)
System : Linux webserver 6.8.0-49-generic #49~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Wed Nov 6 17:42:15 UTC 2 x86_64
User : www-data ( 33)
PHP Version : 8.1.2-1ubuntu2.21
Disable Function : NONE
Directory :  /lib/python3/dist-packages/cloudinit/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //lib/python3/dist-packages/cloudinit/__pycache__/templater.cpython-310.pyc
o

}��f��	@s(UddlZddlZddlZddlZddlmZddlmZddlm	Z
ddlmZddlm
Z
eed<zddlmZdd	lmZd
ZeZWneefyTdZeZYnwe�e�Ze�dej�Ze�d
�ZdZGdd�de�Z Gdd�de�Z!dd�Z"dd�Z#dd�Z$d dd�Z%dd�Z&d!dd�Z'dS)"�N)�Any)�TemplateSyntaxError)�
type_utils)�util)�
write_file�
JUndefined)�DebugUndefined)�TemplateTFz##\s*template:(.*)z)\$\{([A-Za-z0-9_.]+)\}|\$([A-Za-z0-9_.]+)zCI_MISSING_JINJA_VAR/c
sTeZdZdeddf�fdd�Zdd�Ze	dd	ed
ededefdd
��ZdZ	�Z
S)�JinjaSyntaxParsingException�error�returnNcs*t��|jpd|j|j|j�|j|_dS)Nzunknown syntax error)�super�__init__�message�lineno�name�filename�source)�selfr��	__class__��5/usr/lib/python3/dist-packages/cloudinit/templater.pyr0s�z$JinjaSyntaxParsingException.__init__cCs(|j|j|j|j��|jd��d�S)�;Avoid jinja2.TemplateSyntaxError multi-line __str__ format.���syntax_error�line_number�line_content)�format_error_messagerrr�
splitlines�strip�rrrr�__str__<s
�z#JinjaSyntaxParsingException.__str__�rrrcCs$|rd|��nd}tjj|||d�S)rz: r$r)r
�message_template�formatrrrrrDs�z0JinjaSyntaxParsingException.format_error_messagezfUnable to parse Jinja template due to syntax error: {syntax_error} on line {line_number}{line_content})r$)�__name__�
__module__�__qualname__rrr#�staticmethod�strrr%�
__classcell__rrrrr
/s(�������
�r
c@s eZdZdZdd�Zdd�ZdS)�UndefinedJinjaVariablez>Class used to represent any undefined jinja template variable.cCsdt|jfS)Nz%s%s)�MISSING_JINJA_PREFIX�_undefined_namer"rrrr#]szUndefinedJinjaVariable.__str__cCs$t|��td�}tdj|j|d���)Nr$zhUndefined jinja variable: "{this}-{other}". Jinja tried subtraction. Perhaps you meant "{this}_{other}"?)�this�other)r+�replacer.�	TypeErrorr&r/)rr1rrr�__sub__`s��zUndefinedJinjaVariable.__sub__N)r'r(r)�__doc__r#r4rrrrr-Zsr-cs�fdd�}t�||�S)z�This does simple replacement of bash variable like templates.

    It identifies patterns like ${a} or $a and can also identify patterns like
    ${a.b} or $a.b which will look for a key 'b' in the dictionary rooted
    by key 'a'.
    cs�|�d�}|dur|�d�}|durtd��t�|�d��}�}t|�dkrE|��}t|t�s;t	d|t
�|�|f��||}t|�dks&|��}t|t�sZt	d||t
�|�f��t||�S)N�rz,Match encountered but no valid group present�.zRCan not traverse into non-dictionary '%s' of type %s while looking for subkey '%s'z<Can not extract key '%s' from non-dictionary '%s' of type %s)
�group�RuntimeError�collections�deque�split�len�popleft�
isinstance�dictr3�tu�obj_namer+)�matchr�path�selected_params�key��paramsrr�replacerrs2


���

��zbasic_render.<locals>.replacer)�
BASIC_MATCHER�sub)�contentrHrIrrGr�basic_renderjsrMcCs�dd�}|�d�dkr|�dd�\}}n|}d}t�|�}|s$dt|fS|�d�����}|dvr7td	|��|d
krGt	sGt
�d�dt|fS|d
krRt	rRd
||fSdt|fS)Nc
Ss�|�d�rdnd}zt|tddgd�jdi|��|WSty4}z
|jd7_t|d�|�d}~wtyB}z||�d}~ww)	N�
r$Tz
jinja2.ext.do)�	undefined�trim_blocks�
extensionsr6)rr)�endswith�	JTemplater-�renderrrr
�	Exception)rLrH�add�template_syntax_error�
unknown_errorrrr�jinja_render�s6�����	�����z%detect_template.<locals>.jinja_renderrN���r6r$�basic)�jinjar[z.Unknown template rendering type '%s' requestedr\zcJinja not available as the selected renderer for desired template, reverting to the basic renderer.)�findr<�TYPE_MATCHERrCrMr8�lowerr!�
ValueError�JINJA_AVAILABLE�LOG�warning)�textrY�ident�rest�
type_match�
template_typerrr�detect_template�s.

���


ricCs4|si}tt�|��\}}}t�d||�|||�S)Nz+Rendering content of '%s' using renderer %s)rir�load_text_filerb�debug)�fnrHrh�rendererrLrrr�render_from_file�s

rn�cCst||�}tj|||d�dS)N)�mode)rnrr)rl�outfnrHrp�contentsrrr�render_to_file�s
rscCs |si}t|�\}}}|||�S)z
Render string)ri)rLrH�_template_typermrrr�
render_string�s
ruc	Cs�t|d��}|��}Wd�n1swY||d�}t||���d}|r8tj|dd�}|s8td|��|dkrDtj�	|�dSt
||dd	�dS)
N�r)�variant�prefixrNT)�defaultz.Cannot render template file %s - invalid yaml.�-�w)�omode)�open�readru�rstripr�	load_yamlr9�sys�stdout�writer)	rw�template�output�is_yamlrx�fhrr�
tpl_params�outrrr�render_template�s
�
�r�)ro)N)(r:�logging�rer��typingr�jinja2r�	cloudinitrrAr�cloudinit.atomic_helperr�__annotations__r�_DebugUndefinedr	rSrar�ImportError�AttributeError�object�	getLoggerr'rb�compile�Ir^rJr.r
r-rMrirnrsrur�rrrr�<module>s>
�

+&1


Spamworldpro Mini