³ò
~×YKc        
   @   sá   d  d k  Z  d  d k Z d  d k Z d  d k l Z d  d k l Z d  d k Z d  d k Z g  a	 d a d „  Z d „  Z d „  Z d e f d „  ƒ  YZ d	 „  Z d
 „  Z d „  Z d e f d „  ƒ  YZ e i i e ƒ  ƒ d S(   iÿÿÿÿN(   t   loads(   t   StringIOc          C   s¤  t  t i i j o d Sn t i i a  g  a xot i i D]a}  t |  d ƒ } y-t |  d ƒ } t | d ƒ } | i ƒ  } | i d ƒ o.t | d d !d ƒ } t | d d	 !d ƒ } | i	 | ƒ t
 | i ƒ  i d
 ƒ ƒ } x³ | i ƒ  D]¥ } t | | d ƒ d j oA g  } | | D]! \ } }	 | | | A|	 | Af q ~ | | <qð g  }
 | | D]' \ } }	 } |
 | | A|	 | A| f qa~
 | | <qð Wt i |  | f ƒ | i ƒ  w; n | i d ƒ o_ t | d d ƒ } | i	 | ƒ t
 | i ƒ  i d
 ƒ ƒ } t i |  | f ƒ | i ƒ  w; n | i ƒ  t |  d ƒ } t
 t | d ƒ i ƒ  i d
 ƒ ƒ } t i |  | f ƒ Wq; t i i o ‚  qœq; Xq; Wd S(   s5   
    Loads in the indexes for the archive files.
    Ns   .rpat   rbs   RPA-3.0 i   i   i   i   i!   t   zlibi    i   s   RPA-2.0 s   .rpi(   t   old_config_archivest   renpyt   configt   archivest   transfnt   filet   readlinet
   startswitht   intt   seekR    t   readt   decodet   keyst   lent   appendt   closet   debug(   t   prefixt   fnt   ft   lt   offsett   keyt   indext   kt   _[1]t   dlent   _[2]t   start(    (    s4   D:\Version 1-0-7\Games\Katawa Shoujo\renpy\loader.pyt   index_archives&   sL      AG


$c         C   sœ   g  } x t  i |  ƒ D]~ } | d d j o q n t  i i |  d | ƒ o8 xB t |  d | ƒ D] } | i | d | ƒ qd Wq | i | ƒ q W| S(   Ni    t   .t   /(   t   ost   listdirt   patht   isdirt   walkdirR   (   t   dirt   rvt   iR   (    (    s4   D:\Version 1-0-7\Games\Katawa Shoujo\renpy\loader.pyR(   g   s      c          C   s§   g  }  xY t  i i D]K } t i i t  i i | ƒ } x' t | ƒ D] } |  i | | f ƒ qA Wq Wx> t	 D]6 \ } } x' | i
 ƒ  D] } |  i d | f ƒ q‚ Wqi W|  S(   s€   
    Returns a list of directory, file tuples known to the system. If
    the file is in an archive, the directory is None.
    N(   R   R   t
   searchpathR$   R&   t   joint   basedirR(   R   R   t   iterkeyst   None(   R*   R+   t   jR   R   (    (    s4   D:\Version 1-0-7\Games\Katawa Shoujo\renpy\loader.pyt   listdirfilesw   s        t   SubFilec           B   s€   e  Z d  „  Z d d „ Z d d „ Z d d „ Z d „  Z d „  Z d „  Z	 d „  Z
 d d	 „ Z d
 „  Z d „  Z d „  Z RS(   c         C   sD   | |  _  | |  _ d |  _ | |  _ | |  _ |  i  i |  i ƒ d  S(   Ni    (   R   t   baseR   t   lengthR    R   (   t   selfR   R4   R5   R    (    (    s4   D:\Version 1-0-7\Games\Katawa Shoujo\renpy\loader.pyt   __init__   s    					c         C   sµ   |  i  |  i } | d  j	 o t | | ƒ } n | } |  i |  i |  i | !} | t | ƒ 8} |  i t | ƒ 7_ | o+ |  i i | ƒ } |  i t | ƒ 7_ n d } | | S(   Nt    (   R5   R   R0   t   minR    R   R   R   (   R6   R5   t	   maxlengtht   rv1t   rv2(    (    s4   D:\Version 1-0-7\Games\Katawa Shoujo\renpy\loader.pyR   –   s    c         C   sÌ   |  i  |  i } | d  j	 o t | | ƒ } n | } |  i t |  i ƒ j  oR d } xA | o9 |  i d ƒ } | | 7} | d j o Pn | d 8} qX W| Sn |  i i | ƒ } |  i t | ƒ 7_ | S(   NR8   i   s   
(	   R5   R   R0   R9   R   R    R   R   R
   (   R6   R5   R:   R*   t   c(    (    s4   D:\Version 1-0-7\Games\Katawa Shoujo\renpy\loader.pyR
   «   s     

c         C   st   g  } xg t  o_ |  i | ƒ } | p Pn | d  j	 o& | t | ƒ 8} | d j  o Pq^ n | i | ƒ q	 W| S(   Ni    (   t   TrueR
   R0   R   R   (   R6   R5   R*   R   (    (    s4   D:\Version 1-0-7\Games\Katawa Shoujo\renpy\loader.pyt	   readlinesÇ   s    
	c         C   s   |  S(   N(    (   R6   (    (    s4   D:\Version 1-0-7\Games\Katawa Shoujo\renpy\loader.pyt
   xreadlinesÙ   s    c         C   s   |  S(   N(    (   R6   (    (    s4   D:\Version 1-0-7\Games\Katawa Shoujo\renpy\loader.pyt   __iter__Ü   s    c         C   s$   |  i  ƒ  } | p t ƒ  ‚ n | S(   N(   R
   t   StopIteration(   R6   R*   (    (    s4   D:\Version 1-0-7\Games\Katawa Shoujo\renpy\loader.pyt   nextß   s    c         C   s   d  S(   N(    (   R6   (    (    s4   D:\Version 1-0-7\Games\Katawa Shoujo\renpy\loader.pyt   flushç   s    i    c         C   s¾   | d j o
 | } n= | d j o |  i  | } n | d j o |  i | } n | |  i j o |  i } n | |  _  | t |  i ƒ } | d j  o
 d } n |  i i | |  i ƒ d  S(   Ni    i   i   (   R   R5   R   R    R   R   R4   (   R6   R   t   whence(    (    s4   D:\Version 1-0-7\Games\Katawa Shoujo\renpy\loader.pyR   ë   s    
	
c         C   s   |  i  S(   N(   R   (   R6   (    (    s4   D:\Version 1-0-7\Games\Katawa Shoujo\renpy\loader.pyt   tellÿ   s    c         C   s   |  i  i ƒ  d  S(   N(   R   R   (   R6   (    (    s4   D:\Version 1-0-7\Games\Katawa Shoujo\renpy\loader.pyR     s    c         C   s   t  d ƒ ‚ d  S(   Ns   Write not supported by SubFile(   t	   Exception(   R6   t   s(    (    s4   D:\Version 1-0-7\Games\Katawa Shoujo\renpy\loader.pyt   write  s    N(   t   __name__t
   __module__R7   R0   R   R
   R?   R@   RA   RC   RD   R   RF   R   RI   (    (    (    s4   D:\Version 1-0-7\Games\Katawa Shoujo\renpy\loader.pyR3   ‹   s   								c      	   C   sÓ  t  i i o! d |  j o t d |  ƒ ‚ n t  i i o+ t  i i |  ƒ } | d
 j	 o | Sqf n t  i i p+ y t |  ƒ } t | d ƒ SWqž qž Xn xt	 D]\ } } |  | j o q¥ n t t | d ƒ d ƒ } g  } t
 | |  ƒ d j o_ | |  d } t
 | ƒ d j o | \ } }	 d }
 n | \ } }	 }
 t | | |	 |
 ƒ } n^ x; | |  D]/ \ } }	 | i | ƒ | i | i |	 ƒ ƒ qeWt d i | ƒ ƒ } | i ƒ  | Sq¥ Wt d	 |  ƒ ‚ d
 S(   s?   
    Returns an open python file object of the given type.
    s   \s*   Backslash in filename, use '/' instead: %rR   s   .rpai   i    i   R8   s   Couldn't find file '%s'.N(   R   R   t   reject_backslashRG   t   file_open_callbackR0   t   force_archivesR   R	   R   R   R3   R   R   R   R   R-   R   t   IOError(   t   nameR*   R   R   R   R   t   datat   tR   R   R    (    (    s4   D:\Version 1-0-7\Games\Katawa Shoujo\renpy\loader.pyt   load	  sB     
 
c         C   sL   y t  |  ƒ t SWn n Xx) t D]! \ } } |  | j o t Sq# q# Wt S(   sM   
    Returns True if the name is loadable with load, False if it is not.
    (   R   R>   R   t   False(   RP   R   R   (    (    s4   D:\Version 1-0-7\Games\Katawa Shoujo\renpy\loader.pyt   loadableA  s    
 c         C   sµ   t  i i o! d |  j o t d |  ƒ ‚ n t |  t ƒ o |  i d ƒ }  n xM t  i i D]? } t i	 i
 t  i i | |  ƒ } t i	 i | ƒ o | Sq^ q^ Wt d |  ƒ ‚ d S(   sc   
    Tries to translate the name to a file that exists in one of the
    searched directories.
    s   \s*   Backslash in filename, use '/' instead: %rs   utf-8s   Couldn't find file '%s'.N(   R   R   RL   RG   t
   isinstancet   unicodet   encodeR,   R$   R&   R-   R.   t   exists(   RP   t   dR   (    (    s4   D:\Version 1-0-7\Games\Katawa Shoujo\renpy\loader.pyR   S  s     t   RenpyImporterc           B   s5   e  Z d  Z d „  Z d d „ Z d „  Z d „  Z RS(   sk   
    An importer, that tries to load modules from the places where Ren'Py
    searches for data files.
    c         C   sZ   | i  d d ƒ d } t | ƒ o | Sn | i  d d ƒ d } t | ƒ o | Sn d  S(   NR"   R#   s   .pys   /__init__.py(   t   replaceRU   R0   (   R6   t   fullnameR   (    (    s4   D:\Version 1-0-7\Games\Katawa Shoujo\renpy\loader.pyt	   translateo  s    c         C   s   |  i  | ƒ o |  Sn d  S(   N(   R^   (   R6   R]   R&   (    (    s4   D:\Version 1-0-7\Games\Katawa Shoujo\renpy\loader.pyt   find_module|  s    c         B   sÄ   |  i  | ƒ } e i i | e i | ƒ ƒ } | | _ |  | _ g  | _ e	 | ƒ i
 ƒ  i d ƒ } | d d j o | d } n | i d ƒ } | i d d ƒ } e | | d ƒ } | | i U| S(	   Nt   utf8i    u   ï»¿i   t   raw_unicode_escapes   R8   t   exec(   R^   t   syst   modulest
   setdefaultt   typest
   ModuleTypet   __file__t
   __loader__t   __path__RS   R   R   RX   R\   t   compilet   __dict__(   R6   R]   t   filenamet   modt   sourcet   code(    (    s4   D:\Version 1-0-7\Games\Katawa Shoujo\renpy\loader.pyt   load_module€  s    			c         C   s   t  | ƒ i ƒ  S(   N(   RS   R   (   R6   Rm   (    (    s4   D:\Version 1-0-7\Games\Katawa Shoujo\renpy\loader.pyt   get_data“  s    N(   RJ   RK   t   __doc__R^   R0   R_   Rq   Rr   (    (    (    s4   D:\Version 1-0-7\Games\Katawa Shoujo\renpy\loader.pyR[   i  s
   		(   R   R$   t   os.patht   pickleR    t	   cStringIOR   Rc   Rf   R   R0   R   R!   R(   R2   t   objectR3   RS   RU   R   R[   t	   meta_pathR   (    (    (    s4   D:\Version 1-0-7\Games\Katawa Shoujo\renpy\loader.pys   <module>   s"   	A		~	8		-