Spade
Mini Shell
| Directory:~$ /lib/python2.7/site-packages/tuned/hardware/ |
| [Home] [System Details] [Kill Me] |
�
��\c@s;ddlZddlZdgZdefd��YZdS(i����Nt
DeviceMatchercBs
eZdZd�Zd�ZRS(s,
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.
cCst|t�r$tjd|�}ng|D]/}|jd�r+|j�dkr+|^q+}g|D]}||krg|d^qg}t|�dkr�|jd�nt}x*|D]"}t j ||�r�t
}Pq�q�Wx*|D]"}t j ||�r�t}Pq�q�W|S(s
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.
s\s|,\s*t!tiit*(t
isinstancetstrtretsplitt
startswithtstriptlentappendtFalsetfnmatchtTrue(tselftrulestdevice_nametruletpositive_rulestnegative_rulestmatches((sA/usr/lib/python2.7/site-packages/tuned/hardware/device_matcher.pytmatchs
<)
cCs=g}x0|D](}|j||�r
|j|�q
q
W|S(s�
Match a device list against the specification in the profile. Returns
the list, which is a subset of devices which match.
(RR(RRtdevice_listtmatching_devicestdevice((sA/usr/lib/python2.7/site-packages/tuned/hardware/device_matcher.pyt
match_list,s
(t__name__t
__module__t__doc__RR(((sA/usr/lib/python2.7/site-packages/tuned/hardware/device_matcher.pyRs (R
Rt__all__tobjectR(((sA/usr/lib/python2.7/site-packages/tuned/hardware/device_matcher.pyt<module>s