ó
„™xTc           @   sr   d  d l  m Z d  d l m Z d  d l m Z d  d l Z d „  Z d „  Z e	 d k rn e e j
 d ƒ n  d S(	   iÿÿÿÿ(   t   division(   t   shelx(   t   sgtbxNc   	      C   sN  d
 } xAt j d |  ƒ D]-\ } } | d | d } } | d k rÑ | d
 k sX t ‚ t | ƒ d k sp t ‚ t j ƒ  } t | d ƒ } | d k r± | j t j	 d ƒ ƒ n  d t
 | ƒ } | j | ƒ q | d k r*| d
 k	 sï t ‚ t | ƒ d k st ‚ t j | d ƒ } | j | ƒ q | d k r t j d	 | ƒ Sq Wd
 S(   s+   Examplify the direct use of the tool from shelx.lexer

  In practice, one is strongly encouraged to make use of the tools
  from shelx.parsers: that is to say, for the task handled here,
  crystal_symmetry_parser (the code to follow just parrots
  the implementation of crystal_symmetry_parser).
  t   filei    iÿÿÿÿt   LATTi   s   *PIRFABCt   SYMMt   SFACt   groupN(   i    i    i    (   t   NoneR   t   command_streamt   AssertionErrort   lenR   t   space_groupt   intt
   expand_invt   tr_vect   abst!   expand_conventional_centring_typet   rt_mxt
   expand_smxt   space_group_info(	   t   file_objectR   t   commandt   linet   cmdt   argst   nt   zt   s(    (    sa   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/iotbx/examples/shelx_latt_sym_to_space_group_symbol.pyt   convert   s&    c         C   ss   t  |  ƒ d k r8 t d t j ƒ } | j ƒ  j ƒ  GHn7 x4 |  D], } t d t | ƒ ƒ } | j ƒ  j ƒ  GHq? Wd  S(   Ni    R   (   R   R   t   syst   stdint   typet   lookup_symbolt   open(   R   R   t	   file_name(    (    sa   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/iotbx/examples/shelx_latt_sym_to_space_group_symbol.pyt   run"   s    t   __main__i   (   t
   __future__R    t   iotbxR   t   cctbxR   R   R   R$   t   __name__t   argv(    (    (    sa   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/iotbx/examples/shelx_latt_sym_to_space_group_symbol.pyt   <module>   s   			