ó
 šxTc           @   s{   d  d l  m Z d  d l m Z d e f d „  ƒ  YZ e d k rw d  d l Z x& e j d D] Z e j	 e ƒ GHq\ Wn  d S(   iÿÿÿÿ(   t   division(   t   Formatt   FormatPYc           B   s&   e  Z d  Z e d „  ƒ Z d „  Z RS(   sM  Let's take an educated guess as to how to recognize a Python
  pickle file containing a dictionary.  Not easy because there are
  three pickle protocols in Python 2.7.  Dangerous because the lowest
  pickle format only gives us two unique bytes by which to recognize
  a dictionary.  Could possibly conflict with other image formats.c         C   s�   y t  j |  d ƒ j d ƒ } Wn t k
 r5 } t SX| d d !d k p€ | d d !d k p€ | d d !t d ƒ t d ƒ d k S(   Nt   rbi   i    i   s   (ds   }qi€   (   R   t	   open_filet   readt   IOErrort   Falset   chr(   t
   image_filet   tagt   e(    (    sC   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/dxtbx/format/FormatPY.pyt
   understand   s    &c         C   s)   |  j  | ƒ s t ‚ t j |  | ƒ d S(   s3   Initialise the image structure from the given file.N(   R   t   AssertionErrorR   t   __init__(   t   selfR	   (    (    sC   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/dxtbx/format/FormatPY.pyR      s    (   t   __name__t
   __module__t   __doc__t   staticmethodR   R   (    (    (    sC   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/dxtbx/format/FormatPY.pyR      s   
t   __main__Ni   (
   t
   __future__R    t   dxtbx.format.FormatR   R   R   t   syst   argvt   argR   (    (    (    sC   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/dxtbx/format/FormatPY.pyt   <module>   s   