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/functions/__pycache__/functions.cpython-39.pyc
a

�Գf��@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��}t�dd�|dd��|f�|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�z${f:%s} expands to: '%s'r)�re�splitrr�match�log�errorrZ	load_func�ImportErrorZexecute�debug�joinr)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 variable syntax, non pair '{' in: '%s')rrrrr�pop�
IndexErrorr)r*rr0rrrr)r
r�sirrr�_process@s&

zFunctions._processcCs(|dus|dkr|St�dd|�|��S)Nrz\\(\${f:.*})z\1)r&�subr6rrrr�expandWszFunctions.expandN)r)
�__name__�
__module__�__qualname__�__doc__r
rrrrrr0r6r8rrrrr
s
r)�osr&�globrrZ
tuned.logsZtunedZtuned.constsZconstsZtuned.utils.commandsrZlogs�getr)�cmdrrrrr�<module>s