HEX
Server: LiteSpeed
System: Linux us-phx-web629.main-hosting.eu 5.14.0-503.23.2.el9_5.x86_64 #1 SMP PREEMPT_DYNAMIC Wed Feb 12 05:52:18 EST 2025 x86_64
User: u756937133 (756937133)
PHP: 8.2.30
Disabled: passthru,chgrp
Upload Files
File: //lib/python3.9/site-packages/tuned/profiles/__pycache__/variables.cpython-39.opt-1.pyc
a

�Գf$	�@shddlZddlZddlZddlmZddlmZddlmZddl	m
Z
mZej�
�ZGdd�d�ZdS)�N�)�	functions)�commands)�ConfigParser�Errorc@sXeZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dd�Zdd�ZdS)�	Variablesz8
	Storage and processing of variables used in profiles
	cCs"t�|_i|_i|_t��|_dS�N)r�_cmd�
_lookup_re�_lookup_envrZ	Functions�
_functions��self�r�</usr/lib/python3.9/site-packages/tuned/profiles/variables.py�__init__szVariables.__init__cCs|�|�dkr|S||S)Nr)�find)r�s�prefixrrr�_add_env_prefixszVariables._add_env_prefixcCst�d|�S)Nz\w+$)�re�match)r�variablerrr�
_check_varszVariables._check_varcCsj|durdSt|�}|�|�s0t�d|�dS|�|�}||jdt�|�d<||j|�	|t
j�<dS)Nz6variable definition '%s' contains unallowed charactersz
(?<!\\)\${�})�strr�log�error�expandr
r�escaperr�constsZ
ENV_PREFIX)rr�valuer�vrrr�add_variables

zVariables.add_variablec
Cs�tj�|�st�d|�dSz`tddddd�}t|_t|��.}|�	dt
jd|��|�Wd�n1sr0YWn"t
y�t�d	|�YdS0|��D],}|�|�D]}|�||j||dd
��q�q�dS)Nz#unable to find variables_file: '%s'�=�#TF)Z
delimitersZinline_comment_prefixesZallow_no_value�strict�[z]
z"error parsing variables_file: '%s')�raw)�os�path�existsrrrrZoptionxform�openZread_stringr ZMAGIC_HEADER_NAME�readrZsections�optionsr#�get)r�filenameZconfig�fr�orrr�
add_from_file+s
@zVariables.add_from_filecCsB|D]8}t|�dkr,|�tj�||��q|�|||�qdS)NZinclude)rr3r)r*�normpathr#)rZcfg�itemrrr�add_from_cfg;szVariables.add_from_cfgcCst�dd|j�|j|��S)Nz\\(\${\w+})z\1)r�subr	Zmultiple_re_replacer
)rr!rrr�
expand_staticCszVariables.expand_staticcCs&|durdS|�t|��}|j�|�Sr)r8rrr)rr!rrrrrFszVariables.expandcCs|jSr)rr
rrr�get_envNszVariables.get_envN)
�__name__�
__module__�__qualname__�__doc__rrrr#r3r6r8rr9rrrrrs
r)r)rZ
tuned.logsZtunedrZtuned.constsr Ztuned.utils.commandsrZtuned.utils.config_parserrrZlogsr/rrrrrr�<module>s