³ò
—ã=Pc           @   sú   d  Z  d d k l Z d d k Td d k Td d k l Z l Z d d k l	 Z	 e e
 ƒ Z d e f d „  ƒ  YZ d e f d	 „  ƒ  YZ d
 e f d „  ƒ  YZ d e f d „  ƒ  YZ d e f d „  ƒ  YZ d e f d „  ƒ  YZ d e f d „  ƒ  YZ d S(   sD   
The I{query} module defines a class for performing schema queries.
iÿÿÿÿ(   t	   getLogger(   t   *(   t   qualifyt   isqref(   t   Factoryt   Queryc           B   s5   e  Z d  Z d d „ Z d „  Z d „  Z d „  Z RS(   s"   
    Schema query base class.
    c         C   sh   t  i |  ƒ t |  ƒ |  _ | |  _ g  |  _ t |  _ t |  i ƒ p t	 d t
 |  i ƒ ƒ ‚ n d S(   sY   
        @param ref: The schema reference being queried.
        @type ref: qref
        s   %s, must be qrefN(   t   Objectt   __init__t   objidt   idt   reft   historyt   Falset   resolvedR   t	   Exceptiont   tostr(   t   selfR
   (    (    s&   suds-0.3.7-py2.6.egg/suds/xsd/query.pyR   #   s    			c         C   s   t  d ‚ d S(   sE  
        Execute this query using the specified schema.
        @param schema: The schema associated with the query.  The schema
            is used by the query to search for items.
        @type schema: L{schema.Schema}
        @return: The item matching the search criteria.
        @rtype: L{sxbase.SchemaObject}
        s   not-implemented by subclassN(   R   (   R   t   schema(    (    s&   suds-0.3.7-py2.6.egg/suds/xsd/query.pyt   execute0   s    	c         C   sL   | d j o t Sn | |  i j } | o t i d t | ƒ |  ƒ n | S(   sê   
        Filter the specified result based on query criteria.
        @param result: A potential result.
        @type result: L{sxbase.SchemaObject}
        @return: True if result should be excluded.
        @rtype: boolean
        s   result %s, rejected by
%sN(   t   Nonet   TrueR   t   logt   debugt   Repr(   R   t   resultt   reject(    (    s&   suds-0.3.7-py2.6.egg/suds/xsd/query.pyt   filter;   s    c         C   sr   | d j o t i d |  i ƒ d Sn |  i o | i ƒ  } n t i d |  i t | ƒ ƒ |  i i | ƒ | S(   sƒ   
        Query result post processing.
        @param result: A query result.
        @type result: L{sxbase.SchemaObject}
        s   %s, not-foundNs   %s, found as: %s(	   R   R   R   R
   R   t   resolveR   R   t   append(   R   R   (    (    s&   suds-0.3.7-py2.6.egg/suds/xsd/query.pyR   J   s    
N(   t   __name__t
   __module__t   __doc__R   R   R   R   R   (    (    (    s&   suds-0.3.7-py2.6.egg/suds/xsd/query.pyR      s
   		t
   BlindQueryc           B   s   e  Z d  Z d „  Z RS(   sÚ   
    Schema query class that I{blindly} searches for a reference in
    the specified schema.  It may be used to find Elements and Types but
    will match on an Element first.  This query will also find builtins.
    c         C   sè   | i  |  i ƒ o= |  i d } t i | | ƒ } t i d |  i | ƒ | Sn d  } xG | i | i	 f D]3 } | i
 |  i ƒ } |  i | ƒ o
 d  } qi Pqi W| d  j o. t |  i ƒ } |  i | _ | i | ƒ } n |  i | ƒ S(   Ni    s   %s, found builtin (%s)(   t   builtinR
   R   t   createR   R   R	   R   t   elementst   typest   getR   t   ElementQueryR   R   R   (   R   R   t   namet   bR   t   dt   eq(    (    s&   suds-0.3.7-py2.6.egg/suds/xsd/query.pyR   a   s"     
(   R   R   R   R   (    (    (    s&   suds-0.3.7-py2.6.egg/suds/xsd/query.pyR    Z   s   t	   TypeQueryc           B   s   e  Z d  Z d „  Z RS(   sx   
    Schema query class that searches for Type references in
    the specified schema.  Matches on root types only.
    c         C   sŒ   | i  |  i ƒ o= |  i d } t i | | ƒ } t i d |  i | ƒ | Sn | i i |  i ƒ } |  i	 | ƒ o
 d  } n |  i | ƒ S(   Ni    s   %s, found builtin (%s)(   R!   R
   R   R"   R   R   R	   R$   R%   R   R   R   (   R   R   R'   R(   R   (    (    s&   suds-0.3.7-py2.6.egg/suds/xsd/query.pyR   {   s    
(   R   R   R   R   (    (    (    s&   suds-0.3.7-py2.6.egg/suds/xsd/query.pyR+   u   s   t
   GroupQueryc           B   s   e  Z d  Z d „  Z RS(   s\   
    Schema query class that searches for Group references in
    the specified schema.
    c         C   s<   | i  i |  i ƒ } |  i | ƒ o
 d  } n |  i | ƒ S(   N(   t   groupsR%   R
   R   R   R   (   R   R   R   (    (    s&   suds-0.3.7-py2.6.egg/suds/xsd/query.pyR      s    
(   R   R   R   R   (    (    (    s&   suds-0.3.7-py2.6.egg/suds/xsd/query.pyR,   ‡   s   t	   AttrQueryc           B   s    e  Z d  Z d „  Z d „  Z RS(   sµ   
    Schema query class that searches for Attribute references in
    the specified schema.  Matches on root Attribute by qname first, then searches
    deep into the document.
    c         C   sE   | i  i |  i ƒ } |  i | ƒ o |  i | ƒ } n |  i | ƒ S(   N(   t
   attributesR%   R
   R   t   _AttrQuery__deepsearchR   (   R   R   R   (    (    s&   suds-0.3.7-py2.6.egg/suds/xsd/query.pyR   ›   s    c         C   sa   d d k  l } d  } xD | i D]9 } | i |  i | f ƒ } |  i | ƒ o
 d  } q  Pq  W| S(   Niÿÿÿÿ(   t	   Attribute(   t   suds.xsd.sxbasicR1   R   t   allt   findR
   R   (   R   R   R1   R   t   e(    (    s&   suds-0.3.7-py2.6.egg/suds/xsd/query.pyt   __deepsearch¡   s    
 
(   R   R   R   R   R0   (    (    (    s&   suds-0.3.7-py2.6.egg/suds/xsd/query.pyR.   ”   s   	t   AttrGroupQueryc           B   s   e  Z d  Z d „  Z RS(   se   
    Schema query class that searches for attributeGroup references in
    the specified schema.
    c         C   s<   | i  i |  i ƒ } |  i | ƒ o
 d  } n |  i | ƒ S(   N(   t   agrpsR%   R
   R   R   R   (   R   R   R   (    (    s&   suds-0.3.7-py2.6.egg/suds/xsd/query.pyR   ³   s    
(   R   R   R   R   (    (    (    s&   suds-0.3.7-py2.6.egg/suds/xsd/query.pyR7   ­   s   R&   c           B   s    e  Z d  Z d „  Z d „  Z RS(   s²   
    Schema query class that searches for Element references in
    the specified schema.  Matches on root Elements by qname first, then searches
    deep into the document.
    c         C   sE   | i  i |  i ƒ } |  i | ƒ o |  i | ƒ } n |  i | ƒ S(   N(   R#   R%   R
   R   t   _ElementQuery__deepsearchR   (   R   R   R   (    (    s&   suds-0.3.7-py2.6.egg/suds/xsd/query.pyR   Á   s    c         C   sa   d d k  l } d  } xD | i D]9 } | i |  i | f ƒ } |  i | ƒ o
 d  } q  Pq  W| S(   Niÿÿÿÿ(   t   Element(   R2   R:   R   R3   R4   R
   R   (   R   R   R:   R   R5   (    (    s&   suds-0.3.7-py2.6.egg/suds/xsd/query.pyR6   Ç   s    
 
(   R   R   R   R   R9   (    (    (    s&   suds-0.3.7-py2.6.egg/suds/xsd/query.pyR&   º   s   	N(   R   t   loggingR    t   sudst   suds.sudsobjectt   suds.xsdR   R   t   suds.xsd.sxbuiltinR   R   R   R   R   R    R+   R,   R.   R7   R&   (    (    (    s&   suds-0.3.7-py2.6.egg/suds/xsd/query.pys   <module>   s   

<