Your IP : 3.144.30.14


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

3

�<�eb�@sdddlZddlZddlZddlmZddlZddljZddl	m
Z
ejj�Z
e
�ZGdd�d�ZdS)�N�)�
repository)�commandsc@sZeZdZdZdd�Zddd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�ZdS)�	Functionsz
	Built-in functions
	cCstj�|_|j�dS)N)rZ
Repository�_repository�_parse_init)�self�r	�/usr/lib/python3.6/functions.py�__init__s
zFunctions.__init__�cCs&d|_||_t|�|_g|_d|_dS)NrF)�_cnt�_str�len�_len�_stack�_esc)r�sr	r	r
rs

zFunctions._parse_initcCs|j|jkr|j|jSdS)Nr)r
rr)rr	r	r
�
_curr_charszFunctions._curr_charcCs|j|j|j|�S)N)rr
)rrr	r	r
�_curr_substr szFunctions._curr_substrcCs|jj||jf�dS)N)r�appendr
)r�escr	r	r
�	_push_pos#szFunctions._push_poscCsd|jd|�||j|dd�|_t|j�|_|jt|�||d7_|jdkr`d|_dS)Nrr)rrrr
)r�a�brr	r	r
�_sub&s
&
zFunctions._subcCs�tjd|j||j��}|ddkr(dSdd�|D�}tjd|d�s\tjd|d�dSy|jj|d�}Wn&t	k
r�tjd	|d�dSX|j
|d
d��}|dkr�dS|j||j|�dS)Nz(?<!\\):rz${fcSsg|]}t|�jdd��qS)z\:�:)�str�replace)�.0�vr	r	r
�
<listcomp>1sz+Functions._process_func.<locals>.<listcomp>z\w+$rzinvalid function name '%s'zfunction '%s' not implemented�)�re�splitrr
�match�log�errorrZ	load_func�ImportErrorZexecuter)rZ_fromZsl�frr	r	r
�
_process_func-s zFunctions._process_funccCs�|j|�x�|j|jkr�|j�dkrpy|jj�}Wn$tk
rVtjd|�|j	SX|ds�|j
|d�n|jd�dkr�|j|j
�|j�dkr�d|_
nd	|_
|jd7_qWt|j�r�tjd
|�|j	S)N�}z.invalid variable syntax, non pair '}' in: '%s'rrr"z${�\TFz.invalid variable syntax, non pair '{' in: '%s')rr
rrr�pop�
IndexErrorr&r'rr*rrrr)rrZsir	r	r
�_process?s&

zFunctions._processcCs(|dks|dkr|Stjdd|j|��S)Nrz\\(\${f:.*})z\1)r#�subr/)rrr	r	r
�expandVszFunctions.expandN)r)
�__name__�
__module__�__qualname__�__doc__rrrrrrr*r/r1r	r	r	r
r
s
r)�osr#ZglobrrZ
tuned.logsZtunedZtuned.constsZconstsZtuned.utils.commandsrZlogs�getr&�cmdrr	r	r	r
�<module>s



?>