/home/lnzliplg/www/profiles.zip
PK��\q�Z/��$__pycache__/variables.cpython-36.pycnu�[���3

�<�e$	�@sfddlZddlZddlZddlmZddljZddlmZddl	m
Z
mZejj
�ZGdd�d�ZdS)�N�)�	functions)�commands)�ConfigParser�Errorc@sXeZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dd�Zdd�ZdS)�	Variablesz8
	Storage and processing of variables used in profiles
	cCs"t�|_i|_i|_tj�|_dS)N)r�_cmd�
_lookup_re�_lookup_envrZ	Functions�
_functions)�self�r
�/usr/lib/python3.6/variables.py�__init__szVariables.__init__cCs|j|�dkr|S||S)Nr)�find)r�s�prefixr
r
r�_add_env_prefixszVariables._add_env_prefixcCstjd|�S)Nz\w+$)�re�match)r�variabler
r
r�
_check_varszVariables._check_varcCsj|dkrdSt|�}|j|�s0tjd|�dS|j|�}||jdtj|�d<||j|j	|t
j�<dS)Nz6variable definition '%s' contains unallowed charactersz
(?<!\\)\${�})�strr�log�error�expandr	r�escaper
r�constsZ
ENV_PREFIX)rr�valuer�vr
r
r�add_variables

zVariables.add_variablecCs�tjj|�stjd|�dSyLtddddd�}t|_t|��$}|j	dt
jd|j�|�WdQRXWn"t
k
r�tjd	|�dSXx<|j�D]0}x*|j|�D]}|j||j||dd
��q�Wq�WdS)Nz#unable to find variables_file: '%s'�=�#TF)Z
delimitersZinline_comment_prefixesZallow_no_value�strict�[z]
z"error parsing variables_file: '%s')�raw)�os�path�existsrrrrZoptionxform�openZread_stringrZMAGIC_HEADER_NAME�readrZsectionsZoptionsr!�get)r�filename�config�fr�or
r
r�
add_from_file+s
,zVariables.add_from_filecCsFx@|D]8}t|�dkr.|jtjj||��q|j|||�qWdS)N�include)rr1r'r(�normpathr!)rZcfg�itemr
r
r�add_from_cfg;s
zVariables.add_from_cfgcCstjdd|jj|j|��S)Nz\\(\${\w+})z\1)r�subrZmultiple_re_replacer	)rrr
r
r�
expand_staticCszVariables.expand_staticcCs&|dkrdS|jt|��}|jj|�S)N)r7rrr)rrrr
r
rrFszVariables.expandcCs|jS)N)r
)rr
r
r�get_envNszVariables.get_envN)
�__name__�
__module__�__qualname__�__doc__rrrr!r1r5r7rr8r
r
r
rrs
r)r'rZ
tuned.logsZtunedrZtuned.constsrZtuned.utils.commandsrZtuned.utils.config_parserrrZlogsr,rrr
r
r
r�<module>s

PK��\W��qxx"__pycache__/locator.cpython-36.pycnu�[���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
PK��\pm�5TT'__pycache__/merger.cpython-36.opt-1.pycnu�[���3

�<�e��@s(ddlZddlmZGdd�de�ZdS)�N)�reducec@s(eZdZdZdd�Zdd�Zdd�ZdS)	�Mergerz0
	Tool for merging multiple profiles into one.
	cCsdS)N�)�selfrr�/usr/lib/python3.6/merger.py�__init__	szMerger.__init__cCst|j|�}|S)z�
		Merge multiple configurations into one. If there are multiple units of the same type, option 'devices'
		is set for each unit with respect to eliminating any duplicate devices.
		)r�
_merge_two)rZconfigsZ
merged_configrrr�mergeszMerger.mergecCs�|jj|j��x�t|jj��D�]~\}}|js:||jkrF||j|<q |j|j|_|j|j|_|j|j|_|j	dk	r�|j	|j|_	|j
dk	r�|j
|j|_
|jdk	r�|j|j|_|jdk	r�|j|j|_|j
dk	r�|j
|j|_
|jdk	�rx"|jD]}|j|jj|d�q�Wd|_|dk�r�|j|jjdd�dk	�r�|j|jjdd�}|j|jj|j�||j|jd|j|jd<q |j|jj|j�q W|S)z�
		Merge two profiles. The configuration of units with matching names are updated with options
		from the newer profile. If the 'replace' options of the newer unit is 'True', all options from the
		older unit are dropped.
		N�script)Zoptions�update�listZunits�items�replace�typeZenabledZdevicesZdevices_udev_regexZ
cpuinfo_regexZuname_regexZ
script_preZscript_postZdrop�pop�get)rZ	profile_aZ	profile_bZ	unit_nameZunitZoptionr
rrrrs6




$"zMerger._merge_twoN)�__name__�
__module__�__qualname__�__doc__rr	rrrrrrsr)�collections�	functoolsr�objectrrrrr�<module>sPK��\?��4^^%__pycache__/exceptions.cpython-36.pycnu�[���3

�<�e_�@s ddlZGdd�dejj�ZdS)�Nc@seZdZdS)�InvalidProfileExceptionN)�__name__�
__module__�__qualname__�rr� /usr/lib/python3.6/exceptions.pyrsr)Ztuned.exceptionsZtuned�
exceptionsZTunedExceptionrrrrr�<module>sPK��\Y��ll'__pycache__/loader.cpython-36.opt-1.pycnu�[���3

�<�e��@stddlZddlZddlmZmZddljZddlZ	ddl
Z
ddlZddlZddl
mZejj�ZGdd�de�ZdS)�N)�ConfigParser�Error)�InvalidProfileExceptionc@sveZdZdZdddddgZdd�Zd	d
�Zedd��Ze	d
d��Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�ZdS)�Loaderz
	Profiles loader.
	�_profile_locator�_profile_merger�_profile_factory�_global_config�
_variablescCs"||_||_||_||_||_dS)N)rrrr	r
)�self�profile_locatorZprofile_factoryZprofile_mergerZ
global_config�	variables�r�/usr/lib/python3.6/loader.py�__init__s
zLoader.__init__cCstjjj||�S)N)�tuned�profiles�profileZProfile)r�profile_name�configrrr�_create_profileszLoader._create_profilecCstjd|�S)Nz^[a-zA-Z0-9_.-]+$)�re�match)�clsrrrr�	safe_nameszLoader.safe_namecCs|jS)N)r)rrrrr"szLoader.profile_locatorcCs�t|�tk	r|j�}tt|j|��}t|�dkr8td��t|�dkrZtjddj	|��ntjd|d�g}g}|j
|||�t|�dkr�|jj|�}n|d}dj	|�|_
d|jkr�|jj|jdj�|jd=|j|�|j|�|S)	Nrz.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
Zadd_from_cfg�options�_expand_vars_in_devices�_expand_vars_in_regexes)r�
profile_namesr�processed_filesZ
final_profilerrr�load&s*


zLoader.loadcCs0x*|jD] }|jj|j|j�|j|_qWdS)N)r(r
�expandZdevices)rr�unitrrrr*DszLoader._expand_vars_in_devicescCsLxF|jD]<}|jj|j|j�|j|_|jj|j|j�|j|_qWdS)N)r(r
r/Z
cpuinfo_regexZuname_regex)rrr0rrrr+HszLoader._expand_vars_in_regexesc	Cs�x�|D]�}|jj||�}|dkr"q|dkrFtd|tt|jj��f��|j|�|j|�}|jj	||�}d|j
kr�tjd|j
j|j
jd���}|j|||�|j|�qWdS)N�z!Cannot find profile '%s' in '%s'.�includez
\s*[,;]\s*)rZ
get_configrr�reversedZ_load_directories�append�_load_config_datarZcreater)rrr
r/�popr%)	rr,rr-r'�filenamerrZ
include_namesrrrr%Ms



zLoader._load_profilecCstjd||�S)Nz(?<!\\)\$\{i:PROFILE_DIR\})r�sub)rZprofile_dir�stringrrr�_expand_profile_dir^szLoader._expand_profile_dirc
Cs,y8tdddd�}t|_t|��}|j||�WdQRXWn2tjk
rj}ztd||��WYdd}~XnXtj	�}t
jj|�}x�t
|j��D]�}tj	�||<xF|j|�D]8}|j||dd�|||<|j||||�|||<q�W||jd�dk	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�dirnamerZsectionsr)�getr:r$�normpath)
r�	file_nameZ
config_obj�f�erZdir_nameZsectionZoptionZscript_pathrrrr5as$
  zLoader._load_config_dataN)�__name__�
__module__�__qualname__�__doc__�	__slots__rr�classmethodr�propertyrr.r*r+r%r:r5rrrrr
sr)Ztuned.profiles.profilerZtuned.profiles.variablesZtuned.utils.config_parserrrZtuned.constsZconstsZos.pathrDrBZ
tuned.logsrZtuned.profiles.exceptionsrZlogsrGr"�objectrrrrr�<module>s

PK��\@
���"__pycache__/factory.cpython-36.pycnu�[���3

�<�e��@sddlZGdd�de�ZdS)�Nc@seZdZdd�ZdS)�FactorycCstjjj||�S)N)�tunedZprofilesZprofileZProfile)�self�name�config�r�/usr/lib/python3.6/factory.py�createszFactory.createN)�__name__�
__module__�__qualname__r	rrrrrsr)Ztuned.profiles.profiler�objectrrrrr�<module>sPK��\
_�"__pycache__/profile.cpython-36.pycnu�[���3

�<�en�@s.ddlZddljZddlZGdd�de�ZdS)�Nc@sleZdZdZdddgZdd�Zdd�Zd	d
�Zdd�Ze	d
d��Z
e
jdd��Z
e	dd��Ze	dd��Z
dS)�Profilez'
	Representation of a tuning profile.
	�_name�_options�_unitscCs||_|j|�|j|�dS)N)r�
_init_options�_init_units)�self�name�config�r�/usr/lib/python3.6/profile.py�__init__s
zProfile.__init__cCs$i|_tj|kr t|tj�|_dS)N)r�consts�PLUGIN_MAIN_UNIT_NAME�dict)rr
rrrrs
zProfile._init_optionscCs@tj�|_x0|D](}|tjkr|j|||�}||j|<qWdS)N)�collections�OrderedDictrrr�_create_unit)rr
Z	unit_nameZnew_unitrrrrs



zProfile._init_unitscCstjjj||�S)N)�tunedZprofilesZunitZUnit)rr	r
rrrrszProfile._create_unitcCs|jS)z
		Profile name.
		)r)rrrrr	 szProfile.namecCs
||_dS)N)r)r�valuerrrr	'scCs|jS)z$
		Units included in the profile.
		)r)rrrr�units+sz
Profile.unitscCs|jS)z
		Profile global options.
		)r)rrrr�options2szProfile.optionsN)�__name__�
__module__�__qualname__�__doc__�	__slots__r
rrr�propertyr	�setterrrrrrrrs
r)Ztuned.profiles.unitrZtuned.constsrr�objectrrrrr�<module>s
PK��\�\���#__pycache__/__init__.cpython-36.pycnu�[���3

�<�e�@sHddlTddlTddlTddlTddlTddlTddlTddlmZdS)�)�*�)�	functionsN)	Ztuned.profiles.locatorZtuned.profiles.loaderZtuned.profiles.profileZtuned.profiles.unitZtuned.profiles.exceptionsZtuned.profiles.factoryZtuned.profiles.merger�r�rr�/usr/lib/python3.6/__init__.py�<module>sPK��\Y��ll!__pycache__/loader.cpython-36.pycnu�[���3

�<�e��@stddlZddlZddlmZmZddljZddlZ	ddl
Z
ddlZddlZddl
mZejj�ZGdd�de�ZdS)�N)�ConfigParser�Error)�InvalidProfileExceptionc@sveZdZdZdddddgZdd�Zd	d
�Zedd��Ze	d
d��Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�ZdS)�Loaderz
	Profiles loader.
	�_profile_locator�_profile_merger�_profile_factory�_global_config�
_variablescCs"||_||_||_||_||_dS)N)rrrr	r
)�self�profile_locatorZprofile_factoryZprofile_mergerZ
global_config�	variables�r�/usr/lib/python3.6/loader.py�__init__s
zLoader.__init__cCstjjj||�S)N)�tuned�profiles�profileZProfile)r�profile_name�configrrr�_create_profileszLoader._create_profilecCstjd|�S)Nz^[a-zA-Z0-9_.-]+$)�re�match)�clsrrrr�	safe_nameszLoader.safe_namecCs|jS)N)r)rrrrr"szLoader.profile_locatorcCs�t|�tk	r|j�}tt|j|��}t|�dkr8td��t|�dkrZtjddj	|��ntjd|d�g}g}|j
|||�t|�dkr�|jj|�}n|d}dj	|�|_
d|jkr�|jj|jdj�|jd=|j|�|j|�|S)	Nrz.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
Zadd_from_cfg�options�_expand_vars_in_devices�_expand_vars_in_regexes)r�
profile_namesr�processed_filesZ
final_profilerrr�load&s*


zLoader.loadcCs0x*|jD] }|jj|j|j�|j|_qWdS)N)r(r
�expandZdevices)rr�unitrrrr*DszLoader._expand_vars_in_devicescCsLxF|jD]<}|jj|j|j�|j|_|jj|j|j�|j|_qWdS)N)r(r
r/Z
cpuinfo_regexZuname_regex)rrr0rrrr+HszLoader._expand_vars_in_regexesc	Cs�x�|D]�}|jj||�}|dkr"q|dkrFtd|tt|jj��f��|j|�|j|�}|jj	||�}d|j
kr�tjd|j
j|j
jd���}|j|||�|j|�qWdS)N�z!Cannot find profile '%s' in '%s'.�includez
\s*[,;]\s*)rZ
get_configrr�reversedZ_load_directories�append�_load_config_datarZcreater)rrr
r/�popr%)	rr,rr-r'�filenamerrZ
include_namesrrrr%Ms



zLoader._load_profilecCstjd||�S)Nz(?<!\\)\$\{i:PROFILE_DIR\})r�sub)rZprofile_dir�stringrrr�_expand_profile_dir^szLoader._expand_profile_dirc
Cs,y8tdddd�}t|_t|��}|j||�WdQRXWn2tjk
rj}ztd||��WYdd}~XnXtj	�}t
jj|�}x�t
|j��D]�}tj	�||<xF|j|�D]8}|j||dd�|||<|j||||�|||<q�W||jd�dk	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�dirnamerZsectionsr)�getr:r$�normpath)
r�	file_nameZ
config_obj�f�erZdir_nameZsectionZoptionZscript_pathrrrr5as$
  zLoader._load_config_dataN)�__name__�
__module__�__qualname__�__doc__�	__slots__rr�classmethodr�propertyrr.r*r+r%r:r5rrrrr
sr)Ztuned.profiles.profilerZtuned.profiles.variablesZtuned.utils.config_parserrrZtuned.constsZconstsZos.pathrDrBZ
tuned.logsrZtuned.profiles.exceptionsrZlogsrGr"�objectrrrrr�<module>s

PK��\$�0__pycache__/unit.cpython-36.pycnu�[���3

�<�e�	�@s$ddlZddlZGdd�de�ZdS)�Nc@sPeZdZdZdddddddd	d
ddd
gZdd�Zedd��Zedd��Zej	dd��Zedd��Z
e
j	dd��Z
edd��Zedd��Zej	dd��Zedd��Z
e
j	dd��Z
ed d!��Zej	d"d!��Zed#d$��Zej	d%d$��Zed&d'��Zej	d(d'��Zed)d*��Zej	d+d*��Zed,d-��Zej	d.d-��Zed/d0��Zej	d1d0��Zd2S)3�Unitz
	Unit description.
	�_name�_type�_enabled�_replace�_drop�_devices�_devices_udev_regex�_cpuinfo_regex�_uname_regex�_script_pre�_script_post�_optionscCs�||_|jd|j�|_|jdd�dk|_|jdd	�dk|_|jd
