a ”ˆ«h(ã@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. cst|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Ú óz'DeviceMatcher.match..cs g|]}|ˆvr|dd…‘qS)éNr r©Zpositive_rulesr r r r rÚ*FT)Ú isinstanceÚstrÚreÚsplitÚlenÚappendÚfnmatch)ÚselfÚrulesZ device_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)rrZ device_listZmatching_devicesZdevicer r r Ú match_list,s   zDeviceMatcher.match_listN)Ú__name__Ú __module__Ú __qualname__Ú__doc__rrr r r r rs)rrÚ__all__Úobjectrr r r r Ús