ó æ ”\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ƒdk r+|^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(tselftrulest device_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 (RRt device_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.pyts