d�|_|jdk	rftjdt|j��|_|jdd
�|_	|jdd�|_
|jdd�|_|jdd�|_|jdd�|_
|jdd�|_tj|�|_dS)N�type�enabledT�True�true��1�replaceF�dropz\b\s*[,;]\s*�devices�*�devices_udev_regex�
cpuinfo_regex�uname_regex�
script_pre�script_post)Trrrr)Trrrr)r�poprrrr�re�split�strrr	r
rrr
�collections�OrderedDictr)�self�name�config�r'�/usr/lib/python3.6/unit.py�__init__s
z
Unit.__init__cCs|jS)N)r)r$r'r'r(r%sz	Unit.namecCs|jS)N)r)r$r'r'r(r sz	Unit.typecCs
||_dS)N)r)r$�valuer'r'r(r$scCs|jS)N)r)r$r'r'r(r(szUnit.enabledcCs
||_dS)N)r)r$r*r'r'r(r,scCs|jS)N)r)r$r'r'r(r0szUnit.replacecCs|jS)N)r)r$r'r'r(r4sz	Unit.dropcCs
||_dS)N)r)r$r*r'r'r(r8scCs|jS)N)r)r$r'r'r(r<szUnit.devicescCs
||_dS)N)r)r$r*r'r'r(r@scCs|jS)N)r	)r$r'r'r(rDszUnit.devices_udev_regexcCs
||_dS)N)r	)r$r*r'r'r(rHscCs|jS)N)r
)r$r'r'r(rLszUnit.cpuinfo_regexcCs
||_dS)N)r
)r$r*r'r'r(rPscCs|jS)N)r)r$r'r'r(rTszUnit.uname_regexcCs
||_dS)N)r)r$r*r'r'r(rXscCs|jS)N)r)r$r'r'r(r\szUnit.script_precCs
||_dS)N)r)r$r*r'r'r(r`scCs|jS)N)r
)r$r'r'r(rdszUnit.script_postcCs
||_dS)N)r
)r$r*r'r'r(rhscCs|jS)N)r)r$r'r'r(�optionslszUnit.optionscCs
||_dS)N)r)r$r*r'r'r(r+psN)�__name__�
__module__�__qualname__�__doc__�	__slots__r)�propertyr%r�setterrrrrrrrrrr+r'r'r'r(rs4r)r"r�objectrr'r'r'r(�<module>sPK��\q�Z/��*__pycache__/variables.cpython-36.opt-1.pycnu�[���3

�<�e$	�@sfddlZddlZddlZddlmZddljZddlmZddl	m
Z
mZejj
�ZGdd�d�ZdS)�N�)�	functions)�commands)�ConfigParser�Errorc@sXeZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dd�Zdd�ZdS)�	Variablesz8
	Storage and processing of variables used in profiles
	cCs"t�|_i|_i|_tj�|_dS)N)r�_cmd�
_lookup_re�_lookup_envrZ	Functions�
_functions)�self�r
�/usr/lib/python3.6/variables.py�__init__szVariables.__init__cCs|j|�dkr|S||S)Nr)�find)r�s�prefixr
r
r�_add_env_prefixszVariables._add_env_prefixcCstjd|�S)Nz\w+$)�re�match)r�variabler
r
r�
_check_varszVariables._check_varcCsj|dkrdSt|�}|j|�s0tjd|�dS|j|�}||jdtj|�d<||j|j	|t
j�<dS)Nz6variable definition '%s' contains unallowed charactersz
(?<!\\)\${�})�strr�log�error�expandr	r�escaper
r�constsZ
ENV_PREFIX)rr�valuer�vr
r
r�add_variables

zVariables.add_variablecCs�tjj|�stjd|�dSyLtddddd�}t|_t|��$}|j	dt
jd|j�|�WdQRXWn"t
k
r�tjd	|�dSXx<|j�D]0}x*|j|�D]}|j||j||dd
��q�Wq�WdS)Nz#unable to find variables_file: '%s'�=�#TF)Z
delimitersZinline_comment_prefixesZallow_no_value�strict�[z]
z"error parsing variables_file: '%s')�raw)�os�path�existsrrrrZoptionxform�openZread_stringrZMAGIC_HEADER_NAME�readrZsectionsZoptionsr!�get)r�filename�config�fr�or
r
r�
add_from_file+s
,zVariables.add_from_filecCsFx@|D]8}t|�dkr.|jtjj||��q|j|||�qWdS)N�include)rr1r'r(�normpathr!)rZcfg�itemr
r
r�add_from_cfg;s
zVariables.add_from_cfgcCstjdd|jj|j|��S)Nz\\(\${\w+})z\1)r�subrZmultiple_re_replacer	)rrr
r
r�
expand_staticCszVariables.expand_staticcCs&|dkrdS|jt|��}|jj|�S)N)r7rrr)rrrr
r
rrFszVariables.expandcCs|jS)N)r
)rr
r
r�get_envNszVariables.get_envN)
�__name__�
__module__�__qualname__�__doc__rrrr!r1r5r7rr8r
r
r
rrs
r)r'rZ
tuned.logsZtunedrZtuned.constsrZtuned.utils.commandsrZtuned.utils.config_parserrrZlogsr,rrr
r
r
r�<module>s

PK��\W��qxx(__pycache__/locator.cpython-36.opt-1.pycnu�[���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
PK��\pm�5TT!__pycache__/merger.cpython-36.pycnu�[���3

�<�e��@s(ddlZddlmZGdd�de�ZdS)�N)�reducec@s(eZdZdZdd�Zdd�Zdd�ZdS)	�Mergerz0
	Tool for merging multiple profiles into one.
	cCsdS)N�)�selfrr�/usr/lib/python3.6/merger.py�__init__	szMerger.__init__cCst|j|�}|S)z�
		Merge multiple configurations into one. If there are multiple units of the same type, option 'devices'
		is set for each unit with respect to eliminating any duplicate devices.
		)r�
_merge_two)rZconfigsZ
merged_configrrr�mergeszMerger.mergecCs�|jj|j��x�t|jj��D�]~\}}|js:||jkrF||j|<q |j|j|_|j|j|_|j|j|_|j	dk	r�|j	|j|_	|j
dk	r�|j
|j|_
|jdk	r�|j|j|_|jdk	r�|j|j|_|j
dk	r�|j
|j|_
|jdk	�rx"|jD]}|j|jj|d�q�Wd|_|dk�r�|j|jjdd�dk	�r�|j|jjdd�}|j|jj|j�||j|jd|j|jd<q |j|jj|j�q W|S)z�
		Merge two profiles. The configuration of units with matching names are updated with options
		from the newer profile. If the 'replace' options of the newer unit is 'True', all options from the
		older unit are dropped.
		N�script)Zoptions�update�listZunits�items�replace�typeZenabledZdevicesZdevices_udev_regexZ
cpuinfo_regexZuname_regexZ
script_preZscript_postZdrop�pop�get)rZ	profile_aZ	profile_bZ	unit_nameZunitZoptionr
rrrrs6




$"zMerger._merge_twoN)�__name__�
__module__�__qualname__�__doc__rr	rrrrrrsr)�collections�	functoolsr�objectrrrrr�<module>sPK��\?��4^^+__pycache__/exceptions.cpython-36.opt-1.pycnu�[���3

�<�e_�@s ddlZGdd�dejj�ZdS)�Nc@seZdZdS)�InvalidProfileExceptionN)�__name__�
__module__�__qualname__�rr� /usr/lib/python3.6/exceptions.pyrsr)Ztuned.exceptionsZtuned�
exceptionsZTunedExceptionrrrrr�<module>sPK��\$�0%__pycache__/unit.cpython-36.opt-1.pycnu�[���3

�<�e�	�@s$ddlZddlZGdd�de�ZdS)�Nc@sPeZdZdZdddddddd	d
ddd
gZdd�Zedd��Zedd��Zej	dd��Zedd��Z
e
j	dd��Z
edd��Zedd��Zej	dd��Zedd��Z
e
j	dd��Z
ed d!��Zej	d"d!��Zed#d$��Zej	d%d$��Zed&d'��Zej	d(d'��Zed)d*��Zej	d+d*��Zed,d-��Zej	d.d-��Zed/d0��Zej	d1d0��Zd2S)3�Unitz
	Unit description.
	�_name�_type�_enabled�_replace�_drop�_devices�_devices_udev_regex�_cpuinfo_regex�_uname_regex�_script_pre�_script_post�_optionscCs�||_|jd|j�|_|jdd�dk|_|jdd	�dk|_|jd
d�|_|jdk	rftjdt|j��|_|jdd
�|_	|jdd�|_
|jdd�|_|jdd�|_|jdd�|_
|jdd�|_tj|�|_dS)N�type�enabledT�True�true��1�replaceF�dropz\b\s*[,;]\s*�devices�*�devices_udev_regex�
cpuinfo_regex�uname_regex�
script_pre�script_post)Trrrr)Trrrr)r�poprrrr�re�split�strrr	r
rrr
�collections�OrderedDictr)�self�name�config�r'�/usr/lib/python3.6/unit.py�__init__s
z
Unit.__init__cCs|jS)N)r)r$r'r'r(r%sz	Unit.namecCs|jS)N)r)r$r'r'r(r sz	Unit.typecCs
||_dS)N)r)r$�valuer'r'r(r$scCs|jS)N)r)r$r'r'r(r(szUnit.enabledcCs
||_dS)N)r)r$r*r'r'r(r,scCs|jS)N)r)r$r'r'r(r0szUnit.replacecCs|jS)N)r)r$r'r'r(r4sz	Unit.dropcCs
||_dS)N)r)r$r*r'r'r(r8scCs|jS)N)r)r$r'r'r(r<szUnit.devicescCs
||_dS)N)r)r$r*r'r'r(r@scCs|jS)N)r	)r$r'r'r(rDszUnit.devices_udev_regexcCs
||_dS)N)r	)r$r*r'r'r(rHscCs|jS)N)r
)r$r'r'r(rLszUnit.cpuinfo_regexcCs
||_dS)N)r
)r$r*r'r'r(rPscCs|jS)N)r)r$r'r'r(rTszUnit.uname_regexcCs
||_dS)N)r)r$r*r'r'r(rXscCs|jS)N)r)r$r'r'r(r\szUnit.script_precCs
||_dS)N)r)r$r*r'r'r(r`scCs|jS)N)r
)r$r'r'r(rdszUnit.script_postcCs
||_dS)N)r
)r$r*r'r'r(rhscCs|jS)N)r)r$r'r'r(�optionslszUnit.optionscCs
||_dS)N)r)r$r*r'r'r(r+psN)�__name__�
__module__�__qualname__�__doc__�	__slots__r)�propertyr%r�setterrrrrrrrrrr+r'r'r'r(rs4r)r"r�objectrr'r'r'r(�<module>sPK��\
_�(__pycache__/profile.cpython-36.opt-1.pycnu�[���3

�<�en�@s.ddlZddljZddlZGdd�de�ZdS)�Nc@sleZdZdZdddgZdd�Zdd�Zd	d
�Zdd�Ze	d
d��Z
e
jdd��Z
e	dd��Ze	dd��Z
dS)�Profilez'
	Representation of a tuning profile.
	�_name�_options�_unitscCs||_|j|�|j|�dS)N)r�
_init_options�_init_units)�self�name�config�r�/usr/lib/python3.6/profile.py�__init__s
zProfile.__init__cCs$i|_tj|kr t|tj�|_dS)N)r�consts�PLUGIN_MAIN_UNIT_NAME�dict)rr
rrrrs
zProfile._init_optionscCs@tj�|_x0|D](}|tjkr|j|||�}||j|<qWdS)N)�collections�OrderedDictrrr�_create_unit)rr
Z	unit_nameZnew_unitrrrrs



zProfile._init_unitscCstjjj||�S)N)�tunedZprofilesZunitZUnit)rr	r
rrrrszProfile._create_unitcCs|jS)z
		Profile name.
		)r)rrrrr	 szProfile.namecCs
||_dS)N)r)r�valuerrrr	'scCs|jS)z$
		Units included in the profile.
		)r)rrrr�units+sz
Profile.unitscCs|jS)z
		Profile global options.
		)r)rrrr�options2szProfile.optionsN)�__name__�
