a qéqeÍã@snddlZddlZddlmZddlmZddlmZddlm Z ddl m Z ddl m Z Gd d „d ee ƒZdS) éN)ÚIterableé)ÚCriteriaSetDescriptor)Ú MatchName)ÚRole)Ú PolicyQuery)Úmatch_regex_or_setcs\eZdZUdZeddƒZdZeed<dZ eed<ddœ‡fdd „ Z e e dœd d „Z ‡ZS) Ú RoleQuerya† Query SELinux policy roles. Parameter: policy The policy to query. Keyword Parameters/Class attributes: name The role name to match. name_regex If true, regular expression matching will be used on the role names. types The type to match. types_equal If true, only roles 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__©ú7/usr/lib64/python3.9/site-packages/setools/rolequery.pyr*szRoleQuery.__init__ccsz|j d |¡¡| |j¡|j d |¡¡|j ¡D]:}| |¡sJq:|jrnt t | ¡ƒ|j|j |j ƒsnq:|Vq:dS)z*Generator which yields all matching roles.z'Generating role results from {0.policy}z?Types: {0.types!r}, regex: {0.types_regex}, eq: {0.types_equal}N) rÚinfoÚformatZ_match_name_debugÚdebugrZrolesZ _match_nameÚtypesrÚsetr r )rÚrrrrÚresults.s   ÿ  üzRoleQuery.results)rÚ __module__Ú __qualname__Ú__doc__rrr ÚboolÚ__annotations__r rrrrÚ __classcell__rrrrr s    r )rÚreÚtypingrZ descriptorsrZmixinsrZ policyreprÚqueryrÚutilrr rrrrÚs