ó
è™xTc           @   s^   d  d l  m Z d „  Z d „  Z d „  Z e d k rZ d  d l Z e d e j d ƒ n  d S(	   iÿÿÿÿ(   t   divisionc    (         sð
  d d l  m }  m } d d  l } d d l m } | d d ƒ g  k sM t ‚ | d d ƒ d g k sk t ‚ | d d ƒ d g k s‰ t ‚ | d d ƒ d g k s§ t ‚ | d d	 ƒ d d g k sÈ t ‚ | d d
 ƒ d d g k sé t ‚ | d d ƒ d d g k s
t ‚ | d d ƒ d d d g k s.t ‚ | d d ƒ d d d g k sRt ‚ | d d ƒ d d g k sst ‚ | d d ƒ d d g k s”t ‚ | d d ƒ d d g k sµt ‚ | d d ƒ d d d g k sÙt ‚ | d d ƒ d d d g k sýt ‚ | d d ƒ d d d d d d d d d g	 k s3t ‚ d d l m } | d ƒ d k s[t ‚ | d ƒ d k sst ‚ | d ƒ d k s‹t ‚ | d ƒ d  k s£t ‚ | d! ƒ d" k s»t ‚ | d# ƒ d$ k sÓt ‚ | d% ƒ d& k sët ‚ | d' ƒ d( k st ‚ | d) ƒ d* k st ‚ d d+ l m } | d ƒ d, k sCt ‚ | d- ƒ d. k s[t ‚ | d/ ƒ d0 k sst ‚ | d1 ƒ d2 k s‹t ‚ d d3 l m	 } | d4 d5 d6 d7 ƒ d8 k s¼t ‚ d d9 l m
 } | d4 d5 d6 d7 d: d ƒ d8 k sót ‚ | d4 d5 d6 d7 d: d d; t ƒ dŸ k s t ‚ d d= l m } d d  l }	 |	 j ƒ  }
 | d> d  d¡ d¢ g dA |
 d4 dB ƒ srt ‚ |  |
 j ƒ  dC ƒ sŽt ‚ |	 j ƒ  }
 | d> d£ d¤ d¥ g dF t dA |
 d4 dB dG d  d dH g ƒ sÙt ‚ |  |
 j ƒ  dI ƒ sõt ‚ d dJ l m } x« d d g f dK dK g f dL dK d g f dM dK d dN g f dO dK d dP dN g f dQ dK dR dS dN dT g f g D]= \ } } g  | | dU dV ƒD] } | ^ q‘| k srt ‚ qrWd dW l m } |	 j ƒ  } | ƒ  } | dX ƒ } | dY IJ| dY IJy | dY IJWn t k
 rn X| ‚ | j | j | ƒ ƒ } | j | j | ƒ ƒ } | j ƒ  | j ƒ  k oŠ| j ƒ  k oŠ| j ƒ  k n s•t ‚ d dZ l m } d[ } | | ƒ d\ k sÃt ‚ d] } d d^ l m } m } d_ d` da g } | | ƒ db k st ‚ | | ƒ dc k st ‚ d dd l m ‰  ‡  f de †  } | d ƒ | df ƒ | dg ƒ | dh ƒ | di ƒ | dj ƒ | dk ƒ | dl ƒ | dm ƒ d dn l m } | do dp ƒ dq k sÂt ‚ | do d  ƒ dr k sÝt ‚ | do d  ds dt ƒdu k sþt ‚ d dv l m } | ƒ  }
 | dw dA |
 ƒ|
 j ƒ  dx k s?t ‚ | ƒ  }
 | dy dA |
 ƒ|
 j ƒ  dz k spt ‚ d d{ l m } t d| ƒ t d} d~ ƒ } xh | D]` }  t |  ƒ }! xK | D]C }" |! t |" ƒ }# | d |# d€ d� d‚ dƒ ƒ t |# ƒ k s¹t ‚ q¹Wq Wd d„ l m }$ | ƒ  }
 |$ |
 d… d† ƒ}% |% d‡ IJ|% j  ƒ  |
 j ƒ  dˆ k s[	t ‚ | ƒ  }
 |$ |
 d… d‰ dU dŠ d‹ t! dŒ d� ƒ}% |% j" dŽ ƒ |% j" d ƒ |% j" d� ƒ |% j  ƒ  |
 j ƒ  d� k sÑ	t ‚ | ƒ  }
 |$ |
 d… d‰ dU d‘ d4 d’ dŒ d“ ƒ}% |% d” IJ|% j# ƒ  |% d• IJ|
 j ƒ  d k s4
t ‚ ~% |
 j ƒ  d– k sO
t ‚ d d— l m$ }& | ƒ  }
 |& d˜ d\ dA |
 dU d™ d‹ t! d4 d d… dš ƒ |
 j ƒ  d› k s«
t ‚ d dœ l m% }' | ƒ  }
 |' d� dA |
 ƒ|
 j ƒ  dž k sì