__module__�__qualname__�__doc__�	__slots__r
rrr�propertyr	�setterrrrrrrrs
r)Ztuned.profiles.unitrZtuned.constsrr�objectrrrrr�<module>s
PK��\�\���)__pycache__/__init__.cpython-36.opt-1.pycnu�[���3

�<�e�@sHddlTddlTddlTddlTddlTddlTddlTddlmZdS)�)�*�)�	functionsN)	Ztuned.profiles.locatorZtuned.profiles.loaderZtuned.profiles.profileZtuned.profiles.unitZtuned.profiles.exceptionsZtuned.profiles.factoryZtuned.profiles.merger�r�rr�/usr/lib/python3.6/__init__.py�<module>sPK��\@
���(__pycache__/factory.cpython-36.opt-1.pycnu�[���3

�<�e��@sddlZGdd�de�ZdS)�Nc@seZdZdd�ZdS)�FactorycCstjjj||�S)N)�tunedZprofilesZprofileZProfile)�self�name�config�r�/usr/lib/python3.6/factory.py�createszFactory.createN)�__name__�
__module__�__qualname__r	rrrrrsr)Ztuned.profiles.profiler�objectrrrrr�<module>sPK��\��Snn
profile.pynu�[���import tuned.profiles.unit
import tuned.consts as consts
import collections

class Profile(object):
	"""
	Representation of a tuning profile.
	"""

	__slots__ = ["_name", "_options", "_units"]

	def __init__(self, name, config):
		self._name = name
		self._init_options(config)
		self._init_units(config)

	def _init_options(self, config):
		self._options = {}
		if consts.PLUGIN_MAIN_UNIT_NAME in config:
			self._options = dict(config[consts.PLUGIN_MAIN_UNIT_NAME])

	def _init_units(self, config):
		self._units = collections.OrderedDict()
		for unit_name in config:
			if unit_name != consts.PLUGIN_MAIN_UNIT_NAME:
				new_unit = self._create_unit(unit_name, config[unit_name])
				self._units[unit_name] = new_unit

	def _create_unit(self, name, config):
		return tuned.profiles.unit.Unit(name, config)

	@property
	def name(self):
		"""
		Profile name.
		"""
		return self._name

	@name.setter
	def name(self, value):
		self._name = value

	@property
	def units(self):
		"""
		Units included in the profile.
		"""
		return self._units

	@property
	def options(self):
		"""
		Profile global options.
		"""
		return self._options
PK��\o�__init__.pynu�[���from tuned.profiles.locator import *
from tuned.profiles.loader import *
from tuned.profiles.profile import *
from tuned.profiles.unit import *
from tuned.profiles.exceptions import *
from tuned.profiles.factory import *
from tuned.profiles.merger import *
from . import functions
PK��\�]���	�	unit.pynu�[���import collections
import re

class Unit(object):
	"""
	Unit description.
	"""

	__slots__ = [ "_name", "_type", "_enabled", "_replace", "_drop", "_devices", "_devices_udev_regex", \
		"_cpuinfo_regex", "_uname_regex", "_script_pre", "_script_post", "_options" ]

	def __init__(self, name, config):
		self._name = name
		self._type = config.pop("type", self._name)
		self._enabled = config.pop("enabled", True) in [True, "True", "true", 1, "1"]
		self._replace = config.pop("replace", False) in [True, "True", "true", 1, "1"]
		self._drop = config.pop("drop", None)
		if self._drop is not None:
			self._drop = re.split(r"\b\s*[,;]\s*", str(self._drop))
		self._devices = config.pop("devices", "*")
		self._devices_udev_regex = config.pop("devices_udev_regex", None)
		self._cpuinfo_regex = config.pop("cpuinfo_regex", None)
		self._uname_regex = config.pop("uname_regex", None)
		self._script_pre = config.pop("script_pre", None)
		self._script_post = config.pop("script_post", None)
		self._options = collections.OrderedDict(config)

	@property
	def name(self):
		return self._name

	@property
	def type(self):
		return self._type

	@type.setter
	def type(self, value):
		self._type = value

	@property
	def enabled(self):
		return self._enabled

	@enabled.setter
	def enabled(self, value):
		self._enabled = value

	@property
	def replace(self):
		return self._replace

	@property
	def drop(self):
		return self._drop

	@drop.setter
	def drop(self, value):
		self._drop = value

	@property
	def devices(self):
		return self._devices

	@devices.setter
	def devices(self, value):
		self._devices = value

	@property
	def devices_udev_regex(self):
		return self._devices_udev_regex

	@devices_udev_regex.setter
	def devices_udev_regex(self, value):
		self._devices_udev_regex = value

	@property
	def cpuinfo_regex(self):
		return self._cpuinfo_regex

	@cpuinfo_regex.setter
	def cpuinfo_regex(self, value):
		self._cpuinfo_regex = value

	@property
	def uname_regex(self):
		return self._uname_regex

	@uname_regex.setter
	def uname_regex(self, value):
		self._uname_regex = value

	@property
	def script_pre(self):
		return self._script_pre

	@script_pre.setter
	def script_pre(self, value):
		self._script_pre = value

	@property
	def script_post(self):
		return self._script_post

	@script_post.setter
	def script_post(self, value):
		self._script_post = value

	@property
	def options(self):
		return self._options

	@options.setter
	def options(self, value):
		self._options = value
PK��\R�5>��	merger.pynu�[���import collections
from functools import reduce

class Merger(object):
	"""
	Tool for merging multiple profiles into one.
	"""

	def __init__(self):
		pass

	def merge(self, configs):
		"""
		Merge multiple configurations into one. If there are multiple units of the same type, option 'devices'
		is set for each unit with respect to eliminating any duplicate devices.
		"""
		merged_config = reduce(self._merge_two, configs)
		return merged_config

	def _merge_two(self, profile_a, profile_b):
		"""
		Merge two profiles. The configuration of units with matching names are updated with options
		from the newer profile. If the 'replace' options of the newer unit is 'True', all options from the
		older unit are dropped.
		"""

		profile_a.options.update(profile_b.options)

		for unit_name, unit in list(profile_b.units.items()):
			if unit.replace or unit_name not in profile_a.units:
				profile_a.units[unit_name] = unit
			else:
				profile_a.units[unit_name].type = unit.type
				profile_a.units[unit_name].enabled = unit.enabled
				profile_a.units[unit_name].devices = unit.devices
				if unit.devices_udev_regex is not None:
					profile_a.units[unit_name].devices_udev_regex = unit.devices_udev_regex
				if unit.cpuinfo_regex is not None:
					profile_a.units[unit_name].cpuinfo_regex = unit.cpuinfo_regex
				if unit.uname_regex is not None:
					profile_a.units[unit_name].uname_regex = unit.uname_regex
				if unit.script_pre is not None:
					profile_a.units[unit_name].script_pre = unit.script_pre
				if unit.script_post is not None:
					profile_a.units[unit_name].script_post = unit.script_post
				if unit.drop is not None:
					for option in unit.drop:
						profile_a.units[unit_name].options.pop(option, None)
					unit.drop = None
				if unit_name == "script" and profile_a.units[unit_name].options.get("script", None) is not None:
					script = profile_a.units[unit_name].options.get("script", None)
					profile_a.units[unit_name].options.update(unit.options)
					profile_a.units[unit_name].options["script"] = script + profile_a.units[unit_name].options["script"]
				else:
					profile_a.units[unit_name].options.update(unit.options)

		return profile_a
PK��\��|��	loader.pynu�[���import tuned.profiles.profile
import tuned.profiles.variables
from tuned.utils.config_parser import ConfigParser, Error
import tuned.consts as consts
import os.path
import collections
import tuned.logs
import re
from tuned.profiles.exceptions import InvalidProfileException

log = tuned.logs.get()

class Loader(object):
	"""
	Profiles loader.
	"""

	__slots__ = ["_profile_locator", "_profile_merger", "_profile_factory", "_global_config", "_variables"]

	def __init__(self, profile_locator, profile_factory, profile_merger, global_config, variables):
		self._profile_locator = profile_locator
		self._profile_factory = profile_factory
		self._profile_merger = profile_merger
		self._global_config = global_config
		self._variables = variables

	def _create_profile(self, profile_name, config):
		return tuned.profiles.profile.Profile(profile_name, config)

	@classmethod
	def safe_name(cls, profile_name):
		return re.match(r'^[a-zA-Z0-9_.-]+$', profile_name)

	@property
	def profile_locator(self):
		return self._profile_locator

	def load(self, profile_names):
		if type(profile_names) is not list:
			profile_names = profile_names.split()

		profile_names = list(filter(self.safe_name, profile_names))
		if len(profile_names) == 0:
			raise InvalidProfileException("No profile or invalid profiles were specified.")

		if len(profile_names) > 1:
			log.info("loading profiles: %s" % ", ".join(profile_names))
		else:
			log.info("loading profile: %s" % profile_names[0])
		profiles = []
		processed_files = []
		self._load_profile(profile_names, profiles, processed_files)

		if len(profiles) > 1:
			final_profile = self._profile_merger.merge(profiles)
		else:
			final_profile = profiles[0]

		final_profile.name = " ".join(profile_names)
		if "variables" in final_profile.units:
			self._variables.add_from_cfg(final_profile.units["variables"].options)
			del(final_profile.units["variables"])
		# FIXME hack, do all variable expansions in one place
		self._expand_vars_in_devices(final_profile)
		self._expand_vars_in_regexes(final_profile)
		return final_profile

	def _expand_vars_in_devices(self, profile):
		for unit in profile.units:
			profile.units[unit].devices = self._variables.expand(profile.units[unit].devices)

	def _expand_vars_in_regexes(self, profile):
		for unit in profile.units:
			profile.units[unit].cpuinfo_regex = self._variables.expand(profile.units[unit].cpuinfo_regex)
			profile.units[unit].uname_regex = self._variables.expand(profile.units[unit].uname_regex)

	def _load_profile(self, profile_names, profiles, processed_files):
		for name in profile_names:
			filename = self._profile_locator.get_config(name, processed_files)
			if filename == "":
				continue
			if filename is None:
				raise InvalidProfileException("Cannot find profile '%s' in '%s'." % (name, list(reversed(self._profile_locator._load_directories))))
			processed_files.append(filename)

			config = self._load_config_data(filename)
			profile = self._profile_factory.create(name, config)
			if "include" in profile.options:
				include_names = re.split(r"\s*[,;]\s*", self._variables.expand(profile.options.pop("include")))
				self._load_profile(include_names, profiles, processed_files)

			profiles.append(profile)

	def _expand_profile_dir(self, profile_dir, string):
		return re.sub(r'(?<!\\)\$\{i:PROFILE_DIR\}', profile_dir, string)

	def _load_config_data(self, file_name):
		try:
			config_obj = ConfigParser(delimiters=('='), inline_comment_prefixes=('#'), strict=False)
			config_obj.optionxform=str
			with open(file_name) as f:
				config_obj.read_file(f, file_name)
		except Error.__bases__ as e:
			raise InvalidProfileException("Cannot parse '%s'." % file_name, e)

		config = collections.OrderedDict()
		dir_name = os.path.dirname(file_name)
		for section in list(config_obj.sections()):
			config[section] = collections.OrderedDict()
			for option in config_obj.options(section):
				config[section][option] = config_obj.get(section, option, raw=True)
				config[section][option] = self._expand_profile_dir(dir_name, config[section][option])
			if config[section].get("script") is not None:
				script_path = os.path.join(dir_name, config[section]["script"])
				config[section]["script"] = [os.path.normpath(script_path)]

		return config
PK��\�Ԇ���functions/function_s2kb.pynu�[���import os
import tuned.logs
from . import base
from tuned.utils.commands import commands

class s2kb(base.Function):
	"""
	Conversion function: sectors to kbytes
	"""
	def __init__(self):
		# 1 argument
		super(s2kb, self).__init__("s2kb", 1, 1)

	def execute(self, args):
		if not super(s2kb, self).execute(args):
			return None
		try:
			return str(int(round(int(args[0]) / 2)))
		except ValueError:
			return None
PK��\{I��Gfunctions/__pycache__/function_assertion_non_equal.cpython-36.opt-1.pycnu�[���3

�<�e+�@sTddlZddlZddlmZddlmZddlmZej	j
�ZGdd�dej�Z
dS)�N�)�base)�commands)�InvalidProfileExceptioncs,eZdZdZ�fdd�Z�fdd�Z�ZS)�assertion_non_equalz�
	Assertion non equal: compares argument 2 with argument 3. If they match
	it logs text from argument 1 and  throws InvalidProfileException. This
	exception will abort profile loading.
	cstt|�jddd�dS)Nr�)�superr�__init__)�self)�	__class__��2/usr/lib/python3.6/function_assertion_non_equal.pyr	szassertion_non_equal.__init__csXtt|�j|�sdS|d|dkrTtjd|d|d|df�td|d��dS)Nr�z#assertion '%s' failed: '%s' == '%s'rzAssertion '%s' failed.)rr�execute�log�errorr)r
�args)rrr
rs zassertion_non_equal.execute)�__name__�
__module__�__qualname__�__doc__r	r�
__classcell__rr)rr
r	sr)�osZ
tuned.logsZtuned�rZtuned.utils.commandsrZtuned.profiles.exceptionsrZlogs�getrZFunctionrrrrr
�<module>s
PK��\��z0OO3functions/__pycache__/function_strip.cpython-36.pycnu�[���3

�<�e��@s>ddlZddlZddlmZddlmZGdd�dej�ZdS)�N�)�base)�commandscs,eZdZdZ�fdd�Z�fdd�Z�ZS)�stripz0
	Makes string from all arguments and strip it
	cstt|�jddd�dS)Nrrr)�superr�__init__)�self)�	__class__��$/usr/lib/python3.6/function_strip.pyr
szstrip.__init__cs"tt|�j|�sdSdj|�j�S)N�)rr�execute�join)r�args)r	r
rr
sz
strip.execute)�__name__�
__module__�__qualname__�__doc__rr
�
__classcell__r
r
)r	rrsr)	�osZ
tuned.logsZtunedrrZtuned.utils.commandsrZFunctionrr
r
r
r�<module>sPK��\E�.Cfunctions/__pycache__/function_cpulist_present.cpython-36.opt-1.pycnu�[���3

�<�e��@sHddlZddlZddlmZddlmZejj�Z	Gdd�dej
�ZdS)�N�)�base)�commandscs,eZdZdZ�fdd�Z�fdd�Z�ZS)�cpulist_presentzY
	Checks whether CPUs from list are present, returns list containing
	only present CPUs
	cstt|�jdd�dS)Nrr)�superr�__init__)�self)�	__class__��./usr/lib/python3.6/function_cpulist_present.pyr
szcpulist_present.__init__csdtt|�j|�sdS|jjdj|��}|jj|jjd��}djdd�ttt	|�j
t	|����D��S)Nz,,z/sys/devices/system/cpu/present�,css|]}t|�VqdS)N)�str)�.0�vr
r
r�	<genexpr>sz*cpulist_present.execute.<locals>.<genexpr>)rr�executeZ_cmdZcpulist_unpack�joinZ	read_file�sorted�list�set�intersection)r�argsZcpusZpresent)r	r
rrs
zcpulist_present.execute)�__name__�
__module__�__qualname__�__doc__rr�
__classcell__r
r
)r	rrsr)�osZ
tuned.logsZtuned�rZtuned.utils.commandsrZlogs�get�logZFunctionrr
r
r
r�<module>s

PK��\Jb�o"">functions/__pycache__/function_virt_check.cpython-36.opt-1.pycnu�[���3

�<�eS�@s>ddlZddlZddlmZddlmZGdd�dej�ZdS)�N�)�base)�commandscs,eZdZdZ�fdd�Z�fdd�Z�ZS)�
virt_checkz�
	Checks whether running inside virtual machine (VM) or on bare metal.
	If running inside VM expands to argument 1, otherwise expands to
	argument 2 (even on error).
	cstt|�jddd�dS)Nr�)�superr�__init__)�self)�	__class__��)/usr/lib/python3.6/function_virt_check.pyrszvirt_check.__init__csJtt|�j|�sdS|jjdg�\}}|dkrBt|�dkrB|dS|dS)Nz	virt-whatrr)rr�executeZ_cmd�len)r	�args�ret�out)r
rrr
szvirt_check.execute)�__name__�
__module__�__qualname__�__doc__rr
�
__classcell__rr)r
rrsr)	�osZ
tuned.logsZtuned�rZtuned.utils.commandsrZFunctionrrrrr�<module>sPK��\��_5functions/__pycache__/repository.cpython-36.opt-1.pycnu�[���3

�<�e�@sTddlmZddlmZddlZddljZddlm	Z	ej
j�ZGdd�de�Z
dS)�)�PluginLoader�)�baseN)�commandscsHeZdZ�fdd�Zedd��Zdd�Zdd�Zd	d
�Zdd�Z	�Z
S)
�
Repositorycstt|�j�i|_dS)N)�superr�__init__�
_functions)�self)�	__class__�� /usr/lib/python3.6/repository.pyrszRepository.__init__cCs|jS)N)r	)r
rrr
�	functionsszRepository.functionscCs d|_tj|_tjjjj|_	dS)Nztuned.profiles.functions)
Z
_namespace�constsZFUNCTION_PREFIX�_prefix�tunedZprofilesrrZFunctionZ
_interface)r
rrr
�_set_loader_parameterssz!Repository._set_loader_parameterscCs,tjd|�|j|�}|�}||j|<|S)Nzcreating function %s)�log�debugZload_pluginr	)r
�
function_nameZfunction_clsZfunction_instancerrr
�creates


zRepository.createcCs||jkr|j|�S|j|S)N)r	r)r
rrrr
�	load_func!s

zRepository.load_funccCs>tjd|�x*t|jj��D]\}}||kr|j|=qWdS)Nzremoving function %s)rr�listr	�items)r
Zfunction�k�vrrr
�delete&szRepository.delete)�__name__�
__module__�__qualname__r�propertyrrrrr�
__classcell__rr)rr
r	s	r)Ztuned.utils.plugin_loaderr�rZ
tuned.logsrZtuned.constsrZtuned.utils.commandsrZlogs�getrrrrrr
�<module>s

PK��\�n��II<functions/__pycache__/function_cpulist_unpack.cpython-36.pycnu�[���3

�<�e��@sHddlZddlZddlmZddlmZejj�Z	Gdd�dej
�ZdS)�N�)�base)�commandscs,eZdZdZ�fdd�Z�fdd�Z�ZS)�cpulist_unpackzB
	Conversion function: unpacks CPU list in form 1-3,4 to 1,2,3,4
	cstt|�jdd�dS)Nrr)�superr�__init__)�self)�	__class__��-/usr/lib/python3.6/function_cpulist_unpack.pyrszcpulist_unpack.__init__cs6tt|�j|�sdSdjdd�|jjdj|��D��S)N�,css|]}t|�VqdS)N)�str)�.0�vr
r
r�	<genexpr>sz)cpulist_unpack.execute.<locals>.<genexpr>z,,)rr�execute�joinZ_cmd)r�args)r	r
rrszcpulist_unpack.execute)�__name__�
__module__�__qualname__�__doc__rr�
__classcell__r
r
)r	rrsr)�osZ
tuned.logsZtuned�rZtuned.utils.commandsrZlogs�get�logZFunctionrr
r
r
r�<module>s

PK��\���jTTCfunctions/__pycache__/function_check_net_queue_count.cpython-36.pycnu�[���3

�<�e��@s4ddlZddlmZejj�ZGdd�dej�ZdS)�N�)�basecs,eZdZdZ�fdd�Z�fdd�Z�ZS)�check_net_queue_countz�
	Checks whether the user has specified a queue count for net devices. If
        not, return the number of housekeeping CPUs.
	cstt|�jddd�dS)Nrr)�superr�__init__)�self)�	__class__��4/usr/lib/python3.6/function_check_net_queue_count.pyrszcheck_net_queue_count.__init__csLtt|�j|�sdS|dj�r(|dS|jjdg�\}}tjd|�|S)NrZnproczHnet-dev queue count is not correctly specified, setting it to HK CPUs %s)rr�execute�isdigitZ_cmd�log�warn)r�args�ret�out)rr	r
rszcheck_net_queue_count.execute)�__name__�
__module__�__qualname__�__doc__rr�
__classcell__r	r	)rr
rsr)	Z
tuned.logsZtuned�rZlogs�getr
ZFunctionrr	r	r	r
�<module>s
PK��\ށ��||@functions/__pycache__/function_cpulist2hex_invert.cpython-36.pycnu�[���3

�<�ep�@sHddlZddlZddlmZddlmZejj�Z	Gdd�dej
�ZdS)�N�)�base)�commandscs,eZdZdZ�fdd�Z�fdd�Z�ZS)�cpulist2hex_invertz<
	Converts CPU list to hexadecimal CPU mask and inverts it
	cstt|�jdd�dS)Nrr)�superr�__init__)�self)�	__class__��1/usr/lib/python3.6/function_cpulist2hex_invert.pyrszcpulist2hex_invert.__init__cs>tt|�j|�sdS|jjdjdd�|jjdj|��D���S)N�,css|]}t|�VqdS)N)�str)�.0�vr
r
r�	<genexpr>sz-cpulist2hex_invert.execute.<locals>.<genexpr>z,,)rr�executeZ_cmdZcpulist2hex�joinZcpulist_invert)r�args)r	r
rrszcpulist2hex_invert.execute)�__name__�
__module__�__qualname__�__doc__rr�
__classcell__r
r
)r	rrsr)�osZ
tuned.logsZtuned�rZtuned.utils.commandsrZlogs�get�logZFunctionrr
r
r
r�<module>s

