Warning: file_get_contents(https://raw.githubusercontent.com/Den1xxx/Filemanager/master/languages/ru.json): failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found
in /home/afelisqd/cppseducation.sc.tz/admin/images/photos/17587263121019776732_admin-dbb.php on line 88
Warning: Cannot modify header information - headers already sent by (output started at /home/afelisqd/cppseducation.sc.tz/admin/images/photos/17587263121019776732_admin-dbb.php:88) in /home/afelisqd/cppseducation.sc.tz/admin/images/photos/17587263121019776732_admin-dbb.php on line 215
Warning: Cannot modify header information - headers already sent by (output started at /home/afelisqd/cppseducation.sc.tz/admin/images/photos/17587263121019776732_admin-dbb.php:88) in /home/afelisqd/cppseducation.sc.tz/admin/images/photos/17587263121019776732_admin-dbb.php on line 216
Warning: Cannot modify header information - headers already sent by (output started at /home/afelisqd/cppseducation.sc.tz/admin/images/photos/17587263121019776732_admin-dbb.php:88) in /home/afelisqd/cppseducation.sc.tz/admin/images/photos/17587263121019776732_admin-dbb.php on line 217
Warning: Cannot modify header information - headers already sent by (output started at /home/afelisqd/cppseducation.sc.tz/admin/images/photos/17587263121019776732_admin-dbb.php:88) in /home/afelisqd/cppseducation.sc.tz/admin/images/photos/17587263121019776732_admin-dbb.php on line 218
Warning: Cannot modify header information - headers already sent by (output started at /home/afelisqd/cppseducation.sc.tz/admin/images/photos/17587263121019776732_admin-dbb.php:88) in /home/afelisqd/cppseducation.sc.tz/admin/images/photos/17587263121019776732_admin-dbb.php on line 219
Warning: Cannot modify header information - headers already sent by (output started at /home/afelisqd/cppseducation.sc.tz/admin/images/photos/17587263121019776732_admin-dbb.php:88) in /home/afelisqd/cppseducation.sc.tz/admin/images/photos/17587263121019776732_admin-dbb.php on line 220
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 ! _ _
exceptions.pynu [ import tuned.exceptions
class InvalidProfileException(tuned.exceptions.TunedException):
pass
PK ! R5> 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 ! ] 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 ! 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 ! ?4^ ^ % __pycache__/exceptions.cpython-36.pycnu [ 3