a qéqeÍ ã@sxddlZddlZddlmZmZddlmZddlmZm Z ddl m Z ddl m Z ddlmZGd d „d ee e ƒZdS) éN)ÚIterableÚOptionalé)ÚCriteriaSetDescriptor)Ú MatchAliasÚ MatchName)ÚType)Ú PolicyQuery)Úmatch_regex_or_setcs–eZdZUdZeddƒZdZeed<dZ eed<dZ e eed<e e edœd d „ƒZ e jddœd d „ƒZ ddœ‡fd d „ Zeedœdd„Z‡ZS)Ú TypeQuerya Query SELinux policy types. 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. alias The alias name to match. alias_regex If true, regular expression matching will be used on the alias names. attrs The attribute to match. attrs_equal If true, only types with attribute sets that are equal to the criteria will match. Otherwise, any intersection will match. attrs_regex If true, regular expression matching will be used on the attribute names instead of set logic. permissive The permissive state to match. If this is None, the state is not matched. Ú attrs_regexZlookup_typeattrFÚ attrs_equalNÚ _permissive)ÚreturncCs|jS©N)r)Úself©rú7/usr/lib64/python3.9/site-packages/setools/typequery.pyÚ permissive0szTypeQuery.permissivecCs|durd|_n t|ƒ|_dSr)rÚbool)rÚvaluerrrr4sc s(tt|ƒj|fi|¤Žt t¡|_dSr)Úsuperr Ú__init__ÚloggingZ getLoggerÚ__name__Úlog)rÚpolicyÚkwargs©Ú __class__rrr;szTypeQuery.__init__ccs¼|j d |¡¡| |j¡| |j¡|j d |¡¡|j d |¡¡|j ¡D]^}| |¡shqX|  |¡stqX|j r˜t t |  ¡ƒ|j |j|jƒs˜qX|jdur°|j|jkr°qX|VqXdS)z*Generator which yields all matching types.z'Generating type results from {0.policy}z?Attrs: {0.attrs!r}, regex: {0.attrs_regex}, eq: {0.attrs_equal}zPermissive: {0.permissive}N)rÚinfoÚformatZ_match_name_debugZ_match_alias_debugÚdebugrÚtypesZ _match_nameZ _match_aliasÚattrsr ÚsetZ attributesr r rZ ispermissive)rÚtrrrÚresults?s,   ÿ   üzTypeQuery.results)rÚ __module__Ú __qualname__Ú__doc__rr$r rÚ__annotations__r rrÚpropertyrÚsetterrrrr'Ú __classcell__rrrrr s    r )rÚreÚtypingrrZ descriptorsrZmixinsrrZ policyreprÚqueryr Úutilr r rrrrÚs