PK��\q{nn2functions/__pycache__/function_exec.cpython-36.pycnu�[���3

�<�e��@s>ddlZddlZddlmZddlmZGdd�dej�ZdS)�N�)�base)�commandscs,eZdZdZ�fdd�Z�fdd�Z�ZS)�executez0
	Executes process and substitutes its output.
	cstt|�jddd�dS)N�execrr)�superr�__init__)�self)�	__class__��#/usr/lib/python3.6/function_exec.pyr
szexecute.__init__cs4tt|�j|�sdS|jj|�\}}|dkr0|SdS)Nr)rrZ_cmd)r	�args�ret�out)r
rrrszexecute.execute)�__name__�
__module__�__qualname__�__doc__rr�
__classcell__rr)r
rrsr)	�osZ
tuned.logsZtuned�rZtuned.utils.commandsrZFunctionrrrrr�<module>sPK��\1?����<functions/__pycache__/function_cpulist_invert.cpython-36.pycnu�[���3

�<�e��@sHddlZddlZddlmZddlmZejj�Z	Gdd�dej
�ZdS)�N�)�base)�commandscs,eZdZdZ�fdd�Z�fdd�Z�ZS)�cpulist_invertz�
	Inverts list of CPUs (makes its complement). For the complement it
	gets number of online CPUs from the /sys/devices/system/cpu/online,
	e.g. system with 4 CPUs (0-3), the inversion of list "0,2,3" will be
	"1"
	cstt|�jdd�dS)Nrr)�superr�__init__)�self)�	__class__��-/usr/lib/python3.6/function_cpulist_invert.pyrszcpulist_invert.__init__cs6tt|�j|�sdSdjdd�|jjdj|��D��S)N�,css|]}t|�VqdS)N)�str)�.0�vr
r
r�	<genexpr>sz)cpulist_invert.execute.<locals>.<genexpr>z,,)rr�execute�joinZ_cmd)r�args)r	r
rrszcpulist_invert.execute)�__name__�
__module__�__qualname__�__doc__rr�
__classcell__r
r
)r	rrsr)�osZ
tuned.logsZtuned�rZtuned.utils.commandsrZlogs�get�logZFunctionrr
r
r
r�<module>s

PK��\k1���:functions/__pycache__/function_cpulist_pack.cpython-36.pycnu�[���3

�<�e}�@sHddlZddlZddlmZddlmZejj�Z	Gdd�dej
�ZdS)�N�)�base)�commandscs,eZdZdZ�fdd�Z�fdd�Z�ZS)�cpulist_packz�
	Conversion function: packs CPU list in form 1,2,3,5 to 1-3,5.
	The cpulist_unpack is used as a preprocessor, so it always returns
	optimal results. For details about input syntax see cpulist_unpack.
	cstt|�jdd�dS)Nrr)�superr�__init__)�self)�	__class__��+/usr/lib/python3.6/function_cpulist_pack.pyrszcpulist_pack.__init__cs6tt|�j|�sdSdjdd�|jjdj|��D��S)N�,css|]}t|�VqdS)N)�str)�.0�vr
r
r�	<genexpr>sz'cpulist_pack.execute.<locals>.<genexpr>z,,)rr�execute�joinZ_cmd)r�args)r	r
rrszcpulist_pack.execute)�__name__�
__module__�__qualname__�__doc__rr�
__classcell__r
r
)r	rrsr)�osZ
tuned.logsZtuned�rZtuned.utils.commandsrZlogs�get�logZFunctionrr
r
r
r�<module>s

PK��\ށ��||Ffunctions/__pycache__/function_cpulist2hex_invert.cpython-36.opt-1.pycnu�[���3

�<�ep�@sHddlZddlZddlmZddlmZejj�Z	Gdd�dej
�ZdS)�N�)�base)�commandscs,eZdZdZ�fdd�Z�fdd�Z�ZS)�cpulist2hex_invertz<
	Converts CPU list to hexadecimal CPU mask and inverts it
	cstt|�jdd�dS)Nrr)�superr�__init__)�self)�	__class__��1/usr/lib/python3.6/function_cpulist2hex_invert.pyrszcpulist2hex_invert.__init__cs>tt|�j|�sdS|jjdjdd�|jjdj|��D���S)N�,css|]}t|�VqdS)N)�str)�.0�vr
r
r�	<genexpr>sz-cpulist2hex_invert.execute.<locals>.<genexpr>z,,)rr�executeZ_cmdZcpulist2hex�joinZcpulist_invert)r�args)r	r
rrszcpulist2hex_invert.execute)�__name__�
__module__�__qualname__�__doc__rr�
__classcell__r
r
)r	rrsr)�osZ
tuned.logsZtuned�rZtuned.utils.commandsrZlogs�get�logZFunctionrr
r
r
r�<module>s

PK��\�n��IIBfunctions/__pycache__/function_cpulist_unpack.cpython-36.opt-1.pycnu�[���3

�<�e��@sHddlZddlZddlmZddlmZejj�Z	Gdd�dej
�ZdS)�N�)�base)�commandscs,eZdZdZ�fdd�Z�fdd�Z�ZS)�cpulist_unpackzB
	Conversion function: unpacks CPU list in form 1-3,4 to 1,2,3,4
	cstt|�jdd�dS)Nrr)�superr�__init__)�self)�	__class__��-/usr/lib/python3.6/function_cpulist_unpack.pyrszcpulist_unpack.__init__cs6tt|�j|�sdSdjdd�|jjdj|��D��S)N�,css|]}t|�VqdS)N)�str)�.0�vr
r
r�	<genexpr>sz)cpulist_unpack.execute.<locals>.<genexpr>z,,)rr�execute�joinZ_cmd)r�args)r	r
rrszcpulist_unpack.execute)�__name__�
__module__�__qualname__�__doc__rr�
__classcell__r
r
)r	rrsr)�osZ
tuned.logsZtuned�rZtuned.utils.commandsrZlogs�get�logZFunctionrr
r
r
r�<module>s

PK��\A�f�;;?functions/__pycache__/function_hex2cpulist.cpython-36.opt-1.pycnu�[���3

�<�e��@sHddlZddlZddlmZddlmZejj�Z	Gdd�dej
�ZdS)�N�)�base)�commandscs,eZdZdZ�fdd�Z�fdd�Z�ZS)�hex2cpulistzB
	Conversion function: converts hexadecimal CPU mask to CPU list
	cstt|�jddd�dS)Nrr)�superr�__init__)�self)�	__class__��*/usr/lib/python3.6/function_hex2cpulist.pyrszhex2cpulist.__init__cs4tt|�j|�sdSdjdd�|jj|d�D��S)N�,css|]}t|�VqdS)N)�str)�.0�vr
r
r�	<genexpr>sz&hex2cpulist.execute.<locals>.<genexpr>r)rr�execute�joinZ_cmd)r�args)r	r
rrszhex2cpulist.execute)�__name__�
__module__�__qualname__�__doc__rr�
__classcell__r
r
)r	rrsr)�osZ
tuned.logsZtuned�rZtuned.utils.commandsrZlogs�get�logZFunctionrr
r
r
r�<module>s

PK��\�
��{{2functions/__pycache__/function_kb2s.cpython-36.pycnu�[���3

�<�e��@s>ddlZddlZddlmZddlmZGdd�dej�ZdS)�N�)�base)�commandscs,eZdZdZ�fdd�Z�fdd�Z�ZS)�kb2sz*
	Conversion function: kbytes to sectors
	cstt|�jddd�dS)Nrr)�superr�__init__)�self)�	__class__��#/usr/lib/python3.6/function_kb2s.pyr
sz
kb2s.__init__csBtt|�j|�sdSytt|d�d�Stk
r<dSXdS)Nr�)rr�execute�str�int�
ValueError)r�args)r	r
rr
szkb2s.execute)�__name__�
__module__�__qualname__�__doc__rr
�
__classcell__r
r
)r	rrsr)	�osZ
tuned.logsZtuned�rZtuned.utils.commandsrZFunctionrr
r
r
r�<module>sPK��\{I��Afunctions/__pycache__/function_assertion_non_equal.cpython-36.pycnu�[���3

�<�e+�@sTddlZddlZddlmZddlmZddlmZej	j
�ZGdd�dej�Z
dS)�N�)�base)�commands)�InvalidProfileExceptioncs,eZdZdZ�fdd�Z�fdd�Z�ZS)�assertion_non_equalz�
	Assertion non equal: compares argument 2 with argument 3. If they match
	it logs text from argument 1 and  throws InvalidProfileException. This
	exception will abort profile loading.
	cstt|�jddd�dS)Nr�)�superr�__init__)�self)�	__class__��2/usr/lib/python3.6/function_assertion_non_equal.pyr	szassertion_non_equal.__init__csXtt|�j|�sdS|d|dkrTtjd|d|d|df�td|d��dS)Nr�z#assertion '%s' failed: '%s' == '%s'rzAssertion '%s' failed.)rr�execute�log�errorr)r
�args)rrr
rs zassertion_non_equal.execute)�__name__�
__module__�__qualname__�__doc__r	r�
__classcell__rr)rr
r	sr)�osZ
tuned.logsZtuned�rZtuned.utils.commandsrZtuned.profiles.exceptionsrZlogs�getrZFunctionrrrrr
�<module>s
PK��\AL����Bfunctions/__pycache__/function_regex_search_ternary.cpython-36.pycnu�[���3

�<�e*�@s*ddlZddlmZGdd�dej�ZdS)�N�)�basecs,eZdZdZ�fdd�Z�fdd�Z�ZS)�regex_search_ternaryz�
	Ternary regex operator, it takes arguments in the following form
	STR1, REGEX, STR2, STR3
	If REGEX matches STR1 (re.search is used), STR2 is returned,
	otherwise STR3 is returned
	cstt|�jddd�dS)Nr�)�superr�__init__)�self)�	__class__��3/usr/lib/python3.6/function_regex_search_ternary.pyrszregex_search_ternary.__init__cs<tt|�j|�sdStj|d|d�r0|dS|dSdS)Nrr��)rr�execute�re�search)r�args)r	r
rrs
zregex_search_ternary.execute)�__name__�
__module__�__qualname__�__doc__rr�
__classcell__r
r
)r	rrsr)r�rZFunctionrr
r
r
r�<module>sPK��\3�wBB.functions/__pycache__/functions.cpython-36.pycnu�[���3

�<�eb�@sdddlZddlZddlZddlmZddlZddljZddl	m
Z
ejj�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
	cCstj�|_|j�dS)N)rZ
Repository�_repository�_parse_init)�self�r	�/usr/lib/python3.6/functions.py�__init__s
zFunctions.__init__�cCs&d|_||_t|�|_g|_d|_dS)NrF)�_cnt�_str�len�_len�_stack�_esc)r�sr	r	r
rs

zFunctions._parse_initcCs|j|jkr|j|jSdS)Nr)r
rr)rr	r	r
�
_curr_charszFunctions._curr_charcCs|j|j|j|�S)N)rr
)rrr	r	r
�_curr_substr szFunctions._curr_substrcCs|jj||jf�dS)N)r�appendr
)r�escr	r	r
�	_push_pos#szFunctions._push_poscCsd|jd|�||j|dd�|_t|j�|_|jt|�||d7_|jdkr`d|_dS)Nrr)rrrr
)r�a�brr	r	r
�_sub&s
&
zFunctions._subcCs�tjd|j||j��}|ddkr(dSdd�|D�}tjd|d�s\tjd|d�dSy|jj|d�}Wn&t	k
r�tjd	|d�dSX|j
|d
d��}|dkr�dS|j||j|�dS)Nz(?<!\\):rz${fcSsg|]}t|�jdd��qS)z\:�:)�str�replace)�.0�vr	r	r
�
<listcomp>1sz+Functions._process_func.<locals>.<listcomp>z\w+$rzinvalid function name '%s'zfunction '%s' not implemented�)�re�splitrr
�match�log�errorrZ	load_func�ImportErrorZexecuter)rZ_fromZsl�frr	r	r
�
_process_func-s zFunctions._process_funccCs�|j|�x�|j|jkr�|j�dkrpy|jj�}Wn$tk
rVtjd|�|j	SX|ds�|j
|d�n|jd�dkr�|j|j
�|j�dkr�d|_
nd	|_
|jd7_qWt|j�r�tjd
|�|j	S)N�}z.invalid variable syntax, non pair '}' in: '%s'rrr"z${�\TFz.invalid variable syntax, non pair '{' in: '%s')rr
rrr�pop�
IndexErrorr&r'rr*rrrr)rrZsir	r	r
�_process?s&

zFunctions._processcCs(|dks|dkr|Stjdd|j|��S)Nrz\\(\${f:.*})z\1)r#�subr/)rrr	r	r
�expandVszFunctions.expandN)r)
�__name__�
__module__�__qualname__�__doc__rrrrrrr*r/r1r	r	r	r
r
s
r)�osr#ZglobrrZ
tuned.logsZtunedZtuned.constsZconstsZtuned.utils.commandsrZlogs�getr&�cmdrr	r	r	r
�<module>s

PK��\����<functions/__pycache__/function_cpulist_online.cpython-36.pycnu�[���3

�<�e��@sHddlZddlZddlmZddlmZejj�Z	Gdd�dej
�ZdS)�N�)�base)�commandscs,eZdZdZ�fdd�Z�fdd�Z�ZS)�cpulist_onlinezW
	Checks whether CPUs from list are online, returns list containing
	only online CPUs
	cstt|�jdd�dS)Nrr)�superr�__init__)�self)�	__class__��-/usr/lib/python3.6/function_cpulist_online.pyr
szcpulist_online.__init__csRtt|�j|�sdS|jjdj|��}|jj|jjd���dj�fdd�|D��S)N�,z/sys/devices/system/cpu/onlinec3s|]}|�krt|�VqdS)N)�str)�.0�v)�onliner
r�	<genexpr>sz)cpulist_online.execute.<locals>.<genexpr>)rr�executeZ_cmdZcpulist_unpack�joinZ	read_file)r�argsZcpus)r	)rrrs
zcpulist_online.execute)�__name__�
__module__�__qualname__�__doc__rr�
__classcell__r
r
)r	rrsr)�osZ
tuned.logsZtuned�rZtuned.utils.commandsrZlogs�get�logZFunctionrr
r
r
r�<module>s

PK��\��!B��8functions/__pycache__/function_s2kb.cpython-36.opt-1.pycnu�[���3

�<�e��@s>ddlZddlZddlmZddlmZGdd�dej�ZdS)�N�)�base)�commandscs,eZdZdZ�fdd�Z�fdd�Z�ZS)�s2kbz*
	Conversion function: sectors to kbytes
	cstt|�jddd�dS)Nrr)�superr�__init__)�self)�	__class__��#/usr/lib/python3.6/function_s2kb.pyr
sz
s2kb.__init__csJtt|�j|�sdSytttt|d�d���Stk
rDdSXdS)Nr�)rr�execute�str�int�round�
ValueError)r�args)r	r
rr
szs2kb.execute)�__name__�
__module__�__qualname__�__doc__rr
�
__classcell__r
r
)r	rrsr)	�osZ
tuned.logsZtuned�rZtuned.utils.commandsrZFunctionrr
r
r
r�<module>sPK��\��!B��2functions/__pycache__/function_s2kb.cpython-36.pycnu�[���3

�<�e��@s>ddlZddlZddlmZddlmZGdd�dej�ZdS)�N�)�base)�commandscs,eZdZdZ�fdd�Z�fdd�Z�ZS)�s2kbz*
	Conversion function: sectors to kbytes
	cstt|�jddd�dS)Nrr)�superr�__init__)�self)�	__class__��#/usr/lib/python3.6/function_s2kb.pyr
sz
s2kb.__init__csJtt|�j|�sdSytttt|d�d���Stk
rDdSXdS)Nr�)rr�execute�str�int�round�
ValueError)r�args)r	r
rr
szs2kb.execute)�__name__�
__module__�__qualname__�__doc__rr
�
__classcell__r
r
)r	rrsr)	�osZ
tuned.logsZtuned�rZtuned.utils.commandsrZFunctionrr
r
r
r�<module>sPK��\�
��{{8functions/__pycache__/function_kb2s.cpython-36.opt-1.pycnu�[���3

�<�e��@s>ddlZddlZddlmZddlmZGdd�dej�ZdS)�N�)�base)�commandscs,eZdZdZ�fdd�Z�fdd�Z�ZS)�kb2sz*
	Conversion function: kbytes to sectors
	cstt|�jddd�dS)Nrr)�superr�__init__)�self)�	__class__��#/usr/lib/python3.6/function_kb2s.pyr
