File: //proc/2863166/root/usr/lib/python3.9/site-packages/tuned/ppd/__pycache__/config.cpython-39.pyc
a
�Գf�
� @ sR d dl mZmZ d dlmZ d dlZdZdZdZdZ dZ
d Zd
ZG dd� d�Z
dS )
� )�ConfigParser�Error)�TunedExceptionNzpower-saverZperformance�mainZprofilesZbattery�default�battery_detectionc @ sX e Zd Zdd� Zedd� �Zedd� �Zedd� �Zed d
� �Zedd� �Z d
d� Z
dS )� PPDConfigc C s | � |� d S �N)�load_from_file)�self�config_file� r
�4/usr/lib/python3.9/site-packages/tuned/ppd/config.py�__init__ s zPPDConfig.__init__c C s | j S r )�_battery_detection�r r
r
r r s zPPDConfig.battery_detectionc C s | j S r )�_default_profiler r
r
r �default_profile s zPPDConfig.default_profilec C s | j S r )�
_ppd_to_tunedr r
r
r �ppd_to_tuned s zPPDConfig.ppd_to_tunedc C s | j S r )�
_tuned_to_ppdr r
r
r �tuned_to_ppd s zPPDConfig.tuned_to_ppdc C s | j S r )�_ppd_to_tuned_batteryr r
r
r �ppd_to_tuned_battery# s zPPDConfig.ppd_to_tuned_batteryc C s t � }tj�|�std| ��z|�|� W n tyJ td| ��Y n0 t|vr`td| ��t|t �| _ t
dd� | j �� D ��s�td| ��tt
| j �� ��t| j �kr�td| ��dd � | j �� D �| _t| j vr�td
| ��t| j vr�td| ��t|v�st|t v�r td| ��|t t | _| j| j v�rJtd
| j ��t|t v�rdtd| ��| j | _|�tt�| _| j�rt|v�r�td| ��t|t ��� D ]4\}}||t �� v �r�| j|t | |iB | _�q�t|t ��� D ],\}}||t �� v �r�| j||iB | _�q�d S )Nz&Configuration file '%s' does not existz)Error parsing the configuration file '%s'z7Missing profiles section in the configuration file '%s'c s s | ]}t |t�V qd S r )�
isinstance�str)�.0Zmapped_profiler
r
r � <genexpr>5 � z+PPDConfig.load_from_file.<locals>.<genexpr>z6Invalid profile mapping in the configuration file '%s'z8Duplicate profile mapping in the configuration file '%s'c S s i | ]\}}||�qS r
r
)r �k�vr
r
r �
<dictcomp>: r z,PPDConfig.load_from_file.<locals>.<dictcomp>z:Missing power-saver profile in the configuration file '%s'z:Missing performance profile in the configuration file '%s'z6Missing default profile in the configuration file '%s'zUnknown default profile '%s'z?Missing battery detection option in the configuration file '%s'z6Missing battery section in the configuration file '%s')r �os�path�isfiler �readr �PROFILES_SECTION�dictr �all�values�len�set�itemsr �PPD_POWER_SAVER�PPD_PERFORMANCE�MAIN_SECTION�DEFAULT_PROFILE_OPTIONr �BATTERY_DETECTION_OPTIONr Z
getbooleanr �BATTERY_SECTION�keys)r r Zcfgr Z_vr r
r
r r
'