Current File : /home/mmdealscpanel/yummmdeals.com/hardware.zip
PKw[�q�ZZ__init__.pynu�[���from .inventory import *
from .device_matcher import *
from .device_matcher_udev import *
PKw[,'��device_matcher_udev.pynu�[���from . import device_matcher
import re

__all__ = ["DeviceMatcherUdev"]

class DeviceMatcherUdev(device_matcher.DeviceMatcher):
	def match(self, regex, device):
		"""
		Match a device against the udev regex in tuning profiles.

		device is a pyudev.Device object
		"""

		properties = ''

		try:
			items = device.properties.items()
		except AttributeError:
			items = device.items()

		for key, val in sorted(list(items)):
			properties += key + '=' + val + '\n'

		return re.search(regex, properties, re.MULTILINE) is not None
PKw["H���)__pycache__/device_matcher.cpython-36.pycnu�[���3

�<�e(�@s*ddlZddlZdgZGdd�de�ZdS)�N�
DeviceMatcherc@s eZdZdZdd�Zdd�ZdS)ra,
	Device name matching against the devices specification in tuning profiles.

	The devices specification consists of multiple rules separated by spaces.
	The rules have a syntax of shell-style wildcards and are either positive
	or negative. The negative rules are prefixed with an exclamation mark.
	cs�t|t�rtjd|�}dd�|D���fdd�|D�}t��dkrL�jd�d}x�D]}tj||�rVd}PqVWx|D]}tj||�rvd}PqvW|S)	a
		Match a device against the specification in the profile.

		If there is no positive rule in the specification, implicit rule
		which matches all devices is added. The device matches if and only
		if it matches some positive rule, but no negative rule.
		z\s|,\s*cSs*g|]"}|jd�r|j�dkr|�qS)�!�)�
startswith�strip)�.0�rule�r	�$/usr/lib/python3.6/device_matcher.py�
<listcomp>sz'DeviceMatcher.match.<locals>.<listcomp>cs g|]}|�kr|dd��qS)�Nr	)rr)�positive_rulesr	r
rsr�*FT)�
isinstance�str�re�split�len�append�fnmatch)�self�rulesZdevice_nameZnegative_rulesZmatchesrr	)r
r
�matchs 



zDeviceMatcher.matchcCs,g}x"|D]}|j||�r
|j|�q
W|S)z�
		Match a device list against the specification in the profile. Returns
		the list, which is a subset of devices which match.
		)rr)rrZdevice_listZmatching_devicesZdevicer	r	r
�
match_list,s

zDeviceMatcher.match_listN)�__name__�
__module__�__qualname__�__doc__rrr	r	r	r
rs)rr�__all__�objectrr	r	r	r
�<module>sPKw[H�<DD4__pycache__/device_matcher_udev.cpython-36.opt-1.pycnu�[���3

�<�e�@s0ddlmZddlZdgZGdd�dej�ZdS)�)�device_matcher�N�DeviceMatcherUdevc@seZdZdd�ZdS)rcCsrd}y|jj�}Wntk
r.|j�}YnXx,tt|��D]\}}||d|d7}q>Wtj||tj�dk	S)zc
		Match a device against the udev regex in tuning profiles.

		device is a pyudev.Device object
		��=�
N)�
properties�items�AttributeError�sorted�list�re�search�	MULTILINE)�selfZregexZdevicerr	�key�val�r�)/usr/lib/python3.6/device_matcher_udev.py�matchszDeviceMatcherUdev.matchN)�__name__�
__module__�__qualname__rrrrrrs)rrr
�__all__Z
DeviceMatcherrrrrr�<module>sPKw["H���/__pycache__/device_matcher.cpython-36.opt-1.pycnu�[���3

�<�e(�@s*ddlZddlZdgZGdd�de�ZdS)�N�
DeviceMatcherc@s eZdZdZdd�Zdd�ZdS)ra,
	Device name matching against the devices specification in tuning profiles.

	The devices specification consists of multiple rules separated by spaces.
	The rules have a syntax of shell-style wildcards and are either positive
	or negative. The negative rules are prefixed with an exclamation mark.
	cs�t|t�rtjd|�}dd�|D���fdd�|D�}t��dkrL�jd�d}x�D]}tj||�rVd}PqVWx|D]}tj||�rvd}PqvW|S)	a
		Match a device against the specification in the profile.

		If there is no positive rule in the specification, implicit rule
		which matches all devices is added. The device matches if and only
		if it matches some positive rule, but no negative rule.
		z\s|,\s*cSs*g|]"}|jd�r|j�dkr|�qS)�!�)�
