Warning: session_start(): Session cannot be started after headers have already been sent in /home/tvrreohg/public_html/manga.php on line 13
3
À<×e( ã @ s* d dl Z d dlZdgZG dd„ deƒZdS )é NÚ
DeviceMatcherc @ s e Zd ZdZdd„ Zdd„ ZdS )r a,
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.
c s” t |tƒrtjd|ƒ}dd„ |D ƒ‰ ‡ fdd„|D ƒ}tˆ ƒdkrLˆ jdƒ d}xˆ D ]}tj||ƒrVd}P qVW x|D ]}tj||ƒrvd}P qvW |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*c S s* g | ]"}|j d ƒ r|jƒ dk r|‘qS )ú!Ú )Ú
startswithÚstrip)Ú.0Úrule© r ú$/usr/lib/python3.6/device_matcher.pyú
s z'DeviceMatcher.match..c s g | ]}|ˆ kr|d d… ‘qS )é Nr )r r )Úpositive_rulesr r
r s r Ú*FT)Ú
isinstanceÚstrÚreÚsplitÚlenÚappendÚfnmatch)ÚselfÚrulesZdevice_nameZnegative_rulesZmatchesr r )r
r
Úmatch s
zDeviceMatcher.matchc C s, g }x"|D ]}| j ||ƒr
|j|ƒ q
W |S )z�
Match a device list against the specification in the profile. Returns
the list, which is a subset of devices which match.
)r r )r r Zdevice_listZmatching_devicesZdevicer r r
Ú
match_list, s
zDeviceMatcher.match_listN)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r r r r r r
r s )r r Ú__all__Úobjectr r r r r
Ú s