| Current File : /home/mmdealscpanel/yummmdeals.com/hardware.zip |
PK w[�q�Z Z __init__.pynu �[��� from .inventory import *
from .device_matcher import *
from .device_matcher_udev import *
PK w[,'�� 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
PK w["H�� � ) __pycache__/device_matcher.cpython-36.pycnu �[��� 3
�<�e( � @ s* d dl Z d dlZdgZG dd� de�ZdS )� N�
DeviceMatcherc @ s e Zd ZdZdd� Zdd� ZdS )r a,
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.
c s� t |t�rtjd|�}dd� |D �� � fdd�|D �}t� �dkrL� jd� d}x� D ]}tj||�rVd}P qVW x|D ]}tj||�rvd}P qvW |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*c S s* g | ]"}|j d � r|j� dk r|�qS )�!� )�
startswith�strip)�.0�rule� r �$/usr/lib/python3.6/device_matcher.py�
<listcomp> s z'DeviceMatcher.match.<locals>.<listcomp>c s g | ]}|� kr|d d� �qS )� Nr )r r )�positive_rulesr r
r s r �*FT)�
isinstance�str�re�split�len�append�fnmatch)�self�rulesZdevice_nameZnegative_rulesZmatchesr r )r
r
�match s
zDeviceMatcher.matchc C s, 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.
)r r )r r Zdevice_listZmatching_devicesZdevicer r r
�
match_list, s
zDeviceMatcher.match_listN)�__name__�
__module__�__qualname__�__doc__r r r r r r
r s )r r �__all__�objectr r r r r
�<module> s PK w[H�<D D 4 __pycache__/device_matcher_udev.cpython-36.opt-1.pycnu �[��� 3
�<�e � @ s0 d dl mZ ddlZdgZG dd� dej�ZdS )� )�device_matcher� N�DeviceMatcherUdevc @ s e Zd Zdd� ZdS )r c C sr d}y|j j� }W n tk
r. |j� }Y nX x,tt|��D ]\}}||d | d 7 }q>W tj||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)�selfZregexZdevicer r �key�val� r �)/usr/lib/python3.6/device_matcher_udev.py�match s zDeviceMatcherUdev.matchN)�__name__�
__module__�__qualname__r r r r r r s )r r r
�__all__Z
DeviceMatcherr r r r r �<module> s PK w["H�� � / __pycache__/device_matcher.cpython-36.opt-1.pycnu �[��� 3
�<�e( � @ s* d dl Z d dlZdgZG dd� de�ZdS )� N�
DeviceMatcherc @ s e Zd ZdZdd� Zdd� ZdS )r a,
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.
c s� t |t�rtjd|�}dd� |D �� � fdd�|D �}t� �dkrL� jd� d}x� D ]}tj||�rVd}P qVW x|D ]}tj||�rvd}P qvW |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*c S s* g | ]"}|j d � r|j� dk r|�qS )�!� )�
startswith�strip)�.0�rule� r �$/usr/lib/python3.6/device_matcher.py�
<listcomp> s z'DeviceMatcher.match.<locals>.<listcomp>c s g | ]}|� kr|d d� �qS )� Nr )r r )�positive_rulesr r
r s r �*FT)�
isinstance�str�re�split�len�append�fnmatch)�self�rulesZdevice_nameZnegative_rulesZmatchesr r )r
r
�match s
zDeviceMatcher.matchc C s, 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.
)r r )r r Zdevice_listZmatching_devicesZdevicer r r
�
match_list, s
zDeviceMatcher.match_listN)�__name__�
__module__�__qualname__�__doc__r r r r r r
r s )r r �__all__�objectr r r r r
�<module> s PK w[���f f $ __pycache__/inventory.cpython-36.pycnu �[��� 3
�<�e3 � @ sP d dl Z d dlZd dlmZ dgZejj� ZG dd� de�Z G dd� de�Z
dS )� N)�consts� Inventoryc @ s\ e Zd ZdZddd�Zdd� Zdd � Zd
d� Zdd
� Zdd� Z dd� Z
dd� Zddd�ZdS )r z�
Inventory object can handle information about available hardware devices. It also informs the plugins
about related hardware events.
NTc C s� |d k r|| _ n
tj� | _ |d kr(tj}|j| j �| _|d krDtj}|rxy| jj|� W n t k
rv t
jd� Y nX |d kr�t� }|| _
d | _i | _d S )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�pyudevZContextZMonitorZfrom_netlink�
_udev_monitorr ZCFG_DEF_UDEV_BUFFER_SIZE�set_receive_buffer_size�EnvironmentError�log�warn�_MonitorObserverFactory�_monitor_observer_factory�_monitor_observer�_subscriptions)�selfZudev_contextZudev_monitor_clsZmonitor_observer_factory�buffer_sizer � r �/usr/lib/python3.6/inventory.py�__init__ s&