ó
æNXc           @   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   		