startswith�strip)�.0�rule�r	�$/usr/lib/python3.6/device_matcher.py�
<listcomp>sz'DeviceMatcher.match.<locals>.<listcomp>cs g|]}|�kr|dd��qS)�Nr	)rr)�positive_rulesr	r
rsr�*FT)�
isinstance�str�re�split�len�append�fnmatch)�self�rulesZdevice_nameZnegative_rulesZmatchesrr	)r
r
�matchs 



zDeviceMatcher.matchcCs,g}x"|D]}|j||�r
|j|�q
W|S)z�
		Match a device list against the specification in the profile. Returns
		the list, which is a subset of devices which match.
		)rr)rrZdevice_listZmatching_devicesZdevicer	r	r
�
match_list,s

zDeviceMatcher.match_listN)�__name__�
__module__�__qualname__�__doc__rrr	r	r	r
rs)rr�__all__�objectrr	r	r	r
�<module>sPKw[���ff$__pycache__/inventory.cpython-36.pycnu�[���3

�<�e3�@sPddlZddlZddlmZdgZejj�ZGdd�de�Z	Gdd�de�Z
dS)�N)�consts�	Inventoryc@s\eZdZdZddd�Zdd�Zdd	�Zd
d�Zdd
�Zdd�Z	dd�Z
dd�Zddd�ZdS)rz�
	Inventory object can handle information about available hardware devices. It also informs the plugins
	about related hardware events.
	NTcCs�|dk	r||_n
tj�|_|dkr(tj}|j|j�|_|dkrDtj}|rxy|jj|�Wnt	k
rvt
jd�YnX|dkr�t�}||_
d|_i|_dS)NzLcannot set udev monitor receive buffer size, we are probably running inside zIcontainer or with limited capabilites, TuneD functionality may be limitedz�cannot set udev monitor receive buffer size, we are probably running inside container or with limited capabilites, TuneD functionality may be limited)�
_udev_context�pyudevZContextZMonitorZfrom_netlink�
_udev_monitorrZCFG_DEF_UDEV_BUFFER_SIZE�set_receive_buffer_size�EnvironmentError�log�warn�_MonitorObserverFactory�_monitor_observer_factory�_monitor_observer�_subscriptions)�selfZudev_contextZudev_monitor_clsZmonitor_observer_factory�buffer_sizer�r�/usr/lib/python3.6/inventory.py�__init__s&
zInventory.__init__cCs:ytjj|j||�Stk
r4tjj|j||�SXdS)z9Get a pyudev.Device object for the sys_name (e.g. 'sda').N)rZDevices�	from_namer�AttributeErrorZDevice)r�	subsystemZsys_namerrr�
get_device)szInventory.get_devicecCs|jj|d�S)z)Get list of devices on a given subsystem.)r)rZlist_devices)rrrrr�get_devices1szInventory.get_devicescCsx|j|jkrdSxb|j|jD]R\}}y|||�Wqtk
rn}ztjd|�tj|�WYdd}~XqXqWdS)Nz+Exception occured in event handler of '%s'.)rr�	Exceptionr	�errorZ	exception)rZeventZdevice�plugin�callback�errr�_handle_udev_event5szInventory._handle_udev_eventcCs\tjd||f�||f}||jkr6|j|j|�n"|g|j|<|jj|�|jj�dS)z7Register handler of device events on a given subsystem.zadding handler: %s (%s)N)r	�debugr�appendrZ	filter_by�start)rrrr�
callback_datarrr�	subscribe@s
zInventory.subscribecCs6|jdkr2tjd�|jj|j|j�|_|jj�dS)Nzstarting monitor observer)r
r	rr�createrrr!)rrrr�start_processing_eventsLs

z!Inventory.start_processing_eventscCs(|jdk	r$tjd�|jj�d|_dS)Nzstopping monitor observer)r
r	r�stop)rrrr�stop_processing_eventsRs