sz
kb2s.__init__csBtt|�j|�sdSytt|d�d�Stk
r<dSXdS)Nr�)rr�execute�str�int�
ValueError)r�args)r	r
rr
szkb2s.execute)�__name__�
__module__�__qualname__�__doc__rr
�
__classcell__r
r
)r	rrsr)	�osZ
tuned.logsZtuned�rZtuned.utils.commandsrZFunctionrr
r
r
r�<module>sPK��\AL����Hfunctions/__pycache__/function_regex_search_ternary.cpython-36.opt-1.pycnu�[���3

�<�e*�@s*ddlZddlmZGdd�dej�ZdS)�N�)�basecs,eZdZdZ�fdd�Z�fdd�Z�ZS)�regex_search_ternaryz�
	Ternary regex operator, it takes arguments in the following form
	STR1, REGEX, STR2, STR3
	If REGEX matches STR1 (re.search is used), STR2 is returned,
	otherwise STR3 is returned
	cstt|�jddd�dS)Nr�)�superr�__init__)�self)�	__class__��3/usr/lib/python3.6/function_regex_search_ternary.pyrszregex_search_ternary.__init__cs<tt|�j|�sdStj|d|d�r0|dS|dSdS)Nrr��)rr�execute�re�search)r�args)r	r
rrs
zregex_search_ternary.execute)�__name__�
__module__�__qualname__�__doc__rr�
__classcell__r
r
)r	rrsr)r�rZFunctionrr
r
r
r�<module>sPK��\E�.=functions/__pycache__/function_cpulist_present.cpython-36.pycnu�[���3

�<�e��@sHddlZddlZddlmZddlmZejj�Z	Gdd�dej
�ZdS)�N�)�base)�commandscs,eZdZdZ�fdd�Z�fdd�Z�ZS)�cpulist_presentzY
	Checks whether CPUs from list are present, returns list containing
	only present CPUs
	cstt|�jdd�dS)Nrr)�superr�__init__)�self)�	__class__��./usr/lib/python3.6/function_cpulist_present.pyr
szcpulist_present.__init__csdtt|�j|�sdS|jjdj|��}|jj|jjd��}djdd�ttt	|�j
t	|����D��S)Nz,,z/sys/devices/system/cpu/present�,css|]}t|�VqdS)N)�str)�.0�vr
r
r�	<genexpr>sz*cpulist_present.execute.<locals>.<genexpr>)rr�executeZ_cmdZcpulist_unpack�joinZ	read_file�sorted�list�set�intersection)r�argsZcpusZpresent)r	r
rrs
zcpulist_present.execute)�__name__�
__module__�__qualname__�__doc__rr�
__classcell__r
r
)r	rrsr)�osZ
tuned.logsZtuned�rZtuned.utils.commandsrZlogs�get�logZFunctionrr
r
r
r�<module>s

PK��\����Bfunctions/__pycache__/function_cpulist_online.cpython-36.opt-1.pycnu�[���3

�<�e��@sHddlZddlZddlmZddlmZejj�Z	Gdd�dej
�ZdS)�N�)�base)�commandscs,eZdZdZ�fdd�Z�fdd�Z�ZS)�cpulist_onlinezW
	Checks whether CPUs from list are online, returns list containing
	only online CPUs
	cstt|�jdd�dS)Nrr)�superr�__init__)�self)�	__class__��-/usr/lib/python3.6/function_cpulist_online.pyr
szcpulist_online.__init__csRtt|�j|�sdS|jjdj|��}|jj|jjd���dj�fdd�|D��S)N�,z/sys/devices/system/cpu/onlinec3s|]}|�krt|�VqdS)N)�str)�.0�v)�onliner
r�	<genexpr>sz)cpulist_online.execute.<locals>.<genexpr>)rr�executeZ_cmdZcpulist_unpack�joinZ	read_file)r�argsZcpus)r	)rrrs
zcpulist_online.execute)�__name__�
__module__�__qualname__�__doc__rr�
__classcell__r
r
)r	rrsr)�osZ
tuned.logsZtuned�rZtuned.utils.commandsrZlogs�get�logZFunctionrr
r
r
r�<module>s

PK��\�m���-functions/__pycache__/__init__.cpython-36.pycnu�[���3

�<�e#�@sddlmZdS)�)�
RepositoryN)Z
repositoryr�rr�/usr/lib/python3.6/__init__.py�<module>sPK��\1?����Bfunctions/__pycache__/function_cpulist_invert.cpython-36.opt-1.pycnu�[���3

�<�e��@sHddlZddlZddlmZddlmZejj�Z	Gdd�dej
�ZdS)�N�)�base)�commandscs,eZdZdZ�fdd�Z�fdd�Z�ZS)�cpulist_invertz�
	Inverts list of CPUs (makes its complement). For the complement it
	gets number of online CPUs from the /sys/devices/system/cpu/online,
	e.g. system with 4 CPUs (0-3), the inversion of list "0,2,3" will be
	"1"
	cstt|�jdd�dS)Nrr)�superr�__init__)�self)�	__class__��-/usr/lib/python3.6/function_cpulist_invert.pyrszcpulist_invert.__init__cs6tt|�j|�sdSdjdd�|jjdj|��D��S)N�,css|]}t|�VqdS)N)�str)�.0�vr
r
r�	<genexpr>sz)cpulist_invert.execute.<locals>.<genexpr>z,,)rr�execute�joinZ_cmd)r�args)r	r
rrszcpulist_invert.execute)�__name__�
__module__�__qualname__�__doc__rr�
__classcell__r
r
)r	rrsr)�osZ
tuned.logsZtuned�rZtuned.utils.commandsrZlogs�get�logZFunctionrr
r
r
r�<module>s

PK��\��D��=functions/__pycache__/function_assertion.cpython-36.opt-1.pycnu�[���3

�<�e��@sTddlZddlZddlmZddlmZddlmZej	j
�ZGdd�dej�Z
dS)�N�)�base)�commands)�InvalidProfileExceptioncs,eZdZdZ�fdd�Z�fdd�Z�ZS)�	assertionz�
	Assertion: compares argument 2 with argument 3. If they don't match
	it logs text from argument 1 and  throws InvalidProfileException. This
	exception will abort profile loading.
	cstt|�jddd�dS)Nr�)�superr�__init__)�self)�	__class__��(/usr/lib/python3.6/function_assertion.pyr	szassertion.__init__csXtt|�j|�sdS|d|dkrTtjd|d|d|df�td|d��dS)Nr�z#assertion '%s' failed: '%s' != '%s'rzAssertion '%s' failed.)rr�execute�log�errorr)r
�args)rrr
rs zassertion.execute)�__name__�
__module__�__qualname__�__doc__r	r�
__classcell__rr)rr
r	sr)�osZ
tuned.logsZtuned�rZtuned.utils.commandsrZtuned.profiles.exceptionsrZlogs�getrZFunctionrrrrr
�<module>s
PK��\q{nn8functions/__pycache__/function_exec.cpython-36.opt-1.pycnu�[���3

�<�e��@s>ddlZddlZddlmZddlmZGdd�dej�ZdS)�N�)�base)�commandscs,eZdZdZ�fdd�Z�fdd�Z�ZS)�executez0
	Executes process and substitutes its output.
	cstt|�jddd�dS)N�execrr)�superr�__init__)�self)�	__class__��#/usr/lib/python3.6/function_exec.pyr
szexecute.__init__cs4tt|�j|�sdS|jj|�\}}|dkr0|SdS)Nr)rrZ_cmd)r	�args�ret�out)r
rrrszexecute.execute)�__name__�
__module__�__qualname__�__doc__rr�
__classcell__rr)r
rrsr)	�osZ
tuned.logsZtuned�rZtuned.utils.commandsrZFunctionrrrrr�<module>sPK��\Jb�o""8functions/__pycache__/function_virt_check.cpython-36.pycnu�[���3

�<�eS�@s>ddlZddlZddlmZddlmZGdd�dej�ZdS)�N�)�base)�commandscs,eZdZdZ�fdd�Z�fdd�Z�ZS)�
virt_checkz�
	Checks whether running inside virtual machine (VM) or on bare metal.
	If running inside VM expands to argument 1, otherwise expands to
	argument 2 (even on error).
	cstt|�jddd�dS)Nr�)�superr�__init__)�self)�	__class__��)/usr/lib/python3.6/function_virt_check.pyrszvirt_check.__init__csJtt|�j|�sdS|jjdg�\}}|dkrBt|�dkrB|dS|dS)Nz	virt-whatrr)rr�executeZ_cmd�len)r	�args�ret�out)r
rrr
szvirt_check.execute)�__name__�
__module__�__qualname__�__doc__rr
�
__classcell__rr)r
rrsr)	�osZ
tuned.logsZtuned�rZtuned.utils.commandsrZFunctionrrrrr�<module>sPK��\�m���3functions/__pycache__/__init__.cpython-36.opt-1.pycnu�[���3

�<�e#�@sddlmZdS)�)�
RepositoryN)Z
repositoryr�rr�/usr/lib/python3.6/__init__.py�<module>sPK��\[5����Afunctions/__pycache__/function_cpuinfo_check.cpython-36.opt-1.pycnu�[���3

�<�e��@s<ddlZddlZddlmZejj�ZGdd�dej�Z	dS)�N�)�basecs,eZdZdZ�fdd�Z�fdd�Z�ZS)�
cpuinfo_checka�
	Checks regexes against /proc/cpuinfo. Accepts arguments in the
	following form: REGEX1, STR1, REGEX2, STR2, ...[, STR_FALLBACK]
	If REGEX1 matches something in /proc/cpuinfo it expands to STR1,
	if REGEX2 matches it expands to STR2. It stops on the first match,
	i.e. if REGEX1 matches, no more regexes are processed. If none
	regex matches it expands to STR_FALLBACK. If there is no fallback,
	it expands to empty string.
	cstt|�jddd�dS)Nrr�)�superr�__init__)�self)�	__class__��,/usr/lib/python3.6/function_cpuinfo_check.pyrszcpuinfo_check.__init__cs�tt|�j|�sdS|jjd�}xHtdt|�d�D]4}|dt|�kr2tj|||tj	�r2||dSq2Wt|�dr~|dSdSdS)Nz
/proc/cpuinforrr����)
rr�executeZ_cmdZ	read_file�range�len�re�search�	MULTILINE)r�argsZcpuinfo�i)r	r
rrszcpuinfo_check.execute)�__name__�
__module__�__qualname__�__doc__rr�
__classcell__r
r
)r	rrs	r)
rZ
tuned.logsZtunedrrZlogs�get�logZFunctionrr
r
r
r�<module>s
PK��\�}�22Gfunctions/__pycache__/function_calc_isolated_cores.cpython-36.opt-1.pycnu�[���3

�<�ek�@sNddlZddlZddlZddlmZddljZejj	�Z
Gdd�dej�ZdS)�N�)�basecs,eZdZdZ�fdd�Z�fdd�Z�ZS)�calc_isolated_coresz�
	Calculates and returns isolated cores. The argument specifies how many
	cores per socket reserve for housekeeping. If not specified, 1 core
	per socket is reserved for housekeeping and the rest is isolated.
	cstt|�jdd�dS)Nrr)�superr�__init__)�self)�	__class__��2/usr/lib/python3.6/function_calc_isolated_cores.pyrszcalc_isolated_cores.__init__c
sPtt|�j|�sdSd}t|�dkrj|dj�sBt|d�dkr^tjd|d|jf�dSt|d�}i}x�t	j
tjj
tjd��D]|}tjj|�dd�}|j�r�tjj
|d�}tjj|�s�tjd||f�q�|jj|�j�}|j�r�|j|g�|g||<q�Wg}x.|j�D]"}	|	jtd�||	|d�}�qW|jtd�d	j
|�S)
NrrzPinvalid argument '%s' for builtin function '%s', it must be non-negative integerzcpu*�ztopology/physical_package_idz(file '%s' does not exist, cpu%s offline?)�key�,)rr�execute�len�	isdecimal�int�log�error�_name�globZiglob�os�path�join�constsZSYSFS_CPUS_PATH�basename�exists�debugZ_cmdZ	read_file�strip�get�values�sort)
r�argsZcpus_reserveZtopoZcpuZcpuidZphysical_package_idZsocketZ	isol_cpusZcpus)rr	r
rs4zcalc_isolated_cores.execute)�__name__�
__module__�__qualname__�__doc__rr�
__classcell__r	r	)rr
r	sr)
rrZ
tuned.logsZtuned�rZtuned.constsrZlogsrrZFunctionrr	r	r	r
�<module>s

PK��\�A����@functions/__pycache__/function_cpulist2devs.cpython-36.opt-1.pycnu�[���3

�<�e��@s4ddlZddlmZejj�ZGdd�dej�ZdS)�N�)�basecs,eZdZdZ�fdd�Z�fdd�Z�ZS)�cpulist2devsz<
	Conversion function: converts CPU list to device strings
	cstt|�jdd�dS)Nrr)�superr�__init__)�self)�	__class__��+/usr/lib/python3.6/function_cpulist2devs.pyr
szcpulist2devs.__init__cs2tt|�j|�sdS|jj|jjdj|��dd�S)N�,Zcpu)�prefix)rr�executeZ_cmdZcpulist2stringZcpulist_unpack�join)r�args)rr	r
r
szcpulist2devs.execute)�__name__�
__module__�__qualname__�__doc__rr
�
__classcell__r	r	)rr
rsr)	Z
tuned.logsZtuned�rZlogs�get�logZFunctionrr	r	r	r
�<module>s
PK��\��z0OO9functions/__pycache__/function_strip.cpython-36.opt-1.pycnu�[���3

�<�e��@s>ddlZddlZddlmZddlmZGdd�dej�ZdS)�N�)�base)�commandscs,eZdZdZ�fdd�Z�fdd�Z�ZS)�stripz0
	Makes string from all arguments and strip it
	cstt|�jddd�dS)Nrrr)�superr�__init__)�self)�	__class__��$/usr/lib/python3.6/function_strip.pyr
szstrip.__init__cs"tt|�j|�sdSdj|�j�S)N�)rr�execute�join)r�args)r	r
rr
sz
strip.execute)�__name__�
__module__�__qualname__�__doc__rr
�
__classcell__r
r
)r	rrsr)	�osZ
tuned.logsZtunedrrZtuned.utils.commandsrZFunctionrr
r
r
r�<module>sPK��\3�wBB4functions/__pycache__/functions.cpython-36.opt-1.pycnu�[���3

�<�eb�@sdddlZddlZddlZddlmZddlZddljZddl	m
Z
ejj�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
	cCstj�|_|j�dS)N)rZ
Repository�_repository�_parse_init)�self�r	�/usr/lib/python3.6/functions.py�__init__s
zFunctions.__init__�cCs&d|_||_t|�|_g|_d|_dS)NrF)�_cnt�_str�len�_len�_stack�_esc)r�sr	r	r
rs

zFunctions._parse_initcCs|j|jkr|j|jSdS)Nr)r
rr)rr	r	r
�
_curr_charszFunctions._curr_charcCs|j|j|j|�S)N)rr
)rrr	r	r
�_curr_substr szFunctions._curr_substrcCs|jj||jf�dS)N)r�appendr
)r�escr	r	r
�	_push_pos#szFunctions._push_poscCsd|jd|�||j|dd�|_t|j�|_|jt|�||d7_|jdkr`d|_dS)Nrr)rrrr
)r�a�brr	r	r
�_sub&s
&
zFunctions._subcCs�tjd|j||j��}|ddkr(dSdd�|D�}tjd|d�s\tjd|d�dSy|jj|d�}Wn&t	k
r�tjd	|d�dSX|j
|d
d��}|dkr�dS|j||j|�dS)Nz(?<!\\):rz${fcSsg|]}t|�jdd��qS)z\:�:)�str�replace)�.0�vr	r	r
�
<listcomp>1sz+Functions._process_func.<locals>.<listcomp>z\w+$rzinvalid function name '%s'zfunction '%s' not implemented�)�re�splitrr
�match�log�errorrZ	load_func�ImportErrorZexecuter)rZ_fromZsl�frr	r	r
�
_process_func-s zFunctions._process_funccCs�|j|�x�|j|jkr�|j�dkrpy|jj�}Wn$tk
rVtjd|�|j	SX|ds�|j
|d�n|jd�dkr�|j|j
�|j�dkr�d|_
nd	|_
|jd7_qWt|j�r�tjd
|�|j	S)N�}z.invalid variable syntax, non pair '}' in: '%s'rrr"z${�\TFz.invalid variable syntax, non pair '{' in: '%s')rr
rrr�pop�
IndexErrorr&r'rr*rrrr)rrZsir	r	r
�_process?s&

