3 �^� � @ s6 d dl Z ddlmZ ddlmZ G dd� dee�ZdS )� N� )�MatchContext)�PolicyQueryc sF e Zd ZdZdZedd� �Zejdd� �Z� fdd�Zdd � Z � Z S ) �PirqconQuerya� Pirqcon context query. Parameter: policy The policy to query. Keyword Parameters/Class attributes: irq A single IRQ value. user The criteria to match the context's user. user_regex If true, regular expression matching will be used on the user. role The criteria to match the context's role. role_regex If true, regular expression matching will be used on the role. type_ The criteria to match the context's type. type_regex If true, regular expression matching will be used on the type. range_ The criteria to match the context's range. range_subset If true, the criteria will match if it is a subset of the context's range. range_overlap If true, the criteria will match if it overlaps any of the context's range. range_superset If true, the criteria will match if it is a superset of the context's range. range_proper If true, use proper superset/subset operations. No effect if not using set operations. Nc C s | j S )N)�_irq)�self� r �$/usr/lib64/python3.6/pirqconquery.py�irq= s zPirqconQuery.irqc C s, |r"|dk rt dj|���|| _nd | _d S )Nr zThe IRQ must be positive: {0})� ValueError�formatr )r �valuer r r r A s c s$ t t| �j|f|� tjt�| _d S )N)�superr �__init__�loggingZ getLogger�__name__�log)r �policy�kwargs)� __class__r r r K s zPirqconQuery.__init__c c sp | j jdj| �� | j jdj| �� | j| j � x:| jj� D ],}| jrT| j|jkrTq<| j|j �sbq<|V q<W dS )z-Generator which yields all matching pirqcons.z"Generating results from {0.policy}zIRQ: {0.irq!r}N) r �infor �debugZ_match_context_debugr Zpirqconsr Z_match_context�context)r Zpirqconr r r �resultsO s zPirqconQuery.results)r � __module__�__qualname__�__doc__r �propertyr �setterr r � __classcell__r r )r r r s r )r Zmixinsr Zqueryr r r r r r �<module> s