MOON
Server: Apache
System: Linux s5.yayogua.com.py 6.12.0-124.55.3.el10_1.x86_64 #1 SMP PREEMPT_DYNAMIC Thu May 7 16:54:02 EDT 2026 x86_64
User: sanbercountryclu (1012)
PHP: 8.2.33
Disabled: NONE
Upload Files
File: //lib/python3.12/site-packages/tuned/profiles/__pycache__/loader.cpython-312.pyc
�

�]�i	���ddlZddlZddlmZmZddlmZddlZ	ddl
Z
ddlZddlZddl
mZejj!�ZGd�de�Zy)�N)�ConfigParser�Error)�InvalidProfileExceptionc�h�eZdZdZgd�Zd�Zd�Zed��Ze	d��Z
d�Zd�Zd	�Z
d
�Zd�Zd�Zy
)�Loaderz
	Profiles loader.
	)�_profile_locator�_profile_merger�_profile_factory�_global_config�
_variablesc�J�||_||_||_||_||_y�N)rr
r	rr)�self�profile_locator�profile_factory�profile_merger�
global_config�	variabless      �:/usr/lib/python3.12/site-packages/tuned/profiles/loader.py�__init__zLoader.__init__s)��)�$��)�$��'�$��%�$���$�/�c�V�tjjj||�Sr)�tuned�profiles�profile�Profile)r�profile_name�configs   r�_create_profilezLoader._create_profiles��	���	�	�	'�	'��f�	=�=rc�.�tjd|�S)Nz^[a-zA-Z0-9_.-]+$)�re�match)�clsrs  r�	safe_namezLoader.safe_names��	���&��	5�5rc��|jSr)r)rs rrzLoader.profile_locator"s��	
�	�	�rc�x�t|�tur|j�}tt|j|��}t|�dk(rt
d��t|�dkDr(tjddj|�z�ntjd|dz�g}g}|j|||�|jj|�}dj|�|_
|jj|j �|j#|�|j%|�|S)Nrz.No profile or invalid profiles were specified.�zloading profiles: %sz, zloading profile: %s� )�type�list�split�filterr$�lenr�log�info�join�
_load_profiler	�merge�namer�add_from_cfgr�_expand_vars_in_devices�_expand_vars_in_regexes)r�
profile_namesr�processed_files�
final_profiles     r�loadzLoader.load&s��	�-���$� �&�&�(�=��v�d�n�n�m�<�=�-����1��	 �!Q�	R�R����!���8�8�"�T�Y�Y�}�%=�=�>��8�8�!�M�!�$4�4�5�
�(��/����]�H�o�>��&�&�,�,�X�6�-��x�x�
�.�-���/�/���}�6�6�7����}�-����}�-�	�rc��|jD]F}|jj|j|j�|j|_�Hyr)�unitsr�expand�devices�rr�units   rr5zLoader._expand_vars_in_devices>s?���m�m�d�!%���!7�!7��
�
�d�8K�8S�8S�!T�7�=�=����rc�6�|jD]�}|jj|j|j�|j|_|jj|j|j�|j|_��yr)r<rr=�
cpuinfo_regex�uname_regexr?s   rr6zLoader._expand_vars_in_regexesBsn���m�m�d�'+���'=�'=�g�m�m�D�>Q�>_�>_�'`�7�=�=���$�%)�_�_�%;�%;�G�M�M�$�<O�<[�<[�%\�7�=�=���"�rc�>�|D�]}|jj||�}|dk(r�&|�8td|�dtt	|jj
���d���|j
|�|j|�}|jj||�}d|jvr[tjd|jj|jjd���}|j!|||�|j
|���y)N�zCannot find profile 'z' in 'z'.�includez
\s*[,;]\s*)r�
get_configrr*�reversed�_load_directories�append�_load_config_datar
�create�optionsr!r+rr=�popr1)	rr7rr8r3�filenamerr�
include_namess	         rr1zLoader._load_profileGs���d��#�#�.�.�t�_�E�8��"�n����
!��t�T\�]a�]r�]r�^E�^E�UF�PG�#H�I�I����(�#��"�"�8�,�6�
�
"�
"�
)�
)�$��
7�7��7�?�?�"��H�H�]�D�O�O�,B�,B�7�?�?�CV�CV�W`�Ca�,b�c�M����}�h��@��?�?�7��rc�0�tjd||�S)Nz(?<!\\)\$\{i:PROFILE_DIR\})r!�sub)r�profile_dir�strings   r�_expand_profile_dirzLoader._expand_profile_dirXs��	���-�{�F�	C�Crc�"�	tddd��}t|_t|�5}|j	||�ddd�tj�}tjj|�}t|j��D]�}tj�||<|j|�D]:}|j!||d��|||<|j#||||�|||<�<||j!d���}tjj%|||d�}	tjj'|	�g||d<��|S#1swY��#xYw#t
j$r}td|z|��d}~wwxYw)	N�=�#F)�
delimiters�inline_comment_prefixes�strictzCannot parse '%s'.T)�raw�script)r�str�optionxform�open�	read_filer�	__bases__r�collections�OrderedDict�os�path�dirnamer*�sectionsrM�getrUr0�normpath)
r�	file_name�
config_obj�f�er�dir_name�section�option�script_paths
          rrKzLoader._load_config_data[sk��F����UZ�[�:��:���Y��1�����I�&�	�
�"�"�$�&�
�W�W�_�_�Y�
'�(��j�)�)�+�,�g� �,�,�.�6�'�?��#�#�G�,�v�(�n�n�W�f�$�n�G�F�7�O�F��"�6�6�x����QW�AX�Y�F�7�O�F��-�
�W�o���(�#�/��'�'�,�,�x�����)B�C�K�!#���!1�!1�+�!>� ?�F�7�O�H��-�
�-�!	���	���F�	 �!5�	�!A�1�	E�E��F�s-�$E'�E�E'�E$�E'�'F�:F	�	FN)�__name__�
__module__�__qualname__�__doc__�	__slots__rr�classmethodr$�propertyrr:r5r6r1rUrK�rrrr
sb���i���>��6��6������0U�]�
�"D�rr)�tuned.profiles.profiler�tuned.profiles.variables�tuned.utils.config_parserrr�tuned.consts�consts�os.pathrerc�
tuned.logsr!�tuned.profiles.exceptionsr�logsrir.�objectrrzrr�<module>r�s>����9�����	�=��j�j�n�n���b�V�br