a qéqemã@snddlZddlZddlmZddlmZddlmZddlm Z ddl m Z ddl m Z Gd d „d ee ƒZdS) éN)ÚIterableé)ÚCriteriaSetDescriptor)Ú MatchName)Ú TypeAttribute)Ú PolicyQuery)Úmatch_regex_or_setcs\eZdZUdZeddƒZdZeed<dZ eed<ddœ‡fdd „ Z e e dœd d „Z ‡ZS) ÚTypeAttributeQueryaâ Query SELinux policy type attributes. Parameter: policy The policy to query. Keyword Parameters/Class attributes: name The type name to match. name_regex If true, regular expression matching will be used on the type names. types The type to match. types_equal If true, only attributes with type sets that are equal to the criteria will match. Otherwise, any intersection will match. types_regex If true, regular expression matching will be used on the type names instead of set logic. Ú types_regexZ lookup_typeFÚ types_equalN)Úreturnc s(tt|ƒj|fi|¤Žt t¡|_dS)N)Úsuperr Ú__init__ÚloggingZ getLoggerÚ__name__Úlog)ÚselfÚpolicyÚkwargs©Ú __class__©ú;/usr/lib64/python3.9/site-packages/setools/typeattrquery.pyr*szTypeAttributeQuery.__init__ccsz|j d |¡¡| |j¡|j d |¡¡|j ¡D]:}| |¡sJq:|jrnt t |  ¡ƒ|j|j |j ƒsnq:|Vq:dS)z*Generator which yields all matching types.z1Generating type attribute results from {0.policy}z?Types: {0.types!r}, regex: {0.types_regex}, eq: {0.types_equal}N)rÚinfoÚformatZ_match_name_debugÚdebugrZtypeattributesZ _match_nameÚtypesrÚsetÚexpandr r )rÚattrrrrÚresults.s   ÿ  üzTypeAttributeQuery.results)rÚ __module__Ú __qualname__Ú__doc__rrr ÚboolÚ__annotations__r rrrr Ú __classcell__rrrrr s    r )rÚreÚtypingrZ descriptorsrZmixinsrZ policyreprÚqueryrÚutilrr rrrrÚs