Edit File: loader.cpython-36.opt-1.pyc
3 ��c�������������������@���st���d�dl�Zd�dlZd�dlmZmZ�d�dljZd�dlZ d�dl Z d�dlZd�dlZd�dl mZ�ejj��ZG�dd��de�ZdS�)�����N)�ConfigParser�Error)�InvalidProfileExceptionc���������������@���sv���e�Zd�ZdZdddddgZdd��Zd d ��Zedd���Ze d d���Z dd��Zdd��Zdd��Z dd��Zdd��Zdd��ZdS�)�Loaderz Profiles loader. �_profile_locator�_profile_merger�_profile_factory�_global_config� _variablesc�������������C���s"���||�_�||�_||�_||�_||�_d�S�)N)r���r���r���r ���r ���)�self�profile_locatorZprofile_factoryZprofile_mergerZ global_config� variables��r����/usr/lib/python3.6/loader.py�__init__���s ����zLoader.__init__c�������������C���s���t�jjj||�S�)N)�tuned�profiles�profileZProfile)r����profile_name�configr���r���r����_create_profile���s����zLoader._create_profilec�������������C���s���t�jd|�S�)Nz^[a-zA-Z0-9_.-]+$)�re�match)�clsr���r���r���r���� safe_name���s����zLoader.safe_namec�������������C���s���|�j�S�)N)r���)r���r���r���r���r���"���s����zLoader.profile_locatorc�������������C���s����t�|�tk r|j��}tt|�j|��}t|�dkr8td��t|�dkrZtjddj |����ntjd|d����g�}g�}|�j |||��t|�dkr�|�jj|�}n|d�}dj |�|_ d|jkr�|�jj|jd�j��|jd=�|�j|��|�j|��|S�) Nr���z.No profile or invalid profiles were specified.����zloading profiles: %sz, zloading profile: %s� r ���)�type�list�split�filterr����lenr����log�info�join� _load_profiler����merge�name�unitsr ���Zadd_from_cfg�options�_expand_vars_in_devices�_expand_vars_in_regexes)r���� profile_namesr����processed_filesZ final_profiler���r���r����load&���s*���� zLoader.loadc�������������C���s0���x*|j�D�] }|�jj|j�|�j�|j�|�_qW�d�S�)N)r(���r ����expandZdevices)r���r����unitr���r���r���r*���D���s����zLoader._expand_vars_in_devicesc�������������C���sL���xF|j�D�]<}|�jj|j�|�j�|j�|�_|�jj|j�|�j�|j�|�_qW�d�S�)N)r(���r ���r/���Z cpuinfo_regexZuname_regex)r���r���r0���r���r���r���r+���H���s����zLoader._expand_vars_in_regexesc������� ������C���s����x�|D�]�}|�j�j||�}|dkr"q|d�krFtd|tt|�j�j��f���|j|��|�j|�}|�jj ||�}d|j kr�tjd|�j j|j jd���}|�j|||��|j|��qW�d�S�)N��z!Cannot find profile '%s' in '%s'.�includez \s*[,;]\s*)r���Z get_configr���r����reversedZ_load_directories�append�_load_config_datar���Zcreater)���r���r���r ���r/����popr%���) r���r,���r���r-���r'����filenamer���r���Z include_namesr���r���r���r%���M���s���� zLoader._load_profilec�������������C���s���t�jd||�S�)Nz(?<!\\)\$\{i:PROFILE_DIR\})r����sub)r���Zprofile_dir�stringr���r���r����_expand_profile_dir^���s����zLoader._expand_profile_dirc������� ������C���s,��y8t�dddd�}t|_t|��}|j||��W�d�Q�R�X�W�n2�tjk rj�}�ztd|�|��W�Y�d�d�}~X�nX�tj ��}t jj|�}x�t |j���D�]�}tj ��||<�xF|j|�D�]8}|j||dd�||�|<�|�j|||�|��||�|<�q�W�||�jd�d�k r�t jj|||�d��} t jj| �g||�d<�q�W�|S�) N�=�#F)Z delimitersZinline_comment_prefixes�strictzCannot parse '%s'.T)�rawZscript)r����strZoptionxform�openZ read_filer���� __bases__r����collections�OrderedDict�os�path�dirnamer���Zsectionsr)����getr:���r$����normpath) r���� file_nameZ config_obj�f�er���Zdir_nameZsectionZoptionZscript_pathr���r���r���r5���a���s$���� zLoader._load_config_dataN)�__name__� __module__�__qualname__�__doc__� __slots__r���r����classmethodr����propertyr���r.���r*���r+���r%���r:���r5���r���r���r���r���r��� ���s���r���)Ztuned.profiles.profiler���Ztuned.profiles.variablesZtuned.utils.config_parserr���r���Ztuned.constsZconstsZos.pathrD���rB���Z tuned.logsr���Ztuned.profiles.exceptionsr���ZlogsrG���r"����objectr���r���r���r���r����<module>���s���