HEX
Server: Apache
System: Linux nc-ph-4101.simplemoneygoals.com 5.14.0-503.21.1.el9_5.x86_64 #1 SMP PREEMPT_DYNAMIC Sun Jan 12 09:45:05 EST 2025 x86_64
User: dailygoldindex (1004)
PHP: 8.1.33
Disabled: NONE
Upload Files
File: //lib/python3.9/site-packages/tuned/hardware/__pycache__/device_matcher.cpython-39.opt-1.pyc
a

,�g(�@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�rt�d|�}dd�|D���fdd�|D�}t��dkrL��d�d}�D]}t�||�rTd}qnqT|D]}t�||�rrd}q�qr|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|]}|�d�s|��dks|�qS)�!�)�
startswith�strip��.0�rule�r
�A/usr/lib/python3.9/site-packages/tuned/hardware/device_matcher.py�
<listcomp>�z'DeviceMatcher.match.<locals>.<listcomp>cs g|]}|�vr|dd��qS)�Nr
r�Zpositive_rulesr
rrr
r�*FT)�
isinstance�str�re�split�len�append�fnmatch)�self�rulesZdevice_nameZnegative_rules�matchesr	r
rr�matchs 

zDeviceMatcher.matchcCs(g}|D]}|�||�r|�|�q|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
rrs)rr�__all__�objectrr
r
r
r�<module>s