ó
é™xTc           @   s6   d  d l  m Z d  d l m Z d „  Z d „  Z d S(   iÿÿÿÿ(   t   division(   t   philc         C   s+   x$ |  D] } t  | | | ƒ r t Sq Wt S(   s£   The _merge_param_into_list() helper function returns @c True if
  the phil extract @p src was merged into the extract list @p dst_list
  and @c False otherwise.
  (   t   merge_params_by_keyt   Truet   False(   t   dst_listt   srct   keyt   dst(    (    sF   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/libtbx/phil/experimental.pyt   _merge_param_into_list   s    c         C   s³  t  |  | ƒ r@ t  | | ƒ r@ t |  | ƒ t | | ƒ k r@ t Sxlt | ƒ D]^} t | ƒ d k sM | d d k r{ qM n  t | | ƒ } | d k rœ qM qM t | t j ƒ r
t  |  | ƒ r÷ t |  | ƒ } t | t j ƒ sä t	 ‚ t
 | | | ƒ q«t |  | | ƒ qM t | t j ƒ r›t  |  | ƒ rˆt |  | ƒ } t | t j ƒ sRt	 ‚ xC | D]( } t | | | ƒ sY| j | ƒ qYqYWq«t |  | | ƒ qM t |  | | ƒ qM Wt S(   s  The merge_params_by_key() function recursively merges the phil
  extract @p src into @p dst.  Two scopes with attributes named @p key
  are merged only if the values of @p key are equal.  The function
  returns @c True if @p src was merged into @p dst, and @c False
  otherwise.
  i    t   _N(   t   hasattrt   getattrR   t   dirt   lent   Nonet
   isinstanceR   t   scope_extractt   AssertionErrorR   t   setattrt   scope_extract_listR	   t   appendR   (   R   R   R   t   attrt   src_valt   dst_valR   t   src_item(    (    sF   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/libtbx/phil/experimental.pyR      s4    	"N(   t
   __future__R    t   libtbxR   R	   R   (    (    (    sF   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/libtbx/phil/experimental.pyt   <module>   s   	