z Inventory.stop_processing_eventscCsJxD|j|D]6}|\}}||krtjd||f�|j|j|�qWdS)Nzremoving handler: %s (%s))rr	r�remove)rrrr"Z_pluginrrrr�_unsubscribe_subsystemXs
z Inventory._unsubscribe_subsystemcCsfg}xF|jD]<}|dks ||kr|j||�t|j|�dkr|j|�qWx|D]}|j|=qRWdS)z4Unregister handler registered with subscribe method.Nr)rr)�lenr )rrrZempty_subsystemsZ
_subsystemrrr�unsubscribe_s
zInventory.unsubscribe)NNNNT)N)
�__name__�
__module__�__qualname__�__doc__rrrrr#r%r'r)r+rrrrr	s
c@seZdZdd�ZdS)rcOstj||�S)N)rZMonitorObserver)r�args�kwargsrrrr$lsz_MonitorObserverFactory.createN)r,r-r.r$rrrrrksr)rZ
tuned.logsZtunedr�__all__Zlogs�getr	�objectrrrrrr�<module>s
bPKw[��G���#__pycache__/__init__.cpython-36.pycnu�[���3

�<�eZ�@sddlTddlTddlTdS)�)�*N)Z	inventoryZdevice_matcherZdevice_matcher_udev�rr�/usr/lib/python3.6/__init__.py�<module>sPKw[��G���)__pycache__/__init__.cpython-36.opt-1.pycnu�[���3

�<�eZ�@sddlTddlTddlTdS)�)�*N)Z	inventoryZdevice_matcherZdevice_matcher_udev�rr�/usr/lib/python3.6/__init__.py�<module>sPKw[���ff*__pycache__/inventory.cpython-36.opt-1.pycnu�[���3

�<�e3�@sPddlZddlZddlmZdgZejj�ZGdd�de�Z	Gdd�de�Z
dS)�N)�consts�	Inventoryc@s\eZdZdZddd�Zdd�Zdd	�Zd
d�Zdd
�Zdd�Z	dd�Z
dd�Zddd�ZdS)rz�
	Inventory object can handle information about available hardware devices. It also informs the plugins
	about related hardware events.
	NTcCs�|dk	r||_n
tj�|_|dkr(tj}|j|j�|_|dkrDtj}|rxy|jj|�Wnt	k
rvt
jd�YnX|dkr�t�}||_
d|_i|_dS)NzLcannot set udev monitor receive buffer size, we are probably running inside zIcontainer or with limited capabilites, TuneD functionality may be limitedz�cannot set udev monitor receive buffer size, we are probably running inside container or with limited capabilites, TuneD functionality may be limited)�
_udev_context�pyudevZContextZMonitorZfrom_netlink�
_udev_monitorrZCFG_DEF_UDEV_BUFFER_SIZE�set_receive_buffer_size�EnvironmentError�log�warn�_MonitorObserverFactory�_monitor_observer_factory�_monitor_observer�_subscriptions)�selfZudev_contextZudev_monitor_clsZmonitor_observer_factory�buffer_sizer�r�/usr/lib/python3.6/inventory.py�__init__s&
zInventory.__init__cCs:ytjj|j||�Stk
r4tjj|j||�SXdS)z9Get a pyudev.Device object for the sys_name (e.g. 'sda').N)rZDevices�	from_namer�AttributeErrorZDevice)r�	subsystemZsys_namerrr�
get_device)szInventory.get_devicecCs|jj|d�S)z)Get list of devices on a given subsystem.)r)rZlist_devices)rrrrr�get_devices1szInventory.get_devicescCsx|j|jkrdSxb|j|jD]R\}}y|||�Wqtk
rn}ztjd|�tj|�WYdd}~XqXqWdS)Nz+Exception occured in event handler of '%s'.)rr�	Exceptionr	�errorZ	exception)rZeventZdevice�plugin�callback�errr�_handle_udev_event5szInventory._handle_udev_eventcCs\tjd||f�||f}||jkr6|j|j|�n"|g|j|<|jj|�|jj�dS)z7Register handler of device events on a given subsystem.zadding handler: %s (%s)N)r	�debugr�appendrZ	filter_by�start)rrrr�
callback_datarrr�	subscribe@s
zInventory.subscribecCs6|jdkr2tjd�|jj|j|j�|_|jj�dS)Nzstarting monitor observer)r
r	rr�createrrr!)rrrr�start_processing_eventsLs

