ó
ù™xTc           @   s<   d  d l  m Z d  d l m Z e d „  ƒ Z d „  Z d S(   iÿÿÿÿ(   t   division(   t   contextmanagerc         c   sD   d d l  m } m } | ƒ  } z | |  ƒ d VWd | | ƒ Xd S(   s‰    A context manager to temporarily change the current directory, perform a
  task and then change back to the previous working directory. iÿÿÿÿ(   t   getcwdt   chdirN(   t   osR   R   (   t   pathR   R   t   cwd(    (    sF   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/dxtbx/serialize/filename.pyt
   temp_chdir   s    	
	c         C   s2   d d l  m } m } m } | | | |  ƒ ƒ ƒ S(   sø    Load a filename from a JSON file.

  First expand any environment and user variables. Then create the absolute path
  from the current directory (i.e. the directory in which the JSON file is
  located.

  Params:
    path The path to the file.

  iÿÿÿÿ(   t   abspatht
   expandusert
   expandvars(   t   os.pathR   R	   R
   (   R   R   R	   R
   (    (    sF   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/dxtbx/serialize/filename.pyt	   load_path   s    N(   t
   __future__R    t
   contextlibR   R   R   (    (    (    sF   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/dxtbx/serialize/filename.pyt   <module>   s   