zFunctions._processcCs(|dks|dkr|Stjdd|j|��S)Nrz\\(\${f:.*})z\1)r#�subr/)rrr	r	r
�expandVszFunctions.expandN)r)
�__name__�
__module__�__qualname__�__doc__rrrrrrr*r/r1r	r	r	r
r
s
r)�osr#ZglobrrZ
tuned.logsZtunedZtuned.constsZconstsZtuned.utils.commandsrZlogs�getr&�cmdrr	r	r	r
�<module>s

PK��\5����9functions/__pycache__/function_cpulist2hex.cpython-36.pycnu�[���3

�<�e��@sHddlZddlZddlmZddlmZejj�Z	Gdd�dej
�ZdS)�N�)�base)�commandscs,eZdZdZ�fdd�Z�fdd�Z�ZS)�cpulist2hexzB
	Conversion function: converts CPU list to hexadecimal CPU mask
	cstt|�jdd�dS)Nrr)�superr�__init__)�self)�	__class__��*/usr/lib/python3.6/function_cpulist2hex.pyrszcpulist2hex.__init__cs&tt|�j|�sdS|jjdj|��S)Nz,,)rr�executeZ_cmd�join)r�args)r	r
rrszcpulist2hex.execute)�__name__�
__module__�__qualname__�__doc__rr�
__classcell__r
r
)r	rrsr)�osZ
tuned.logsZtuned�rZtuned.utils.commandsrZlogs�get�logZFunctionrr
r
r
r�<module>s

PK��\���33/functions/__pycache__/repository.cpython-36.pycnu�[���3

�<�e�@sTddlmZddlmZddlZddljZddlm	Z	ej
j�ZGdd�de�Z
dS)�)�PluginLoader�)�baseN)�commandscsHeZdZ�fdd�Zedd��Zdd�Zdd�Zd	d
�Zdd�Z	�Z
S)
�
Repositorycstt|�j�i|_dS)N)�superr�__init__�
_functions)�self)�	__class__�� /usr/lib/python3.6/repository.pyrszRepository.__init__cCs|jS)N)r	)r
rrr
�	functionsszRepository.functionscCs d|_tj|_tjjjj|_	dS)Nztuned.profiles.functions)
Z
_namespace�constsZFUNCTION_PREFIX�_prefix�tunedZprofilesrrZFunction�
_interface)r
rrr
�_set_loader_parameterssz!Repository._set_loader_parameterscCs,tjd|�|j|�}|�}||j|<|S)Nzcreating function %s)�log�debugZload_pluginr	)r
�
function_nameZfunction_clsZfunction_instancerrr
�creates


zRepository.createcCs||jkr|j|�S|j|S)N)r	r)r
rrrr
�	load_func!s

zRepository.load_funccCsNt||j�st�tjd|�x*t|jj��D]\}}||kr.|j|=q.WdS)Nzremoving function %s)�
isinstancer�AssertionErrorrr�listr	�items)r
Zfunction�k�vrrr
�delete&s
zRepository.delete)�__name__�
__module__�__qualname__r�propertyrrrrr�
__classcell__rr)rr
r	s	r)Ztuned.utils.plugin_loaderr�rZ
tuned.logsrZtuned.constsrZtuned.utils.commandsrZlogs�getrrrrrr
�<module>s

PK��\���jTTIfunctions/__pycache__/function_check_net_queue_count.cpython-36.opt-1.pycnu�[���3

�<�e��@s4ddlZddlmZejj�ZGdd�dej�ZdS)�N�)�basecs,eZdZdZ�fdd�Z�fdd�Z�ZS)�check_net_queue_countz�
	Checks whether the user has specified a queue count for net devices. If
        not, return the number of housekeeping CPUs.
	cstt|�jddd�dS)Nrr)�superr�__init__)�self)�	__class__��4/usr/lib/python3.6/function_check_net_queue_count.pyrszcheck_net_queue_count.__init__csLtt|�j|�sdS|dj�r(|dS|jjdg�\}}tjd|�|S)NrZnproczHnet-dev queue count is not correctly specified, setting it to HK CPUs %s)rr�execute�isdigitZ_cmd�log�warn)r�args�ret�out)rr	r
rszcheck_net_queue_count.execute)�__name__�
__module__�__qualname__�__doc__rr�
__classcell__r	r	)rr
rsr)	Z
tuned.logsZtuned�rZlogs�getr
ZFunctionrr	r	r	r
�<module>s
PK��\�A����:functions/__pycache__/function_cpulist2devs.cpython-36.pycnu�[���3

�<�e��@s4ddlZddlmZejj�ZGdd�dej�ZdS)�N�)�basecs,eZdZdZ�fdd�Z�fdd�Z�ZS)�cpulist2devsz<
	Conversion function: converts CPU list to device strings
	cstt|�jdd�dS)Nrr)�superr�__init__)�self)�	__class__��+/usr/lib/python3.6/function_cpulist2devs.pyr
szcpulist2devs.__init__cs2tt|�j|�sdS|jj|jjdj|��dd�S)N�,Zcpu)�prefix)rr�executeZ_cmdZcpulist2stringZcpulist_unpack�join)r�args)rr	r
r
szcpulist2devs.execute)�__name__�
__module__�__qualname__�__doc__rr
�
__classcell__r	r	)rr
rsr)	Z
tuned.logsZtuned�rZlogs�get�logZFunctionrr	r	r	r
�<module>s
PK��\[5����;functions/__pycache__/function_cpuinfo_check.cpython-36.pycnu�[���3

�<�e��@s<ddlZddlZddlmZejj�ZGdd�dej�Z	dS)�N�)�basecs,eZdZdZ�fdd�Z�fdd�Z�ZS)�
cpuinfo_checka�
	Checks regexes against /proc/cpuinfo. Accepts arguments in the
	following form: REGEX1, STR1, REGEX2, STR2, ...[, STR_FALLBACK]
	If REGEX1 matches something in /proc/cpuinfo it expands to STR1,
	if REGEX2 matches it expands to STR2. It stops on the first match,
	i.e. if REGEX1 matches, no more regexes are processed. If none
	regex matches it expands to STR_FALLBACK. If there is no fallback,
	it expands to empty string.
	cstt|�jddd�dS)Nrr�)�superr�__init__)�self)�	__class__��,/usr/lib/python3.6/function_cpuinfo_check.pyrszcpuinfo_check.__init__cs�tt|�j|�sdS|jjd�}xHtdt|�d�D]4}|dt|�kr2tj|||tj	�r2||dSq2Wt|�dr~|dSdSdS)Nz
/proc/cpuinforrr����)
rr�executeZ_cmdZ	read_file�range�len�re�search�	MULTILINE)r�argsZcpuinfo�i)r	r
rrszcpuinfo_check.execute)�__name__�
__module__�__qualname__�__doc__rr�
__classcell__r
r
)r	rrs	r)
rZ
tuned.logsZtunedrrZlogs�get�logZFunctionrr
r
r
r�<module>s
PK��\��D��7functions/__pycache__/function_assertion.cpython-36.pycnu�[���3

�<�e��@sTddlZddlZddlmZddlmZddlmZej	j
�ZGdd�dej�Z
dS)�N�)�base)�commands)�InvalidProfileExceptioncs,eZdZdZ�fdd�Z�fdd�Z�ZS)�	assertionz�
	Assertion: compares argument 2 with argument 3. If they don't match
	it logs text from argument 1 and  throws InvalidProfileException. This
	exception will abort profile loading.
	cstt|�jddd�dS)Nr�)�superr�__init__)�self)�	__class__��(/usr/lib/python3.6/function_assertion.pyr	szassertion.__init__csXtt|�j|�sdS|d|dkrTtjd|d|d|df�td|d��dS)Nr�z#assertion '%s' failed: '%s' != '%s'rzAssertion '%s' failed.)rr�execute�log�errorr)r
�args)rrr
rs zassertion.execute)�__name__�
__module__�__qualname__�__doc__r	r�
__classcell__rr)rr
r	sr)�osZ
tuned.logsZtuned�rZtuned.utils.commandsrZtuned.profiles.exceptionsrZlogs�getrZFunctionrrrrr
�<module>s
PK��\c.��mm)functions/__pycache__/base.cpython-36.pycnu�[���3

�<�e�@s:ddlZddlZddlmZejj�ZGdd�de�Z	dS)�N)�commandsc@s0eZdZdZd	dd�Zed
dd��Zdd�ZdS)�Functionz
	Built-in function
	NcCs||_||_||_t�|_dS)N)�_name�
_nargs_max�
_nargs_minrZ_cmd)�self�name�	nargs_max�	nargs_min�r�/usr/lib/python3.6/base.py�__init__szFunction.__init__cCs<|dks|dkrdSt|�}|dks,||ko:|dkp:||kS)NFr)�len)�cls�argsr	r
Zlarrr�_check_argsszFunction._check_argscCs*|j||j|j�rdStjd|j�dS)NTz5invalid number of arguments for builtin function '%s'F)rrr�log�errorr)rrrrr�executeszFunction.execute)N)N)�__name__�
__module__�__qualname__�__doc__r
�classmethodrrrrrrrs

r)
�osZ
tuned.logsZtunedZtuned.utils.commandsrZlogs�getr�objectrrrrr�<module>s
PK��\c.��mm/functions/__pycache__/base.cpython-36.opt-1.pycnu�[���3

�<�e�@s:ddlZddlZddlmZejj�ZGdd�de�Z	dS)�N)�commandsc@s0eZdZdZd	dd�Zed
dd��Zdd�ZdS)�Functionz
	Built-in function
	NcCs||_||_||_t�|_dS)N)�_name�
_nargs_max�
_nargs_minrZ_cmd)�self�name�	nargs_max�	nargs_min�r�/usr/lib/python3.6/base.py�__init__szFunction.__init__cCs<|dks|dkrdSt|�}|dks,||ko:|dkp:||kS)NFr)�len)�cls�argsr	r
Zlarrr�_check_argsszFunction._check_argscCs*|j||j|j�rdStjd|j�dS)NTz5invalid number of arguments for builtin function '%s'F)rrr�log�errorr)rrrrr�executeszFunction.execute)N)N)�__name__�
__module__�__qualname__�__doc__r
�classmethodrrrrrrrs

r)
�osZ
tuned.logsZtunedZtuned.utils.commandsrZlogs�getr�objectrrrrr�<module>s
PK��\k1���@functions/__pycache__/function_cpulist_pack.cpython-36.opt-1.pycnu�[���3

�<�e}�@sHddlZddlZddlmZddlmZejj�Z	Gdd�dej
�ZdS)�N�)�base)�commandscs,eZdZdZ�fdd�Z�fdd�Z�ZS)�cpulist_packz�
	Conversion function: packs CPU list in form 1,2,3,5 to 1-3,5.
	The cpulist_unpack is used as a preprocessor, so it always returns
	optimal results. For details about input syntax see cpulist_unpack.
	cstt|�jdd�dS)Nrr)�superr�__init__)�self)�	__class__��+/usr/lib/python3.6/function_cpulist_pack.pyrszcpulist_pack.__init__cs6tt|�j|�sdSdjdd�|jjdj|��D��S)N�,css|]}t|�VqdS)N)�str)�.0�vr
r
r�	<genexpr>sz'cpulist_pack.execute.<locals>.<genexpr>z,,)rr�execute�joinZ_cmd)r�args)r	r
rrszcpulist_pack.execute)�__name__�
__module__�__qualname__�__doc__rr�
__classcell__r
r
)r	rrsr)�osZ
tuned.logsZtuned�rZtuned.utils.commandsrZlogs�get�logZFunctionrr
r
r
r�<module>s

PK��\A�f�;;9functions/__pycache__/function_hex2cpulist.cpython-36.pycnu�[���3

�<�e��@sHddlZddlZddlmZddlmZejj�Z	Gdd�dej
�ZdS)�N�)�base)�commandscs,eZdZdZ�fdd�Z�fdd�Z�ZS)�hex2cpulistzB
	Conversion function: converts hexadecimal CPU mask to CPU list
	cstt|�jddd�dS)Nrr)�superr�__init__)�self)�	__class__��*/usr/lib/python3.6/function_hex2cpulist.pyrszhex2cpulist.__init__cs4tt|�j|�sdSdjdd�|jj|d�D��S)N�,css|]}t|�VqdS)N)�str)�.0�vr
r
r�	<genexpr>sz&hex2cpulist.execute.<locals>.<genexpr>r)rr�execute�joinZ_cmd)r�args)r	r
rrszhex2cpulist.execute)�__name__�
__module__�__qualname__�__doc__rr�
__classcell__r
r
)r	rrsr)�osZ
tuned.logsZtuned�rZtuned.utils.commandsrZlogs�get�logZFunctionrr
r
r
r�<module>s

PK��\�}�22Afunctions/__pycache__/function_calc_isolated_cores.cpython-36.pycnu�[���3

�<�ek�@sNddlZddlZddlZddlmZddljZejj	�Z
Gdd�dej�ZdS)�N�)�basecs,eZdZdZ�fdd�Z�fdd�Z�ZS)�calc_isolated_coresz�
	Calculates and returns isolated cores. The argument specifies how many
	cores per socket reserve for housekeeping. If not specified, 1 core
	per socket is reserved for housekeeping and the rest is isolated.
	cstt|�jdd�dS)Nrr)�superr�__init__)�self)�	__class__��2/usr/lib/python3.6/function_calc_isolated_cores.pyrszcalc_isolated_cores.__init__c
sPtt|�j|�sdSd}t|�dkrj|dj�sBt|d�dkr^tjd|d|jf�dSt|d�}i}x�t	j
tjj
tjd��D]|}tjj|�dd�}|j�r�tjj
|d�}tjj|�s�tjd||f�q�|jj|�j�}|j�r�|j|g�|g||<q�Wg}x.|j�D]"}	|	jtd�||	|d�}�qW|jtd�d	j
|�S)
NrrzPinvalid argument '%s' for builtin function '%s', it must be non-negative integerzcpu*�ztopology/physical_package_idz(file '%s' does not exist, cpu%s offline?)�key�,)rr�execute�len�	isdecimal�int�log�error�_name�globZiglob�os�path�join�constsZSYSFS_CPUS_PATH�basename�exists�debugZ_cmdZ	read_file�strip�get�values�sort)
r�argsZcpus_reserveZtopoZcpuZcpuidZphysical_package_idZsocketZ	isol_cpusZcpus)rr	r
rs4zcalc_isolated_cores.execute)�__name__�
__module__�__qualname__�__doc__rr�
__classcell__r	r	)rr
r	sr)
rrZ
tuned.logsZtuned�rZtuned.constsrZlogsrrZFunctionrr	r	r	r
�<module>s

PK��\5����?functions/__pycache__/function_cpulist2hex.cpython-36.opt-1.pycnu�[���3

�<�e��@sHddlZddlZddlmZddlmZejj�Z	Gdd�dej
�ZdS)�N�)�base)�commandscs,eZdZdZ�fdd�Z�fdd�Z�ZS)�cpulist2hexzB
	Conversion function: converts CPU list to hexadecimal CPU mask
	cstt|�jdd�dS)Nrr)�superr�__init__)�self)�	__class__��*/usr/lib/python3.6/function_cpulist2hex.pyrszcpulist2hex.__init__cs&tt|�j|�sdS|jjdj|��S)Nz,,)rr�executeZ_cmd�join)r�args)r	r
rrszcpulist2hex.execute)�__name__�
__module__�__qualname__�__doc__rr�
__classcell__r
r
)r	rrsr)�osZ
tuned.logsZtuned�rZtuned.utils.commandsrZlogs�get�logZFunctionrr
r
r
r�<module>s

