ok

Mini Shell

Direktori : /lib/python3.6/site-packages/tuned/profiles/__pycache__/
Upload File :
Current File : //lib/python3.6/site-packages/tuned/profiles/__pycache__/locator.cpython-36.pyc

3

�<�e��@s6ddlZddljZddlmZmZGdd�de�ZdS)�N)�ConfigParser�Errorc@sneZdZdZdgZdd�Zedd��Zdd�Zdd
d�Z	dd
�Z
dd�Zddd�Zdd�Z
dd�Zdd�Zd	S)�Locatorz$
	Profiles locator and enumerator.
	�_load_directoriescCst|�tk	rtd��||_dS)Nz(load_directories parameter is not a list)�type�list�	TypeErrorr)�self�load_directories�r�/usr/lib/python3.6/locator.py�__init__szLocator.__init__cCs|jS)N)r)r	rrrr
szLocator.load_directoriescGs&t|�dg}tjj|�}tjj|�S)Nz
tuned.conf)r�os�path�join�normpath)r	�
path_partsZconfig_namerrr�_get_config_filenameszLocator._get_config_filenameNcCs�d}|dd�dk}|r$|dd�}xLt|j�D]>}|j|tjj|��}|dk	r^||kr^d}q0tjj|�r0|Sq0W|r�|dkr�d}|S)Nr��-�)�reversedrrrr�basename�isfile)r	�profile_nameZ
skip_files�retZconditional_load�dir_name�config_filerrr�
get_configszLocator.get_configcCs|dk	o|dkod|kS)Nr�/r)r	rrrr�check_profile_name_format0sz!Locator.check_profile_name_formatcCs�|j|�sdS|j|�}|dkr$dSyJtddddd�}t|_t|��"}|jdtjd|j	��WdQRX|St
ttfk
r�}zdSd}~XnXdS)N�=�#TF)Z
delimitersZinline_comment_prefixesZallow_no_value�strict�[z]
)
r rr�strZoptionxform�openZread_string�constsZMAGIC_HEADER_NAME�read�IOError�OSErrorr)r	rr�config�f�errr�parse_config3s


&zLocator.parse_configcCs$yt|�}Wntk
r*|g}d}YnXyt|�}Wntk
rV|g}d}YnX||krv||dg||}|j|�}|dkr�ddddgStj|j�k}d|g}xtt||�D]f\}	}
|	dks�|	dkr�d|d<|dg}q�|o�|	|jtj�k�r||jtj|	dd�g}q�||
g}q�W|S)NrFrTr)�raw���)	�lenrr.r'ZPLUGIN_MAIN_UNIT_NAMEZsections�zipZoptions�get)r	rZattrsZdefvalsZ	attrs_lenZdefvals_lenr+Zmain_unit_in_config�vals�attrZdefvalrrr�get_profile_attrsGs2


zLocator.get_profile_attrscCsjt�}x^|jD]T}y:x4tj|�D]&}|j||�}tjj|�r |j|�q WWqtk
r`YqXqW|S)N)	�setrr�listdirrrr�addr*)r	Zprofilesrrrrrr�
list_profileses
zLocator.list_profilescCst|j��S)N)�sortedr:)r	rrr�get_known_namesqszLocator.get_known_namescs�fdd�t�j��D�S)Ncs(g|] }|�j|tjgdg�df�qS)r�)r6r'ZPROFILE_ATTR_SUMMARY)�.0Zprofile)r	rr�
<listcomp>usz3Locator.get_known_names_summary.<locals>.<listcomp>)r;r:)r	r)r	r�get_known_names_summarytszLocator.get_known_names_summary)N)N)�__name__�
__module__�__qualname__�__doc__�	__slots__r
�propertyr
rrr r.r6r:r<r@rrrrrs

r)rZtuned.constsr'Ztuned.utils.config_parserrr�objectrrrrr�<module>s


Zerion Mini Shell 1.0