z!Inventory.start_processing_eventscCs(|jdk	r$tjd�|jj�d|_dS)Nzstopping monitor observer)r
r	r�stop)rrrr�stop_processing_eventsRs


z Inventory.stop_processing_eventscCsJxD|j|D]6}|\}}||krtjd||f�|j|j|�qWdS)Nzremoving handler: %s (%s))rr	r�remove)rrrr"Z_pluginrrrr�_unsubscribe_subsystemXs
z Inventory._unsubscribe_subsystemcCsfg}xF|jD]<}|dks ||kr|j||�t|j|�dkr|j|�qWx|D]}|j|=qRWdS)z4Unregister handler registered with subscribe method.Nr)rr)�lenr )rrrZempty_subsystemsZ
_subsystemrrr�unsubscribe_s
zInventory.unsubscribe)NNNNT)N)
�__name__�
__module__�__qualname__�__doc__rrrrr#r%r'r)r+rrrrr	s
c@seZdZdd�ZdS)rcOstj||�S)N)rZMonitorObserver)r�args�kwargsrrrr$lsz_MonitorObserverFactory.createN)r,r-r.r$rrrrrksr)rZ
tuned.logsZtunedr�__all__Zlogs�getr	�objectrrrrrr�<module>s
bPKw[H�<DD.__pycache__/device_matcher_udev.cpython-36.pycnu�[���3

�<�e�@s0ddlmZddlZdgZGdd�dej�ZdS)�)�device_matcher�N�DeviceMatcherUdevc@seZdZdd�ZdS)rcCsrd}y|jj�}Wntk
r.|j�}YnXx,tt|��D]\}}||d|d7}q>Wtj||tj�dk	S)zc
		Match a device against the udev regex in tuning profiles.

		device is a pyudev.Device object
		��=�
