
­­­­­­­­­­­­­­­­­­
<!DOCTYPE html>
<html>
3
^_                 @   sb   d dl Z ddlmZmZ ddlmZ ddlmZ ddlm	Z	 ddl
mZmZ G dd	 d	ee	ZdS )
    N   )CriteriaDescriptorCriteriaSetDescriptor)MatchObjClass)MLSRuletype)PolicyQuery)match_indirect_regexmatch_rangec                   s~   e Zd ZdZeedZeddZdZ	dZ
eddZdZdZedd	ZdZed
dZdZdZdZdZ fddZdd Z  ZS )MLSRuleQuerya  
    Query MLS rules.

    Parameter:
    policy            The policy to query.

    Keyword Parameters/Class attributes:
    ruletype         The list of rule type(s) to match.
    source           The name of the source type/attribute to match.
    source_regex     If true, regular expression matching will
                     be used on the source type/attribute.
    target           The name of the target type/attribute to match.
    target_regex     If true, regular expression matching will
                     be used on the target type/attribute.
    tclass           The object class(es) to match.
    tclass_regex     If true, use a regular expression for
                     matching the rule's object class.
    )
enum_classsource_regexZlookup_type_or_attrFTtarget_regextclass_regexZlookup_classZlookup_range)Zlookup_functionc                s$   t t| j|f| tjt| _d S )N)superr
   __init__loggingZ	getLogger__name__log)selfpolicykwargs)	__class__ $/usr/lib64/python3.6/mlsrulequery.pyr   @   s    zMLSRuleQuery.__init__c             c   s  | j jdj|  | j jdj|  | j jdj|  | j jdj|  | j| j  | j jdj|  x| jj D ]}| jr|j| jkrqr| jrt	|j| j| j
| j rqr| jrt	|j| j| j| j rqr| j|sqr| jot|j| j| j| j| j| j r qr|V  qrW dS )z.Generator which yields all matching MLS rules.z+Generating MLS rule results from {0.policy}zRuletypes: {0.ruletype}zLSource: {0.source!r}, indirect: {0.source_indirect}, regex: {0.source_regex}zLTarget: {0.target!r}, indirect: {0.target_indirect}, regex: {0.target_regex}zDefault: {0.default!r}, overlap: {0.default_overlap}, subset: {0.default_subset}, superset: {0.default_superset}, proper: {0.default_proper}N)r   infoformatdebugZ_match_object_class_debugr   Zmlsrulesruletypesourcer   source_indirectr   targettarget_indirectr   Z_match_object_classdefaultr	   default_subsetdefault_overlapdefault_supersetdefault_proper)r   Zruler   r   r   resultsD   sH    





zMLSRuleQuery.results)r   
__module____qualname____doc__r   r   r   r   r   r   r   r    r   r!   Ztclassr   r"   r$   r#   r%   r&   r   r'   __classcell__r   r   )r   r   r
      s"   




r
   )r   Zdescriptorsr   r   Zmixinsr   Z	policyrepr   Zqueryr   utilr   r	   r
   r   r   r   r   <module>   s   