ó
U&^Kc           @   sÍ   d  Z  d d l m Z e e ƒ Z d e f d „  ƒ  YZ d e f d „  ƒ  YZ d e f d „  ƒ  YZ d	 f  d
 „  ƒ  YZ	 d f  d „  ƒ  YZ
 d e f d „  ƒ  YZ d e f d „  ƒ  YZ d f  d „  ƒ  YZ d S(   s   
Properties classes.
iÿÿÿÿ(   t	   getLoggert
   AutoLinkerc           B   s   e  Z d  Z d „  Z RS(   s¢   
    Base class, provides interface for I{automatic} link
    management between a L{Properties} object and the L{Properties}
    contained within I{values}.
    c         C   s   d S(   sÞ   
        Notification that a values was updated and the linkage
        between the I{properties} contained with I{prev} need to
        be relinked to the L{Properties} contained within the
        I{next} value.
        N(    (   t   selft
   propertiest   prevt   next(    (    sI   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/suds/properties.pyt   updated    s    (   t   __name__t
   __module__t   __doc__R   (    (    (    sI   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/suds/properties.pyR      s   t   Linkc           B   s)   e  Z d  Z d „  Z d „  Z d „  Z RS(   s|   
    Property link object.
    @ivar endpoints: A tuple of the (2) endpoints of the link.
    @type endpoints: tuple(2)
    c         C   sa   t  |  | ƒ } t  |  | ƒ } | | f |  _ |  j | | ƒ | j j | ƒ | j j | ƒ d S(   s“   
        @param a: Property (A) to link.
        @type a: L{Property}
        @param b: Property (B) to link.
        @type b: L{Property}
        N(   t   Endpointt	   endpointst   validatet   linkst   append(   R   t   at   bt   pAt   pB(    (    sI   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/suds/properties.pyt   __init__0   s    c   	      C   s  | | j  k s | | j  k r* t d ‚ n  | j ƒ  } | j ƒ  } x* | D]" } | | k rI t d | ‚ qI qI Wx* | D]" } | | k rv t d | ‚ qv qv W| j ƒ  } | j ƒ  } x* | D]" } | | k r» t d | ‚ q» q» Wx* | D]" } | | k rè t d | ‚ qè qè W|  S(   sý   
        Validate that the two properties may be linked.
        @param pA: Endpoint (A) to link.
        @type pA: L{Endpoint}
        @param pB: Endpoint (B) to link.
        @type pB: L{Endpoint}
        @return: self
        @rtype: L{Link}
        s   Already linkeds   Duplicate domain "%s" founds   Duplicate key %s found(   R   t	   Exceptiont   domainst   keys(	   R   R   R   t   dAt   dBt   dt   kAt   kBt   k(    (    sI   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/suds/properties.pyR   >   s(    
c         C   sW   |  j  \ } } | | j k r1 | j j | ƒ n  | | j k rS | j j | ƒ n  |  S(   s‘   
        Teardown the link.
        Removes endpoints from properties I{links} collection.
        @return: self
        @rtype: L{Link}
        (   R   R   t   remove(   R   R   R   (    (    sI   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/suds/properties.pyt   teardown]   s    (   R   R   R	   R   R   R   (    (    (    sI   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/suds/properties.pyR
   *   s   		R   c           B   s;   e  Z d  Z d „  Z d „  Z d „  Z d „  Z d „  Z RS(   s¦   
    Link endpoint (wrapper).
    @ivar link: The associated link.
    @type link: L{Link}
    @ivar target: The properties object.
    @type target: L{Property}
    c         C   s   | |  _  | |  _ d  S(   N(   t   linkt   target(   R   R    R!   (    (    sI   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/suds/properties.pyR   t   s    	c         C   s   |  j  j ƒ  S(   N(   R    R   (   R   (    (    sI   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/suds/properties.pyR   x   s    c         C   s   |  j  | k S(   N(   R!   (   R   t   rhs(    (    sI   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/suds/properties.pyt   __eq__{   s    c         C   s   t  |  j ƒ S(   N(   t   hashR!   (   R   (    (    sI   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/suds/properties.pyt   __hash__~   s    c         C   s   t  |  j | ƒ S(   N(   t   getattrR!   (   R   t   name(    (    sI   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/suds/properties.pyt   __getattr__�   s    (   R   R   R	   R   R   R#   R%   R(   (    (    (    sI   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/suds/properties.pyR   l   s   				t
   Definitionc           B   sD   e  Z d  Z e ƒ  d „ Z d d „ Z d „  Z d „  Z d „  Z	 RS(   sà   
    Property definition.
    @ivar name: The property name.
    @type name: str
    @ivar classes: The (class) list of permitted values
    @type classes: tuple
    @ivar default: The default value.
    @ivar type: any
    c         C   sI   t  | t t f ƒ s! | f } n  | |  _ | |  _ | |  _ | |  _ d S(   sé   
        @param name: The property name.
        @type name: str
        @param classes: The (class) list of permitted values
        @type classes: tuple
        @param default: The default value.
        @type default: any
        N(   t
   isinstancet   listt   tupleR'   t   classest   defaultt   linker(   R   R'   R-   R.   R/   (    (    sI   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/suds/properties.pyR   �   s    				c         C   s   | d k r |  j S| Sd S(   så   
        Convert the I{value} into the default when I{None}.
        @param value: The proposed value.
        @type value: any
        @return: The I{default} when I{value} is I{None}, else I{value}.
        @rtype: any
        N(   t   NoneR.   (   R   t   value(    (    sI   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/suds/properties.pyt   nvlŸ   s    c         C   sX   | d k r d St |  j ƒ rT t | |  j ƒ rT d |  j |  j f } t | ‚ n  d S(   s¿   
        Validate the I{value} is of the correct class.
        @param value: The value to validate.
        @type value: any
        @raise AttributeError: When I{value} is invalid.
        Ns   "%s" must be: %s(   R0   t   lenR-   R*   R'   t   AttributeError(   R   R1   t   msg(    (    sI   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/suds/properties.pyR   ¬   s    c         C   s   d |  j  t |  ƒ f S(   Ns   %s: %s(   R'   t   str(   R   (    (    sI   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/suds/properties.pyt   __repr__»   s    c         C   sf   g  } t  |  j ƒ r2 | j d t |  j ƒ ƒ n | j d ƒ | j d t |  j ƒ ƒ d j | ƒ S(   Ns
   classes=%ss	   classes=*s
   default=%ss   , (   R3   R-   R   R6   R.   t   join(   R   t   s(    (    sI   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/suds/properties.pyt   __str__¾   s    N(
   R   R   R	   R   R   R0   R2   R   R7   R:   (    (    (    sI   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/suds/properties.pyR)   …   s   			t
   Propertiesc           B   sÂ   e  Z d  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z	 d „  Z
 d	 „  Z d d
 „ Z d d „ Z d d „ Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z RS(   sö  
    Represents basic application properties.
    Provides basic type validation, default values and
    link/synchronization behavior.
    @ivar domain: The domain name.
    @type domain: str
    @ivar definitions: A table of property definitions.
    @type definitions: {name: L{Definition}}
    @ivar links: A list of linked property objects used to create
        a network of properties.
    @type links: [L{Property},..]
    @ivar defined: A dict of property values.
    @type defined: dict 
    c         C   sl   i  |  _  x | D] } | |  j  | j <q W| |  _ g  |  _ i  |  _ t ƒ  |  _ |  j ƒ  |  j | ƒ d S(   s  
        @param domain: The property domain name.
        @type domain: str
        @param definitions: A table of property definitions.
        @type definitions: {name: L{Definition}}
        @param kwargs: A list of property name/values to set.
        @type kwargs: dict  
        N(	   t   definitionsR'   t   domainR   t   definedt   sett   modifiedt   primet   update(   R   R=   R<   t   kwargsR   (    (    sI   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/suds/properties.pyR   ×   s    					
c         C   s1   |  j  j | ƒ } | d k r- t | ƒ ‚ n  | S(   s  
        Get the definition for the property I{name}.
        @param name: The property I{name} to find the definition for.
        @type name: str
        @return: The property definition
        @rtype: L{Definition}
        @raise AttributeError: On not found.
        N(   R<   t   getR0   R4   (   R   R'   R   (    (    sI   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/suds/properties.pyt
   definitionê   s    	c         C   sL   t  | t ƒ r | j } n  x* | j ƒ  D] \ } } |  j | | ƒ q( W|  S(   sÙ   
        Update the property values as specified by keyword/value.
        @param other: An object to update from.
        @type other: (dict|L{Properties})
        @return: self
        @rtype: L{Properties}
        (   R*   R;   R>   t   itemsR?   (   R   t   othert   nt   v(    (    sI   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/suds/properties.pyRB   ø   s
    c         C   s   |  j  | ƒ j | ƒ d S(   sÃ   
        Get whether a property has never been set by I{name}.
        @param name: A property name.
        @type name: str
        @return: True if never been set.
        @rtype: bool
        N(   t   providert   _Properties__notset(   R   R'   (    (    sI   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/suds/properties.pyt   notset  s    c         C   s   |  j  | ƒ j | | ƒ |  S(   sc  
        Set the I{value} of a property by I{name}.
        The value is validated against the definition and set
        to the default when I{value} is None.
        @param name: The property name.
        @type name: str
        @param value: The new property value.
        @type value: any
        @return: self
        @rtype: L{Properties}
        (   RJ   t   _Properties__set(   R   R'   R1   (    (    sI   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/suds/properties.pyR?     s    c         C   s   |  j  | ƒ j | d ƒ |  S(   s    
        Unset a property by I{name}.
        @param name: A property name.
        @type name: str
        @return: self
        @rtype: L{Properties}
        N(   RJ   RM   R0   (   R   R'   (    (    sI   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/suds/properties.pyt   unset  s    c         G   s   |  j  | ƒ j | | Œ S(   s:  
        Get the value of a property by I{name}.
        @param name: The property name.
        @type name: str
        @param df: An optional value to be returned when the value
            is not set
        @type df: [1].
        @return: The stored value, or I{df[0]} if not set.
        @rtype: any 
        (   RJ   t   _Properties__get(   R   R'   t   df(    (    sI   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/suds/properties.pyRD   *  s    c         C   s   t  |  | ƒ |  S(   s  
        Link (associate) this object with anI{other} properties object 
        to create a network of properties.  Links are bidirectional.
        @param other: The object to link.
        @type other: L{Properties}
        @return: self
        @rtype: L{Properties}
        (   R
   (   R   RG   (    (    sI   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/suds/properties.pyR    7  s    	c         G   sK   t  | ƒ s |  j } n  x+ |  j D] } | | k r$ | j ƒ  q$ q$ W|  S(   sö   
        Unlink (disassociate) the specified properties object.
        @param others: The list object to unlink.  Unspecified means unlink all.
        @type others: [L{Properties},..]
        @return: self
        @rtype: L{Properties}
        (   R3   R   R   (   R   t   otherst   p(    (    sI   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/suds/properties.pyt   unlinkC  s    c         C   sž   | d k r g  } n  | j |  ƒ | |  j k r5 |  SxE |  j D]: } | | k rW q? n  | j | | ƒ } | d k	 r? | Sq? W| j |  ƒ t | ƒ rš d S|  S(   s•  
        Find the provider of the property by I{name}.
        @param name: The property name.
        @type name: str
        @param history: A history of nodes checked to prevent
            circular hunting.
        @type history: [L{Properties},..]
        @return: The provider when found.  Otherwise, None (when nested)
            and I{self} when not nested.
        @rtype: L{Properties}
        N(   R0   R   R<   R   RJ   R   R3   (   R   R'   t   historyt   xRJ   (    (    sI   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/suds/properties.pyRJ   R  s    	c         C   sŽ   | d k r g  } n  | j |  ƒ t ƒ  } | j |  j j ƒ  ƒ x9 |  j D]. } | | k rc qK n  | j | j | ƒ ƒ qK W| j |  ƒ | S(   sü   
        Get the set of I{all} property names.
        @param history: A history of nodes checked to prevent
            circular hunting.
        @type history: [L{Properties},..]
        @return: A set of property names.
        @rtype: list
        N(   R0   R   R?   RB   R<   R   R   R   (   R   RT   R   RU   (    (    sI   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/suds/properties.pyR   n  s    			c         C   sˆ   | d k r g  } n  | j |  ƒ t ƒ  } | j |  j ƒ x9 |  j D]. } | | k r] qE n  | j | j | ƒ ƒ qE W| j |  ƒ | S(   sø   
        Get the set of I{all} domain names.
        @param history: A history of nodes checked to prevent
            circular hunting.
        @type history: [L{Properties},..]
        @return: A set of domain names.
        @rtype: list
        N(	   R0   R   R?   t   addR=   R   RB   R   R   (   R   RT   R   RU   (    (    sI   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/suds/properties.pyR   ƒ  s    			c         C   s1   x* |  j  j ƒ  D] } | j |  j | j <q W|  S(   sœ   
        Prime the stored values based on default values
        found in property definitions.
        @return: self
        @rtype: L{Properties}
        (   R<   t   valuesR.   R>   R'   (   R   R   (    (    sI   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/suds/properties.pyRA   ˜  s    c         C   s   | |  j  k S(   N(   R@   (   R   R'   (    (    sI   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/suds/properties.pyt   __notset£  s    c         C   so   |  j  | ƒ } | j | ƒ | j | ƒ } |  j | } | |  j | <|  j j | ƒ | j j |  | | ƒ d  S(   N(   RE   R   R2   R>   R@   RV   R/   R   (   R   R'   R1   R   R   (    (    sI   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/suds/properties.pyt   __set¦  s    c         G   sM   |  j  | ƒ } |  j j | ƒ } | | j k rI t | ƒ rI | d } n  | S(   Ni    (   RE   R>   RD   R.   R3   (   R   R'   RP   R   R1   (    (    sI   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/suds/properties.pyt   __get¯  s
    c         C   sï   g  } | j  d ƒ x. |  j j ƒ  D] } | j  d t | ƒ ƒ q# W| j  d ƒ x. |  j j ƒ  D] } | j  d t | ƒ ƒ qa W|  | k râ | j  |  ƒ | j  d ƒ x' |  j D] } | j  | j | ƒ ƒ q² W| j |  ƒ n  d j	 | ƒ S(   Ns   Definitions:s   	%ss   Content:s   Linked:s   
(
   R   R<   RW   t   reprR>   RF   R6   R   R   R8   (   R   RT   R9   R   RU   (    (    sI   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/suds/properties.pyR6   ¶  s    c         C   s
   t  |  ƒ S(   N(   R6   (   R   (    (    sI   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/suds/properties.pyR7   Æ  s    c         C   s   |  j  g  ƒ S(   N(   R6   (   R   (    (    sI   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/suds/properties.pyR:   É  s    N(   R   R   R	   R   RE   RB   RL   R?   RN   RD   R    RS   R0   RJ   R   R   RA   RK   RM   RO   R6   R7   R:   (    (    (    sI   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/suds/properties.pyR;   È   s(   				
												t   Skinc           B   s;   e  Z d  Z d „  Z d „  Z d „  Z d „  Z d „  Z RS(   s�   
    The meta-programming I{skin} around the L{Properties} object.
    @ivar __pts__: The wrapped object.
    @type __pts__: L{Properties}.
    c         C   s   t  | | | ƒ |  _ d  S(   N(   R;   t   __pts__(   R   R=   R<   RC   (    (    sI   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/suds/properties.pyR   Ó  s    c         C   sL   | j  d ƒ o | j d ƒ } | r5 | |  j | <d  S|  j j | | ƒ d  S(   Nt   __(   t
   startswitht   endswitht   __dict__R]   R?   (   R   R'   R1   t   builtin(    (    sI   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/suds/properties.pyt   __setattr__Ö  s
    c         C   s   |  j  j | ƒ S(   N(   R]   RD   (   R   R'   (    (    sI   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/suds/properties.pyR(   Ý  s    c         C   s
   t  |  ƒ S(   N(   R6   (   R   (    (    sI   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/suds/properties.pyR7   à  s    c         C   s   t  |  j ƒ S(   N(   R6   R]   (   R   (    (    sI   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/suds/properties.pyR:   ã  s    (   R   R   R	   R   Rc   R(   R7   R:   (    (    (    sI   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/suds/properties.pyR\   Í  s   				t   Unskinc           B   s   e  Z d  „  Z RS(   c         O   s   | d j  S(   Ni    (   R]   (   R   t   argsRC   (    (    sI   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/suds/properties.pyt   __new__è  s    (   R   R   Rf   (    (    (    sI   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/suds/properties.pyRd   ç  s   t	   Inspectorc           B   s;   e  Z d  Z d „  Z d „  Z d „  Z d „  Z d „  Z RS(   s   
    Wrapper inspector.
    c         C   s   | j  |  _ d  S(   N(   R]   R   (   R   t   options(    (    sI   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/suds/properties.pyR   ð  s    c         G   s   |  j  j | | Œ S(   s:  
        Get the value of a property by I{name}.
        @param name: The property name.
        @type name: str
        @param df: An optional value to be returned when the value
            is not set
        @type df: [1].
        @return: The stored value, or I{df[0]} if not set.
        @rtype: any 
        (   R   RD   (   R   R'   RP   (    (    sI   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/suds/properties.pyRD   ó  s    c         K   s   |  j  j | �  S(   sØ   
        Update the property values as specified by keyword/value.
        @param kwargs: A list of property name/values to set.
        @type kwargs: dict
        @return: self
        @rtype: L{Properties}
        (   R   RB   (   R   RC   (    (    sI   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/suds/properties.pyRB      s    c         C   s   | j  } |  j j | ƒ S(   s  
        Link (associate) this object with anI{other} properties object 
        to create a network of properties.  Links are bidirectional.
        @param other: The object to link.
        @type other: L{Properties}
        @return: self
        @rtype: L{Properties}
        (   R]   R   R    (   R   RG   RR   (    (    sI   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/suds/properties.pyR    
  s    		c         C   s   | j  } |  j j | ƒ S(   sË   
        Unlink (disassociate) the specified properties object.
        @param other: The object to unlink.
        @type other: L{Properties}
        @return: self
        @rtype: L{Properties}
        (   R]   R   RS   (   R   RG   RR   (    (    sI   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/suds/properties.pyRS     s    	(   R   R   R	   R   RD   RB   R    RS   (    (    (    sI   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/suds/properties.pyRg   ì  s   			
	N(   R	   t   loggingR    R   t   logt   objectR   R
   R   R)   R;   R\   Rd   Rg   (    (    (    sI   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/suds/properties.pyt   <module>   s   BCÿ 