N)�
properties�items�AttributeError�sorted�list�re�search�	MULTILINE)�selfZregexZdevicerr	�key�val�r�)/usr/lib/python3.6/device_matcher_udev.py�matchszDeviceMatcherUdev.matchN)�__name__�
__module__�__qualname__rrrrrrs)rrr
�__all__Z
DeviceMatcherrrrrr�<module>sPKw[���33inventory.pynu�[���import pyudev
import tuned.logs
from tuned import consts

__all__ = ["Inventory"]

log = tuned.logs.get()

class Inventory(object):
	"""
	Inventory object can handle information about available hardware devices. It also informs the plugins
	about related hardware events.
	"""

	def __init__(self, udev_context=None, udev_monitor_cls=None, monitor_observer_factory=None, buffer_size=None, set_receive_buffer_size=True):
		if udev_context is not None:
			self._udev_context = udev_context
		else:
			self._udev_context = pyudev.Context()

		if udev_monitor_cls is None:
			udev_monitor_cls = pyudev.Monitor
		self._udev_monitor = udev_monitor_cls.from_netlink(self._udev_context)
		if buffer_size is None:
			buffer_size = consts.CFG_DEF_UDEV_BUFFER_SIZE

		if (set_receive_buffer_size):
			try:
				self._udev_monitor.set_receive_buffer_size(buffer_size)
			except EnvironmentError:
				log.warn("cannot set udev monitor receive buffer size, we are probably running inside " +
					 "container or with limited capabilites, TuneD functionality may be limited")

		if monitor_observer_factory is None:
			monitor_observer_factory = _MonitorObserverFactory()
		self._monitor_observer_factory = monitor_observer_factory
		self._monitor_observer = None

		self._subscriptions = {}

	def get_device(self, subsystem, sys_name):
		"""Get a pyudev.Device object for the sys_name (e.g. 'sda')."""
		try:
			return pyudev.Devices.from_name(self._udev_context, subsystem, sys_name)
		# workaround for pyudev < 0.18
		except AttributeError:
			return pyudev.Device.from_name(self._udev_context, subsystem, sys_name)

	def get_devices(self, subsystem):
		"""Get list of devices on a given subsystem."""
		return self._udev_context.list_devices(subsystem=subsystem)

	def _handle_udev_event(self, event, device):
		if not device.subsystem in self._subscriptions:
			return

		for (plugin, callback) in self._subscriptions[device.subsystem]:
			try:
				callback(event, device)
			except Exception as e:
				log.error("Exception occured in event handler of '%s'." % plugin)
				log.exception(e)

	def subscribe(self, plugin, subsystem, callback):
		"""Register handler of device events on a given subsystem."""
		log.debug("adding handler: %s (%s)" % (subsystem, plugin))
		callback_data = (plugin, callback)
		if subsystem in self._subscriptions:
			self._subscriptions[subsystem].append(callback_data)
		else:
			self._subscriptions[subsystem] = [callback_data, ]
			self._udev_monitor.filter_by(subsystem)
			# After start(), HW events begin to get queued up
			self._udev_monitor.start()

	def start_processing_events(self):
		if self._monitor_observer is None:
			log.debug("starting monitor observer")
			self._monitor_observer = self._monitor_observer_factory.create(self._udev_monitor, self._handle_udev_event)
			self._monitor_observer.start()

	def stop_processing_events(self):
		if self._monitor_observer is not None:
			log.debug("stopping monitor observer")
			self._monitor_observer.stop()
			self._monitor_observer = None

	def _unsubscribe_subsystem(self, plugin, subsystem):
		for callback_data in self._subscriptions[subsystem]:
			(_plugin, callback) = callback_data
			if plugin == _plugin:
				log.debug("removing handler: %s (%s)" % (subsystem, plugin))
				self._subscriptions[subsystem].remove(callback_data)

	def unsubscribe(self, plugin, subsystem=None):
		"""Unregister handler registered with subscribe method."""
		empty_subsystems = []
		for _subsystem in self._subscriptions:
			if subsystem is None or _subsystem == subsystem:
				self._unsubscribe_subsystem(plugin, _subsystem)
				if len(self._subscriptions[_subsystem]) == 0:
					empty_subsystems.append(_subsystem)

		for _subsystem in empty_subsystems:
			del self._subscriptions[_subsystem]

class _MonitorObserverFactory(object):
	def create(self, *args, **kwargs):
		return pyudev.MonitorObserver(*args, **kwargs)
PKw[ϫ��((device_matcher.pynu�[���import fnmatch
import re

__all__ = ["DeviceMatcher"]

class DeviceMatcher(object):
	"""
	Device name matching against the devices specification in tuning profiles.

	The devices specification consists of multiple rules separated by spaces.
	The rules have a syntax of shell-style wildcards and are either positive
	or negative. The negative rules are prefixed with an exclamation mark.
	"""
	def match(self, rules, device_name):
		"""
		Match a device against the specification in the profile.

		If there is no positive rule in the specification, implicit rule
		which matches all devices is added. The device matches if and only
		if it matches some positive rule, but no negative rule.
		"""
		if isinstance(rules, str):
			rules = re.split(r"\s|,\s*", rules)

		positive_rules = [rule for rule in rules if not rule.startswith("!") and not rule.strip() == '']
		negative_rules = [rule[1:] for rule in rules if rule not in positive_rules]

		if len(positive_rules) == 0:
			positive_rules.append("*")

		matches = False
		for rule in positive_rules:
			if fnmatch.fnmatch(device_name, rule):
				matches = True
				break

		for rule in negative_rules:
			if fnmatch.fnmatch(device_name, rule):
				matches = False
				break

		return matches

	def match_list(self, rules, device_list):
		"""
		Match a device list against the specification in the profile. Returns
		the list, which is a subset of devices which match.
		"""
		matching_devices = []
		for device in device_list:
			if self.match(rules, device):
				matching_devices.append(device)

		return matching_devices
PKw[�q�ZZ__init__.pynu�[���PKw[,'���device_matcher_udev.pynu�[���PKw["H���)�__pycache__/device_matcher.cpython-36.pycnu�[���PKw[H�<DD4__pycache__/device_matcher_udev.cpython-36.opt-1.pycnu�[���PKw["H���/�__pycache__/device_matcher.cpython-36.opt-1.pycnu�[���PKw[���ff$�__pycache__/inventory.cpython-36.pycnu�[���PKw[��G���#�'__pycache__/__init__.cpython-36.pycnu�[���PKw[��G���)�(__pycache__/__init__.cpython-36.opt-1.pycnu�[���PKw[���ff*�)__pycache__/inventory.cpython-36.opt-1.pycnu�[���PKw[H�<DD.|:__pycache__/device_matcher_udev.cpython-36.pycnu�[���PKw[���33>inventory.pynu�[���PKw[ϫ��((�Mdevice_matcher.pynu�[���PK��S