t ‚ d  S(¦   Niÿÿÿÿ(   t	   show_difft   Exception_expected(   t   split_keeping_spacest   st    t    t   at   abcs    as     as     s     abcs     abc s     abc  s   a s   a  s   abc  s   a bt   bs   a  bs     a  b c   d t   cs      t   d(   t   size_as_string_with_commasi    t   0i   t   1s   -1i
   t   10id   t   100iè  s   1,000i90  s   12,345iNa¼ s
   12,345,678i²žCÿs   -12,345,678(   t   show_strings   "abc"s   a'cs   "a'c"s   a"cs   'a"c's   '"cs   "'\"c"(   t   prefix_each_linet   prefixt   ^t   lines_as_one_strings   hello
worlds   ^hello
^world(   t   prefix_each_line_suffixt   suffixt   rstrips   ^hello%s
^world (   t   show_sorted_by_countst   label_count_pairsi   iþÿÿÿt   outt   %s   %"a"  3
%"b"  3
%"c" -2
iýÿÿÿi   t   reverset   annotationst   xs   %"c"  2 x
%"a" -3
%"b" -3
(   t   line_breakers   this iss	   this is as   this is a sentencet   sentences   this is a longer sentencet   longers#   this is a very long sentence indeeds   a veryt   longt   indeedt   widthi   (   t   StringIOs   Hello world!
s   Hello world!(   t   reformat_terminal_texts?   
This is some
terminal-formatted
text which needs
to be reset.
s=   This is some terminal-formatted text which needs to be reset.sG   
  This is more
  terminal-formatted
  text which needs
  to be reset.
(   t   strip_linest   rstrip_liness     This is more s     terminal-formatted s     text s>   
This is more
terminal-formatted
text which needs
to be reset.sF   
  This is more
  terminal-formatted
  text which needs
  to be reset.(   t   expandtabs_track_columnsc            s“   ˆ  d |  ƒ \ } } t  | ƒ t  |  ƒ k s3 t ‚ | |  j ƒ  k sK t ‚ d j g  | D] } | | ^ qX ƒ } | |  j d d ƒ k s� t ‚ d  S(   NR   R   s   	R   (   t   lent   AssertionErrort
   expandtabst   joint   replace(   R   t   est   jst   jt   sr(   R*   (    sB   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/libtbx/tst_str_utils.pyt   check…   s
    &s   	s   		s   	ys   x	ys   x	y	zs   	xy		zs   abcdefg	xy		zs   ab defgh	xyz		u(   t   format_values   %.4fg][*ÊÀó?s   1.2346s     Nonet   replace_none_withs   ---s      ---(   t   make_headers   Header 1sR   
=================================== Header 1 ==================================

s   Header 2sR   
=================================== Header 2 ==================================

(   t   string_representationi‚   iú   i   t   stringt   preferred_quotet   't   alternative_quotet   "(   t   framed_outputt   framet   #s   Hello, world!s7   
#################
# Hello, world! #
#################
t   -iP   t   centert   titles   Refinement statss   r_free = 0.1234s   r_work = 0.1567sô   
|--------------------------------Refinement stats------------------------------|
|                       r_free = 0.1234  r_work = 0.1567                       |
|------------------------------------------------------------------------------|
iH   s       s   Validation summarys   Overall MolProbity score: 2.56su   Ramachandran favored:  97.5 %
             outliers:  2.5 %
Rotamer outliers:       5.9 %
Clashscore:            10.9si  
    |-Validation summary---------------------------------------------------|
    | Overall MolProbity score: 2.56                                       |
    |----------------------------------------------------------------------|
    | Ramachandran favored:  97.5 %                                        |
    |              outliers:  2.5 %                                        |
    | Rotamer outliers:       5.9 %                                        |
    | Clashscore:            10.9                                          |
    |----------------------------------------------------------------------|
(   t   print_message_in_boxt   messagei    t   *s°   
  ********************************
  *         This is some         *
  *   terminal-formatted text    *
  *   which needs to be reset.   *
  ********************************
(   t   make_big_headers   Section titlesô   
################################################################################
#                                Section title                                 #
################################################################################
s   ^hello 
^world (   R	   i   (   R   i   (   R
   iþÿÿÿ(   R	   iýÿÿÿ(   R   iýÿÿÿ(   R
   i   (&   t   libtbx.test_utilsR   R   t   cPicklet   libtbx.str_utilsR   R,   R   R   R   R   t   FalseR   t	   cStringIOR&   t   getvaluet   NoneR    t   AttributeErrort   loadst   dumpsR'   R(   R)   R*   R5   R7   R8   t   ranget   chrt   reprR>   t   closet   Truet   writet   add_separatorRD   RG   ((   R   R   RI   R   R   R   R   R   R   RL   R   R    R9   t   expected_resultt   blockR&   t   out1t   out2t   out3t   out4t   out5R'   t   txt1t   txt2R(   R)   t   linesR4   R5   R7   R8   t   isett   iR   R2   t   ssR>   t   boxRD   RG   (    (   R*   sB   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/libtbx/tst_str_utils.pyt   exercise   sR   !!!$$!!!$$*$%5	

E			








!				/	

			
			

						c          C   sÀ   d d l  m }  |  d d ƒ } d } | j d ƒ } | | | ƒ } | d k sU t ‚ | j d | d ƒ } | | | ƒ } | | j d ƒ k s• t ‚ d } | | d ƒ } | d k s¼ t ‚ d  S(	   Niÿÿÿÿ(   t   find_matching_closing_symbolt   (t   )s   ... ( ... ( ... ) ...i   s    ( ( ) ( ( ( ) ) ) ) ) i   (   RJ   Rh   t   findR,   t   rfind(   Rh   t   fR   t   pt   qt   p1t   q1(    (    sB   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/libtbx/tst_str_utils.pyt   exercise_matching_nested_pairsõ   s    c         C   s/   t  |  ƒ d k s t ‚ t ƒ  t ƒ  d GHd  S(   Ni    t   OK(   R+   R,   Rg   Rr   (   t   args(    (    sB   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/libtbx/tst_str_utils.pyt   run  s    t   __main__NRt   i   (   t
   __future__R    Rg   Rr   Ru   t   __name__t   syst   argv(    (    (    sB   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/libtbx/tst_str_utils.pyt   <module>   s   	ó		