Your IP : 3.145.85.233


Current Path : /usr/lib/python3.6/site-packages/tuned/profiles/__pycache__/
Upload File :
Current File : //usr/lib/python3.6/site-packages/tuned/profiles/__pycache__/variables.cpython-36.pyc

3

�<�e$	�@sfddlZddlZddlZddlmZddljZddlmZddl	m
Z
mZejj
�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|_tj�|_dS)N)r�_cmd�
_lookup_re�_lookup_envrZ	Functions�
_functions)�self�r
�/usr/lib/python3.6/variables.py�__init__szVariables.__init__cCs|j|�dkr|S||S)Nr)�find)r�s�prefixr
r
r�_add_env_prefixszVariables._add_env_prefixcCstjd|�S)Nz\w+$)�re�match)r�variabler
r
r�
_check_varszVariables._check_varcCsj|dkrdSt|�}|j|�s0tjd|�dS|j|�}||jdtj|�d<||j|j	|t
j�<dS)Nz6variable definition '%s' contains unallowed charactersz
(?<!\\)\${�})�strr�log�error�expandr	r�escaper
r�constsZ
ENV_PREFIX)rr�valuer�vr
r
r�add_variables

zVariables.add_variablecCs�tjj|�stjd|�dSyLtddddd�}t|_t|��$}|j	dt
jd|j�|�WdQRXWn"t
k
r�tjd	|�dSXx<|j�D]0}x*|j|�D]}|j||j||dd
��q�Wq�WdS)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_stringrZMAGIC_HEADER_NAME�readrZsectionsZoptionsr!�get)r�filename�config�fr�or
r
r�
add_from_file+s
,zVariables.add_from_filecCsFx@|D]8}t|�dkr.|jtjj||��q|j|||�qWdS)N�include)rr1r'r(�normpathr!)rZcfg�itemr
r
r�add_from_cfg;s
zVariables.add_from_cfgcCstjdd|jj|j|��S)Nz\\(\${\w+})z\1)r�subrZmultiple_re_replacer	)rrr
r
r�
expand_staticCszVariables.expand_staticcCs&|dkrdS|jt|��}|jj|�S)N)r7rrr)rrrr
r
rrFszVariables.expandcCs|jS)N)r
)rr
r
r�get_envNszVariables.get_envN)
�__name__�
__module__�__qualname__�__doc__rrrr!r1r5r7rr8r
r
r
rrs
r)r'rZ
tuned.logsZtunedrZtuned.constsrZtuned.utils.commandsrZtuned.utils.config_parserrrZlogsr,rrr
r
r
r�<module>s



?>