ó
}Ť¸Vc           @   s   d  Z  d d l Z d d l Z d d l Z d d l m Z d d l m Z e j r} e j Z e j	 e j
  d d   Z
 n d d  Z
 d d  Z d S(   s¤   Wrapper around linecache which decodes files to unicode according to PEP 263.

This is only needed for Python 2 - linecache in Python 3 does the same thing
itself.
i˙˙˙˙N(   t	   py3compat(   t   openpyc         C   s   t  j |  d | S(   Nt   module_globals(   t	   linecachet   getlines(   t   filenameR   (    (    sP   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/utils/ulinecache.pyR      s    c         C   sł   t  j |  t j    }  t j |  d | } | sJ t | d t  j  rN | St j	 |  } y t j
 |  \ } } Wn t k
 r d } n Xg  | D] } | j | d  ^ q S(   s   Get the lines (as unicode) for a file from the cache.
        Update the cache if it doesn't contain an entry for this file already.R   i    t   asciit   replace(   R    t
   cast_bytest   syst   getfilesystemencodingR   R   t
   isinstancet   unicode_typeR   t   _list_readlinet   detect_encodingt   SyntaxErrort   decode(   R   R   t   linest   readlinet   encodingt   _t   l(    (    sP   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/utils/ulinecache.pyR      s    
c         C   sE   t  |  |  } d | k o, t |  k n r= | | d Sd Sd  S(   Ni   t    (   R   t   len(   R   t   linenoR   R   (    (    sP   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/utils/ulinecache.pyt   getline(   s    "(   t   __doc__t	   functoolsR   R	   t   IPython.utilsR    R   t   PY3R   t   wrapsR   t   None(    (    (    sP   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/utils/ulinecache.pyt   <module>   s   		