ó ±2öYc@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. cCsåt|tƒr$tjd|ƒ}ntd„|ƒ}g|D]}||kr=|d^q=}t|ƒdkr|jdƒnt}x*|D]"}tj||ƒrŽt }PqŽqŽWx*|D]"}tj||ƒ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*cSs!|jdƒ o |jƒdk S(Nt!t(t startswithtstrip(trule((sA/usr/lib/python2.7/site-packages/tuned/hardware/device_matcher.pytsiit*( t isinstancet basestringtretsplittfiltertlentappendtFalsetfnmatchtTrue(tselftrulest device_nametpositive_rulesRtnegative_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 (RR t__all__tobjectR(((sA/usr/lib/python2.7/site-packages/tuned/hardware/device_matcher.pyts