HEX
Server: Apache
System: Linux insrv.serversdaddy.com 5.14.0-362.24.2.el9_3.x86_64 #1 SMP PREEMPT_DYNAMIC Sat Mar 30 14:11:54 EDT 2024 x86_64
User: jsaha (1066)
PHP: 8.3.6
Disabled: exec,passthru,shell_exec,system
Upload Files
File: //lib/python3.9/site-packages/tuned/profiles/functions/__pycache__/functions.cpython-39.opt-1.pyc
a

Y��da�@sfddlZddlZddlZddlmZddlZddlmZddl	m
Z
ej��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
	cCst��|_|��dS�N)rZ
Repository�_repository�_parse_init��self�r�F/usr/lib/python3.9/site-packages/tuned/profiles/functions/functions.py�__init__s
zFunctions.__init__�cCs&d|_||_t|�|_g|_d|_dS)NrF)�_cnt�_str�len�_len�_stack�_esc�r
�srrrrs

zFunctions._parse_initcCs|j|jkr|j|jSdS)Nr)rrrr	rrr�
_curr_charszFunctions._curr_charcCs|j|j|j|�Sr)rr)r
rrrr�_curr_substr szFunctions._curr_substrcCs|j�||jf�dSr)r�appendr)r
Zescrrr�	_push_pos#szFunctions._push_poscCsd|jd|�||j|dd�|_t|j�|_|jt|�||d7_|jdkr`d|_dS)Nrr)rrrr)r
�a�brrrr�_sub&s
&
zFunctions._subcCs�t�d|j||j��}|ddkr(dSdd�|D�}t�d|d�s\t�d|d�dSz|j�|d�}Wn&t	y�t�d	|d�YdS0|�
|d
d��}|dur�dS|�||j|�dS)Nz(?<!\\):rz${fcSsg|]}t|��dd��qS)z\:�:)�str�replace)�.0�vrrr�
<listcomp>1�z+Functions._process_func.<locals>.<listcomp>z\w+$rzinvalid function name '%s'zfunction '%s' not implemented�)�re�splitrr�match�log�errorrZ	load_func�ImportErrorZexecuter)r
Z_from�sl�frrrr�
_process_func-s zFunctions._process_funccCs�|�|�|j|jkr�|��dkrpz|j��}Wn&tyVt�d|�|j	YS0|ds�|�
|d�n|�d�dkr�|�|j
�|��dkr�d|_
nd	|_
|jd7_q
t|j�r�t�d
|�|j	S)N�}z.invalid variable syntax, non pair '}' in: '%s'rrr%z${�\TFz.invalid varialbe syntax, non pair '{' in: '%s')rrrrr�pop�
IndexErrorr)r*rr.rrrr)r
r�sirrr�_process?s&

zFunctions._processcCs(|dus|dkr|St�dd|�|��S)Nrz\\(\${f:.*})z\1)r&�subr4rrrr�expandVszFunctions.expandN)r)
�__name__�
__module__�__qualname__�__doc__r
rrrrrr.r4r6rrrrr
s
r)�osr&�globrrZ
tuned.logsZtunedZtuned.constsZconstsZtuned.utils.commandsrZlogs�getr)�cmdrrrrr�<module>s