PK��\R�U��%functions/function_cpulist_present.pynu�[���import os
import tuned.logs
from . import base
from tuned.utils.commands import commands

log = tuned.logs.get()

class cpulist_present(base.Function):
	"""
	Checks whether CPUs from list are present, returns list containing
	only present CPUs
	"""
	def __init__(self):
		# arbitrary number of arguments
		super(cpulist_present, self).__init__("cpulist_present", 0)

	def execute(self, args):
		if not super(cpulist_present, self).execute(args):
			return None
		cpus = self._cmd.cpulist_unpack(",,".join(args))
		present = self._cmd.cpulist_unpack(self._cmd.read_file("/sys/devices/system/cpu/present"))
		return ",".join(str(v) for v in sorted(list(set(cpus).intersection(set(present)))))
PK��\���functions/function_exec.pynu�[���import os
import tuned.logs
from . import base
from tuned.utils.commands import commands

class execute(base.Function):
	"""
	Executes process and substitutes its output.
	"""
	def __init__(self):
		# unlimited number of arguments, min 1 argument (the name of executable)
		super(execute, self).__init__("exec", 0, 1)

	def execute(self, args):
		if not super(execute, self).execute(args):
			return None
		(ret, out) = self._cmd.execute(args)
		if ret == 0:
			return out
		return None
PK��\n����#functions/function_cpuinfo_check.pynu�[���import re
import tuned.logs
from . import base

log = tuned.logs.get()

class cpuinfo_check(base.Function):
	"""
	Checks regexes against /proc/cpuinfo. Accepts arguments in the
	following form: REGEX1, STR1, REGEX2, STR2, ...[, STR_FALLBACK]
	If REGEX1 matches something in /proc/cpuinfo it expands to STR1,
	if REGEX2 matches it expands to STR2. It stops on the first match,
	i.e. if REGEX1 matches, no more regexes are processed. If none
	regex matches it expands to STR_FALLBACK. If there is no fallback,
	it expands to empty string.
	"""
	def __init__(self):
		# unlimited number of arguments, min 2 arguments
		super(cpuinfo_check, self).__init__("cpuinfo_check", 0, 2)

	def execute(self, args):
		if not super(cpuinfo_check, self).execute(args):
			return None
		cpuinfo = self._cmd.read_file("/proc/cpuinfo")
		for i in range(0, len(args), 2):
			if i + 1 < len(args):
				if re.search(args[i], cpuinfo, re.MULTILINE):
					return args[i + 1]
		if len(args) % 2:
			return args[-1]
		else:
			return ""
PK��\�(o��functions/function_kb2s.pynu�[���import os
import tuned.logs
from . import base
from tuned.utils.commands import commands

class kb2s(base.Function):
	"""
	Conversion function: kbytes to sectors
	"""
	def __init__(self):
		# 1 argument
		super(kb2s, self).__init__("kb2s", 1, 1)

	def execute(self, args):
		if not super(kb2s, self).execute(args):
			return None
		try:
			return str(int(args[0]) * 2)
		except ValueError:
			return None
PK��\����$functions/function_cpulist_unpack.pynu�[���import os
import tuned.logs
from . import base
from tuned.utils.commands import commands

log = tuned.logs.get()

class cpulist_unpack(base.Function):
	"""
	Conversion function: unpacks CPU list in form 1-3,4 to 1,2,3,4
	"""
	def __init__(self):
		# arbitrary number of arguments
		super(cpulist_unpack, self).__init__("cpulist_unpack", 0)

	def execute(self, args):
		if not super(cpulist_unpack, self).execute(args):
			return None
		return ",".join(str(v) for v in self._cmd.cpulist_unpack(",,".join(args)))
PK��\��QW##functions/__init__.pynu�[���from .repository import Repository
PK��\�Q���+functions/function_check_net_queue_count.pynu�[���import tuned.logs
from . import base

log = tuned.logs.get()

class check_net_queue_count(base.Function):
	"""
	Checks whether the user has specified a queue count for net devices. If
        not, return the number of housekeeping CPUs.
	"""
	def __init__(self):
		# 1 argument
		super(check_net_queue_count, self).__init__("check_net_queue_count", 1, 1)

	def execute(self, args):
		if not super(check_net_queue_count, self).execute(args):
			return None
		if args[0].isdigit():
			return args[0]
		(ret, out) = self._cmd.execute(["nproc"])
		log.warn("net-dev queue count is not correctly specified, setting it to HK CPUs %s" % (out))
		return out
PK��\����++)functions/function_assertion_non_equal.pynu�[���import os
import tuned.logs
from . import base
from tuned.utils.commands import commands
from tuned.profiles.exceptions import InvalidProfileException

log = tuned.logs.get()

class assertion_non_equal(base.Function):
	"""
	Assertion non equal: compares argument 2 with argument 3. If they match
	it logs text from argument 1 and  throws InvalidProfileException. This
	exception will abort profile loading.
	"""
	def __init__(self):
		# 3 arguments
		super(assertion_non_equal, self).__init__("assertion_non_equal", 3, 3)

	def execute(self, args):
		if not super(assertion_non_equal, self).execute(args):
			return None
		if args[1] == args[2]:
			log.error("assertion '%s' failed: '%s' == '%s'" % (args[0], args[1], args[2]))
			raise InvalidProfileException("Assertion '%s' failed." % args[0])
		return None
PK��\E"��SS functions/function_virt_check.pynu�[���import os
import tuned.logs
from . import base
from tuned.utils.commands import commands

class virt_check(base.Function):
	"""
	Checks whether running inside virtual machine (VM) or on bare metal.
	If running inside VM expands to argument 1, otherwise expands to
	argument 2 (even on error).
	"""
	def __init__(self):
		# 2 arguments
		super(virt_check, self).__init__("virt_check", 2, 2)

	def execute(self, args):
		if not super(virt_check, self).execute(args):
			return None
		(ret, out) = self._cmd.execute(["virt-what"])
		if ret == 0 and len(out) > 0:
			return args[0]
		return args[1]
PK��\�G5��"functions/function_cpulist2devs.pynu�[���import tuned.logs
from . import base

log = tuned.logs.get()

class cpulist2devs(base.Function):
	"""
	Conversion function: converts CPU list to device strings
	"""
	def __init__(self):
		# arbitrary number of arguments
		super(cpulist2devs, self).__init__("cpulist2devs", 0)

	def execute(self, args):
		if not super(cpulist2devs, self).execute(args):
			return None
		return self._cmd.cpulist2string(self._cmd.cpulist_unpack(",".join(args)), prefix = "cpu")
PK��\f��}}"functions/function_cpulist_pack.pynu�[���import os
import tuned.logs
from . import base
from tuned.utils.commands import commands

log = tuned.logs.get()

class cpulist_pack(base.Function):
	"""
	Conversion function: packs CPU list in form 1,2,3,5 to 1-3,5.
	The cpulist_unpack is used as a preprocessor, so it always returns
	optimal results. For details about input syntax see cpulist_unpack.
	"""
	def __init__(self):
		# arbitrary number of arguments
		super(cpulist_pack, self).__init__("cpulist_pack", 0)

	def execute(self, args):
		if not super(cpulist_pack, self).execute(args):
			return None
		return ",".join(str(v) for v in self._cmd.cpulist_pack(",,".join(args)))
PK��\�w+bbfunctions/functions.pynu�[���import os
import re
import glob
from . import repository
import tuned.logs
import tuned.consts as consts
from tuned.utils.commands import commands

log = tuned.logs.get()

cmd = commands()

class Functions():
	"""
	Built-in functions
	"""

	def __init__(self):
		self._repository = repository.Repository()
		self._parse_init()

	def _parse_init(self, s = ""):
		self._cnt = 0
		self._str = s
		self._len = len(s)
		self._stack = []
		self._esc = False

	def _curr_char(self):
		return self._str[self._cnt] if self._cnt < self._len else ""

	def _curr_substr(self, _len):
		return self._str[self._cnt:self._cnt + _len]

	def _push_pos(self, esc):
		self._stack.append((esc, self._cnt))

	def _sub(self, a, b, s):
		self._str = self._str[:a] + s + self._str[b + 1:]
		self._len = len(self._str)
		self._cnt += len(s) - (b - a + 1)
		if self._cnt < 0:
			self._cnt = 0

	def _process_func(self, _from):
		sl = re.split(r'(?<!\\):', self._str[_from:self._cnt])
		if sl[0] != "${f":
			return
		sl = [str(v).replace(r"\:", ":") for v in sl]
		if not re.match(r'\w+$', sl[1]):
			log.error("invalid function name '%s'" % sl[1])
			return
		try:
			f = self._repository.load_func(sl[1])
		except ImportError:
			log.error("function '%s' not implemented" % sl[1])
			return
		s = f.execute(sl[2:])
		if s is None:
			return
		self._sub(_from, self._cnt, s)

	def _process(self, s):
		self._parse_init(s)
		while self._cnt < self._len:
			if self._curr_char() == "}":
				try:
					si = self._stack.pop()
				except IndexError:
					log.error("invalid variable syntax, non pair '}' in: '%s'" % s)
					return self._str
				# if not escaped
				if not si[0]:
					self._process_func(si[1])
			elif self._curr_substr(2) == "${":
				self._push_pos(self._esc)
			if self._curr_char() == "\\":
				self._esc = True
			else:
				self._esc = False
			self._cnt += 1
		if len(self._stack):
			log.error("invalid variable syntax, non pair '{' in: '%s'" % s)
		return self._str

	def expand(self, s):
		if s is None or s == "":
			return s
		# expand functions and convert all \${f:*} to ${f:*} (unescape)
		return re.sub(r'\\(\${f:.*})', r'\1', self._process(s))
PK��\���functions/base.pynu�[���import os
import tuned.logs
from tuned.utils.commands import commands

log = tuned.logs.get()

class Function(object):
	"""
	Built-in function
	"""
	def __init__(self, name, nargs_max, nargs_min = None):
		self._name = name
		self._nargs_max = nargs_max
		self._nargs_min = nargs_min
		self._cmd = commands()

	# checks arguments
	# nargs_max - maximal number of arguments, there mustn't be more arguments,
	#             if nargs_max is 0, number of arguments is unlimited
	# nargs_min - minimal number of arguments, if not None there must
	#             be the same number of arguments or more
	@classmethod
	def _check_args(cls, args, nargs_max, nargs_min = None):
		if args is None or nargs_max is None:
			return False
		la = len(args)
		return (nargs_max == 0 or nargs_max >= la) and (nargs_min is None or nargs_min <= la)

	def execute(self, args):
		if self._check_args(args, self._nargs_max, self._nargs_min):
			return True
		else:
			log.error("invalid number of arguments for builtin function '%s'" % self._name)
		return False
PK��\�,����!functions/function_hex2cpulist.pynu�[���import os
import tuned.logs
from . import base
from tuned.utils.commands import commands

log = tuned.logs.get()

class hex2cpulist(base.Function):
	"""
	Conversion function: converts hexadecimal CPU mask to CPU list
	"""
	def __init__(self):
		# 1 argument
		super(hex2cpulist, self).__init__("hex2cpulist", 1, 1)

	def execute(self, args):
		if not super(hex2cpulist, self).execute(args):
			return None
		return ",".join(str(v) for v in self._cmd.hex2cpulist(args[0]))
PK��\��0Nkk)functions/function_calc_isolated_cores.pynu�[���import os
import glob
import tuned.logs
from . import base
import tuned.consts as consts

log = tuned.logs.get()

class calc_isolated_cores(base.Function):
	"""
	Calculates and returns isolated cores. The argument specifies how many
	cores per socket reserve for housekeeping. If not specified, 1 core
	per socket is reserved for housekeeping and the rest is isolated.
	"""
	def __init__(self):
		# max 1 argument
		super(calc_isolated_cores, self).__init__("calc_isolated_cores", 1)

	def execute(self, args):
		if not super(calc_isolated_cores, self).execute(args):
			return None
		cpus_reserve = 1
		if len(args) > 0:
			if not args[0].isdecimal() or int(args[0]) < 0:
				log.error("invalid argument '%s' for builtin function '%s', it must be non-negative integer" %
					(args[0], self._name))
				return None
			else:
				cpus_reserve = int(args[0])

		topo = {}
		for cpu in glob.iglob(os.path.join(consts.SYSFS_CPUS_PATH, "cpu*")):
			cpuid = os.path.basename(cpu)[3:]
			if cpuid.isdecimal():
				physical_package_id = os.path.join(cpu, "topology/physical_package_id")
				# Show no errors when the physical_package_id file does not exist -- the CPU may be offline.
				if not os.path.exists(physical_package_id):
					log.debug("file '%s' does not exist, cpu%s offline?" % (physical_package_id, cpuid))
					continue
				socket = self._cmd.read_file(physical_package_id).strip()
				if socket.isdecimal():
					topo[socket] = topo.get(socket, []) + [cpuid]

		isol_cpus = []
		for cpus in topo.values():
			cpus.sort(key = int)
			isol_cpus = isol_cpus + cpus[cpus_reserve:]
		isol_cpus.sort(key = int)
		return ",".join(isol_cpus)
PK��\�Ud���!functions/function_cpulist2hex.pynu�[���import os
import tuned.logs
from . import base
from tuned.utils.commands import commands

log = tuned.logs.get()

class cpulist2hex(base.Function):
	"""
	Conversion function: converts CPU list to hexadecimal CPU mask
	"""
	def __init__(self):
		# arbitrary number of arguments
		super(cpulist2hex, self).__init__("cpulist2hex", 0)

	def execute(self, args):
		if not super(cpulist2hex, self).execute(args):
			return None
		return self._cmd.cpulist2hex(",,".join(args))
PK��\�mg��functions/function_strip.pynu�[���import os
import tuned.logs
from . import base
from tuned.utils.commands import commands

class strip(base.Function):
	"""
	Makes string from all arguments and strip it
	"""
	def __init__(self):
		# unlimited number of arguments, min 1 argument
		super(strip, self).__init__("strip", 0, 1)

	def execute(self, args):
		if not super(strip, self).execute(args):
			return None
		return "".join(args).strip()
PK��\�{k�***functions/function_regex_search_ternary.pynu�[���import re
from . import base

class regex_search_ternary(base.Function):
	"""
	Ternary regex operator, it takes arguments in the following form
	STR1, REGEX, STR2, STR3
	If REGEX matches STR1 (re.search is used), STR2 is returned,
	otherwise STR3 is returned
	"""
	def __init__(self):
		# 4 arguments
		super(regex_search_ternary, self).__init__("regex_search_ternary", 4, 4)

	def execute(self, args):
		if not super(regex_search_ternary, self).execute(args):
			return None
		if re.search(args[1], args[0]):
			return args[2]
		else:
			return args[3]
PK��\�<F�pp(functions/function_cpulist2hex_invert.pynu�[���import os
import tuned.logs
from . import base
from tuned.utils.commands import commands

log = tuned.logs.get()

class cpulist2hex_invert(base.Function):
	"""
	Converts CPU list to hexadecimal CPU mask and inverts it
	"""
	def __init__(self):
		# arbitrary number of arguments
		super(cpulist2hex_invert, self).__init__("cpulist2hex_invert", 0)

	def execute(self, args):
		if not super(cpulist2hex_invert, self).execute(args):
			return None
		# current implementation inverts the CPU list and then converts it to hexmask
		return self._cmd.cpulist2hex(",".join(str(v) for v in self._cmd.cpulist_invert(",,".join(args))))
PK��\$�X�functions/repository.pynu�[���from tuned.utils.plugin_loader import PluginLoader
from . import base
import tuned.logs
import tuned.consts as consts
from tuned.utils.commands import commands

log = tuned.logs.get()

class Repository(PluginLoader):

	def __init__(self):
		super(Repository, self).__init__()
		self._functions = {}

	@property
	def functions(self):
		return self._functions

	def _set_loader_parameters(self):
		self._namespace = "tuned.profiles.functions"
		self._prefix = consts.FUNCTION_PREFIX
		self._interface = tuned.profiles.functions.base.Function

	def create(self, function_name):
		log.debug("creating function %s" % function_name)
		function_cls = self.load_plugin(function_name)
		function_instance = function_cls()
		self._functions[function_name] = function_instance
		return function_instance

	# loads function from plugin file and return it
	# if it is already loaded, just return it, it is not loaded again
	def load_func(self, function_name):
		if not function_name in self._functions:
			return self.create(function_name)
		return self._functions[function_name]

	def delete(self, function):
		assert isinstance(function, self._interface)
		log.debug("removing function %s" % function)
		for k, v in list(self._functions.items()):
			if v == function:
				del self._functions[k]
PK��\�j����$functions/function_cpulist_online.pynu�[���import os
import tuned.logs
from . import base
from tuned.utils.commands import commands

log = tuned.logs.get()

class cpulist_online(base.Function):
	"""
	Checks whether CPUs from list are online, returns list containing
	only online CPUs
	"""
	def __init__(self):
		# arbitrary number of arguments
		super(cpulist_online, self).__init__("cpulist_online", 0)

	def execute(self, args):
		if not super(cpulist_online, self).execute(args):
			return None
		cpus = self._cmd.cpulist_unpack(",".join(args))
		online = self._cmd.cpulist_unpack(self._cmd.read_file("/sys/devices/system/cpu/online"))
		return ",".join(str(v) for v in cpus if v in online)
PK��\���F��functions/function_assertion.pynu�[���import os
import tuned.logs
from . import base
from tuned.utils.commands import commands
from tuned.profiles.exceptions import InvalidProfileException

log = tuned.logs.get()

class assertion(base.Function):
	"""
	Assertion: compares argument 2 with argument 3. If they don't match
	it logs text from argument 1 and  throws InvalidProfileException. This
	exception will abort profile loading.
	"""
	def __init__(self):
		# 3 arguments
		super(assertion, self).__init__("assertion", 3, 3)

	def execute(self, args):
		if not super(assertion, self).execute(args):
			return None
		if args[1] != args[2]:
			log.error("assertion '%s' failed: '%s' != '%s'" % (args[0], args[1], args[2]))
			raise InvalidProfileException("Assertion '%s' failed." % args[0])
		return None
PK��\�@�z��$functions/function_cpulist_invert.pynu�[���import os
import tuned.logs
from . import base
from tuned.utils.commands import commands

log = tuned.logs.get()

class cpulist_invert(base.Function):
	"""
	Inverts list of CPUs (makes its complement). For the complement it
	gets number of online CPUs from the /sys/devices/system/cpu/online,
	e.g. system with 4 CPUs (0-3), the inversion of list "0,2,3" will be
	"1"
	"""
	def __init__(self):
		# arbitrary number of arguments
		super(cpulist_invert, self).__init__("cpulist_invert", 0)

	def execute(self, args):
		if not super(cpulist_invert, self).execute(args):
			return None
		return ",".join(str(v) for v in self._cmd.cpulist_invert(",,".join(args)))
PK��\0�t&��
factory.pynu�[���import tuned.profiles.profile

class Factory(object):
	def create(self, name, config):
		return tuned.profiles.profile.Profile(name, config)
PK��\A�o�$	$	variables.pynu�[���import os
import re
import tuned.logs
from .functions import functions as functions
import tuned.consts as consts
from tuned.utils.commands import commands
from tuned.utils.config_parser import ConfigParser, Error

log = tuned.logs.get()

class Variables():
	"""
	Storage and processing of variables used in profiles
	"""

	def __init__(self):
		self._cmd = commands()
		self._lookup_re = {}
		self._lookup_env = {}
		self._functions = functions.Functions()

	def _add_env_prefix(self, s, prefix):
		if s.find(prefix) == 0:
			return s
		return prefix + s

	def _check_var(self, variable):
		return re.match(r'\w+$',variable)

	def add_variable(self, variable, value):
		if value is None:
			return
		s = str(variable)
		if not self._check_var(variable):
			log.error("variable definition '%s' contains unallowed characters" % variable)
			return
		v = self.expand(value)
		# variables referenced by ${VAR}, $ can be escaped by two $,
		# i.e. the following will not expand: $${VAR}
		self._lookup_re[r'(?<!\\)\${' + re.escape(s) + r'}'] = v
		self._lookup_env[self._add_env_prefix(s, consts.ENV_PREFIX)] = v

	def add_from_file(self, filename):
		if not os.path.exists(filename):
			log.error("unable to find variables_file: '%s'" % filename)
			return
		try:
			config = ConfigParser(delimiters=('='), inline_comment_prefixes=('#'), allow_no_value=True, strict=False)
			config.optionxform = str
			with open(filename) as f:
				config.read_string("[" + consts.MAGIC_HEADER_NAME + "]\n" + f.read(), filename)
		except Error:
			log.error("error parsing variables_file: '%s'" % filename)
			return
		for s in config.sections():
			for o in config.options(s):
				self.add_variable(o, config.get(s, o, raw=True))

	def add_from_cfg(self, cfg):
		for item in cfg:
			if str(item) == "include":
				self.add_from_file(os.path.normpath(cfg[item]))
			else:
				self.add_variable(item, cfg[item])

	# expand static variables (no functions)
	def expand_static(self, value):
		return re.sub(r'\\(\${\w+})', r'\1', self._cmd.multiple_re_replace(self._lookup_re, value))

	def expand(self, value):
		if value is None:
			return None
		# expand variables and convert all \${VAR} to ${VAR} (unescape)
		s = self.expand_static(str(value))
		# expand built-in functions
		return self._functions.expand(s)

	def get_env(self):
		return self._lookup_env
PK��\��F��
locator.pynu�[���import os
import tuned.consts as consts
from tuned.utils.config_parser import ConfigParser, Error

class Locator(object):
	"""
	Profiles locator and enumerator.
	"""

	__slots__ = ["_load_directories"]

	def __init__(self, load_directories):
		if type(load_directories) is not list:
			raise TypeError("load_directories parameter is not a list")
		self._load_directories = load_directories

	@property
	def load_directories(self):
		return self._load_directories

	def _get_config_filename(self, *path_parts):
		path_parts = list(path_parts) + ["tuned.conf"]
		config_name = os.path.join(*path_parts)
		return os.path.normpath(config_name)

	def get_config(self, profile_name, skip_files=None):
		ret = None
		conditional_load = profile_name[0:1] == "-"
		if conditional_load:
			profile_name = profile_name[1:]

		for dir_name in reversed(self._load_directories):
			# basename is protection not to get out of the path
			config_file = self._get_config_filename(dir_name, os.path.basename(profile_name))

			if skip_files is not None and config_file in skip_files:
				ret = ""
				continue

			if os.path.isfile(config_file):
				return config_file

		if conditional_load and ret is None:
			ret = ""

		return ret

	def check_profile_name_format(self, profile_name):
		return profile_name is not None and profile_name != "" and "/" not in profile_name

	def parse_config(self, profile_name):
		if not self.check_profile_name_format(profile_name):
			return None
		config_file = self.get_config(profile_name)
		if config_file is None:
			return None
		try:
			config = ConfigParser(delimiters=('='), inline_comment_prefixes=('#'), allow_no_value=True, strict=False)
			config.optionxform = str
			with open(config_file) as f:
				config.read_string("[" + consts.MAGIC_HEADER_NAME + "]\n" + f.read())
			return config
		except (IOError, OSError, Error) as e:
			return None

	# Get profile attributes (e.g. summary, description), attrs is list of requested attributes,
	# if it is not list it is converted to list, defvals is list of default values to return if
	# attribute is not found, it is also converted to list if it is not list.
	# Returns list of the following format [status, profile_name, attr1_val, attr2_val, ...],
	# status is boolean.
	def get_profile_attrs(self, profile_name, attrs, defvals = None):
		# check types
		try:
			attrs_len = len(attrs)
		except TypeError:
			attrs = [attrs]
			attrs_len = 1
		try:
			defvals_len = len(defvals)
		except TypeError:
			defvals = [defvals]
			defvals_len = 1
		# Extend defvals if needed, last value is used for extension
		if defvals_len < attrs_len:
			defvals = defvals + ([defvals[-1]] * (attrs_len - defvals_len))
		config = self.parse_config(profile_name)
		if config is None:
			return [False, "", "", ""]
		main_unit_in_config = consts.PLUGIN_MAIN_UNIT_NAME in config.sections()
		vals = [True, profile_name]
		for (attr, defval) in zip(attrs, defvals):
			if attr == "" or attr is None:
				vals[0] = False
				vals = vals + [""]
			elif main_unit_in_config and attr in config.options(consts.PLUGIN_MAIN_UNIT_NAME):
				vals = vals + [config.get(consts.PLUGIN_MAIN_UNIT_NAME, attr, raw=True)]
			else:
				vals = vals + [defval]
		return vals

	def list_profiles(self):
		profiles = set()
		for dir_name in self._load_directories:
			try:
				for profile_name in os.listdir(dir_name):
					config_file = self._get_config_filename(dir_name, profile_name)
					if os.path.isfile(config_file):
						profiles.add(profile_name)
			except OSError:
				pass
		return profiles

	def get_known_names(self):
		return sorted(self.list_profiles())

	def get_known_names_summary(self):
		return [(profile, self.get_profile_attrs(profile, [consts.PROFILE_ATTR_SUMMARY], [""])[2]) for profile in sorted(self.list_profiles())]
PK��\����__
exceptions.pynu�[���import tuned.exceptions

class InvalidProfileException(tuned.exceptions.TunedException):
	pass
PK��\q�Z/��$__pycache__/variables.cpython-36.pycnu�[���PK��\W��qxx"__pycache__/locator.cpython-36.pycnu�[���PK��\pm�5TT'�__pycache__/merger.cpython-36.opt-1.pycnu�[���PK��\?��4^^%}"__pycache__/exceptions.cpython-36.pycnu�[���PK��\Y��ll'0$__pycache__/loader.cpython-36.opt-1.pycnu�[���PK��\@
���"�4__pycache__/factory.cpython-36.pycnu�[���PK��\
_�"#7__pycache__/profile.cpython-36.pycnu�[���PK��\�\���#�>__pycache__/__init__.cpython-36.pycnu�[���PK��\Y��ll!l@__pycache__/loader.cpython-36.pycnu�[���PK��\$�0)Q__pycache__/unit.cpython-36.pycnu�[���PK��\q�Z/��*�___pycache__/variables.cpython-36.opt-1.pycnu�[���PK��\W��qxx(�k__pycache__/locator.cpython-36.opt-1.pycnu�[���PK��\pm�5TT!tz__pycache__/merger.cpython-36.pycnu�[���PK��\?��4^^+�__pycache__/exceptions.cpython-36.opt-1.pycnu�[���PK��\$�0%҃__pycache__/unit.cpython-36.opt-1.pycnu�[���PK��\
_�(E�__pycache__/profile.cpython-36.opt-1.pycnu�[���PK��\�\���)��__pycache__/__init__.cpython-36.opt-1.pycnu�[���PK��\@
���(��__pycache__/factory.cpython-36.opt-1.pycnu�[���PK��\��Snn
Нprofile.pynu�[���PK��\o�x�__init__.pynu�[���PK��\�]���	�	̣unit.pynu�[���PK��\R�5>��	��merger.pynu�[���PK��\��|��	}�loader.pynu�[���PK��\�Ԇ���d�functions/function_s2kb.pynu�[���PK��\{I��GO�functions/__pycache__/function_assertion_non_equal.cpython-36.opt-1.pycnu�[���PK��\��z0OO3��functions/__pycache__/function_strip.cpython-36.pycnu�[���PK��\E�.Cw�functions/__pycache__/function_cpulist_present.cpython-36.opt-1.pycnu�[���PK��\Jb�o"">��functions/__pycache__/function_virt_check.cpython-36.opt-1.pycnu�[���PK��\��_5}�functions/__pycache__/repository.cpython-36.opt-1.pycnu�[���PK��\�n��II<��functions/__pycache__/function_cpulist_unpack.cpython-36.pycnu�[���PK��\���jTTC��functions/__pycache__/function_check_net_queue_count.cpython-36.pycnu�[���PK��\ށ��||@^�functions/__pycache__/function_cpulist2hex_invert.cpython-36.pycnu�[���PK��\q{nn2J�functions/__pycache__/function_exec.cpython-36.pycnu�[���PK��\1?����<�functions/__pycache__/function_cpulist_invert.cpython-36.pycnu�[���PK��\k1���:c�functions/__pycache__/function_cpulist_pack.cpython-36.pycnu�[���PK��\ށ��||F�functions/__pycache__/function_cpulist2hex_invert.cpython-36.opt-1.pycnu�[���PK��\�n��IIB�functions/__pycache__/function_cpulist_unpack.cpython-36.opt-1.pycnu�[���PK��\A�f�;;?A
functions/__pycache__/function_hex2cpulist.cpython-36.opt-1.pycnu�[���PK��\�
��{{2�functions/__pycache__/function_kb2s.cpython-36.pycnu�[���PK��\{I��A�functions/__pycache__/function_assertion_non_equal.cpython-36.pycnu�[���PK��\AL����B8functions/__pycache__/function_regex_search_ternary.cpython-36.pycnu�[���PK��\3�wBB.�functions/__pycache__/functions.cpython-36.pycnu�[���PK��\����<9)functions/__pycache__/function_cpulist_online.cpython-36.pycnu�[���PK��\��!B��8o.functions/__pycache__/function_s2kb.cpython-36.opt-1.pycnu�[���PK��\��!B��2a2functions/__pycache__/function_s2kb.cpython-36.pycnu�[���PK��\�
��{{8M6functions/__pycache__/function_kb2s.cpython-36.opt-1.pycnu�[���PK��\AL����H0:functions/__pycache__/function_regex_search_ternary.cpython-36.opt-1.pycnu�[���PK��\E�.=�>functions/__pycache__/function_cpulist_present.cpython-36.pycnu�[���PK��\����BDfunctions/__pycache__/function_cpulist_online.cpython-36.opt-1.pycnu�[���PK��\�m���-CIfunctions/__pycache__/__init__.cpython-36.pycnu�[���PK��\1?����B>Jfunctions/__pycache__/function_cpulist_invert.cpython-36.opt-1.pycnu�[���PK��\��D��=�Ofunctions/__pycache__/function_assertion.cpython-36.opt-1.pycnu�[���PK��\q{nn8�Tfunctions/__pycache__/function_exec.cpython-36.opt-1.pycnu�[���PK��\Jb�o""8�Xfunctions/__pycache__/function_virt_check.cpython-36.pycnu�[���PK��\�m���3-]functions/__pycache__/__init__.cpython-36.opt-1.pycnu�[���PK��\[5����A.^functions/__pycache__/function_cpuinfo_check.cpython-36.opt-1.pycnu�[���PK��\�}�22GBdfunctions/__pycache__/function_calc_isolated_cores.cpython-36.opt-1.pycnu�[���PK��\�A����@�kfunctions/__pycache__/function_cpulist2devs.cpython-36.opt-1.pycnu�[���PK��\��z0OO9�ofunctions/__pycache__/function_strip.cpython-36.opt-1.pycnu�[���PK��\3�wBB4�sfunctions/__pycache__/functions.cpython-36.opt-1.pycnu�[���PK��\5����9E�functions/__pycache__/function_cpulist2hex.cpython-36.pycnu�[���PK��\���33/E�functions/__pycache__/repository.cpython-36.pycnu�[���PK��\���jTTI׋functions/__pycache__/function_check_net_queue_count.cpython-36.opt-1.pycnu�[���PK��\�A����:��functions/__pycache__/function_cpulist2devs.cpython-36.pycnu�[���PK��\[5����;��functions/__pycache__/function_cpuinfo_check.cpython-36.pycnu�[���PK��\��D��7��functions/__pycache__/function_assertion.cpython-36.pycnu�[���PK��\c.��mm)�functions/__pycache__/base.cpython-36.pycnu�[���PK��\c.��mm/��functions/__pycache__/base.cpython-36.opt-1.pycnu�[���PK��\k1���@t�functions/__pycache__/function_cpulist_pack.cpython-36.opt-1.pycnu�[���PK��\A�f�;;9��functions/__pycache__/function_hex2cpulist.cpython-36.pycnu�[���PK��\�}�22AO�functions/__pycache__/function_calc_isolated_cores.cpython-36.pycnu�[���PK��\5����?�functions/__pycache__/function_cpulist2hex.cpython-36.opt-1.pycnu�[���PK��\R�U��%��functions/function_cpulist_present.pynu�[���PK��\����functions/function_exec.pynu�[���PK��\n����#1�functions/function_cpuinfo_check.pynu�[���PK��\�(o��w�functions/function_kb2s.pynu�[���PK��\����$V�functions/function_cpulist_unpack.pynu�[���PK��\��QW##��functions/__init__.pynu�[���PK��\�Q���+�functions/function_check_net_queue_count.pynu�[���PK��\����++)��functions/function_assertion_non_equal.pynu�[���PK��\E"��SS z�functions/function_virt_check.pynu�[���PK��\�G5��"�functions/function_cpulist2devs.pynu�[���PK��\f��}}";�functions/function_cpulist_pack.pynu�[���PK��\�w+bb
�functions/functions.pynu�[���PK��\�����functions/base.pynu�[���PK��\�,����!�functions/function_hex2cpulist.pynu�[���PK��\��0Nkk),�functions/function_calc_isolated_cores.pynu�[���PK��\�Ud���!��functions/function_cpulist2hex.pynu�[���PK��\�mg���functions/function_strip.pynu�[���PK��\�{k�***��functions/function_regex_search_ternary.pynu�[���PK��\�<F�pp(|�functions/function_cpulist2hex_invert.pynu�[���PK��\$�X�D�functions/repository.pynu�[���PK��\�j����$��functions/function_cpulist_online.pynu�[���PK��\���F��nfunctions/function_assertion.pynu�[���PK��\�@�z��$�functions/function_cpulist_invert.pynu�[���PK��\0�t&��
�factory.pynu�[���PK��\A�o�$	$	j	variables.pynu�[���PK��\��F��
�locator.pynu�[���PK��\����__
�!exceptions.pynu�[���PKcc�)h"