³ò
Ñ‘RMc           @   s¬   d  d k  l Z d  d k l Z l Z d  d k l Z d  d k l Z d  d k	 l
 Z
 d  d k Z d  d k Z d  d k Z d e f d „  ƒ  YZ d	 „  Z h  Z d
 „  Z d S(   iÿÿÿÿ(   t   Module(   t   Functiont   BuiltinFunction(   t   gateway(   t   OperationError(   t   W_RootNt   MixedModulec           B   sÈ   e  Z d  g Z d Z e Z d Z d „  Z d „  Z	 d „  Z
 e e
 ƒ Z
 d „  Z d „  Z d „  Z d „  Z d „  Z d	 „  Z d
 „  Z e e ƒ Z d „  Z d „  Z e e ƒ Z d „  Z e e ƒ Z RS(   t   loadersc         C   s?   t  i |  | | ƒ t |  _ |  i i ƒ  |  i i ƒ  |  _ d S(   s    NOT_RPYTHON N(   R    t   __init__t   Truet   lazyt	   __class__t   buildloadersR   t   copy(   t   selft   spacet   w_name(    (    s0   /64/home/arigo/u/pypy/interpreter/mixedmodule.pyR      s    	c         C   sx   |  i  d j	 o | i |  i d |  i  ƒ nH t i |  | ƒ |  i o, |  i  d j o | i |  i d ƒ |  _  n d S(   sD   This is called each time the module is imported or reloaded
        t   updatet   itemsN(   t   w_initialdictt   Nonet   call_methodt   w_dictR    t   initR
   (   R   R   (    (    s0   /64/home/arigo/u/pypy/interpreter/mixedmodule.pyR      s
    c         C   s9   |  i  d j	 o |  i  Sn |  i } | i d ƒ d Sd S(   s    NOT_RPYTHON t   .iÿÿÿÿN(   t   applevel_nameR   t
   __module__t   split(   t   clst   pkgroot(    (    s0   /64/home/arigo/u/pypy/interpreter/mixedmodule.pyt   get_applevel_name*   s    	c         C   sK   |  i  } |  i | | ƒ } | d  j o t | i | i | ƒ ƒ ‚ n | S(   N(   R   t   getdictvalueR   R   t   w_AttributeErrort   wrap(   R   t   nameR   t   w_value(    (    s0   /64/home/arigo/u/pypy/interpreter/mixedmodule.pyt   get3   s
    	c         G   s"   |  i  | ƒ } |  i i | | Œ S(   N(   R$   R   t   call_function(   R   R"   t   args_wt	   w_builtin(    (    s0   /64/home/arigo/u/pypy/interpreter/mixedmodule.pyt   call:   s    c         C   sD   | i  |  i | ƒ } |  i o! | d  j o |  i | | ƒ Sn | S(   N(   t   finditem_strR   R
   R   t   _load_lazily(   R   R   R"   R#   (    (    s0   /64/home/arigo/u/pypy/interpreter/mixedmodule.pyR   >   s    c      
   C   sö   | i  | ƒ } y |  i | } Wn t j
 o d  Snº X| | ƒ } | i | ƒ } t | t ƒ os t | ƒ t j	 o` y | i	 } Wn= t
 j
 o1 t | ƒ } |  i | _ | | _	 | | _ n X| i | ƒ } n | i |  i | | ƒ | Sd  S(   N(   t   new_interned_strR   t   KeyErrorR   t   interpclass_wt
   isinstanceR   t   typeR   t   _builtinversion_t   AttributeErrorR   t   w_moduleR"   R!   t   setitemR   (   R   R   R"   R   t   loaderR#   t   funct   bltin(    (    s0   /64/home/arigo/u/pypy/interpreter/mixedmodule.pyR*   D   s&    		c         C   s   |  i  op |  i } x? |  i D]4 } |  i | ƒ } | i |  i | i | ƒ | ƒ q Wt |  _  | i |  i d ƒ |  _	 n |  i S(   NR   (
   R
   R   R   R$   R3   R   R+   t   FalseR   R   (   R   R   R"   R#   (    (    s0   /64/home/arigo/u/pypy/interpreter/mixedmodule.pyt   getdicta   s    
	
 #	c         C   s)   |  i  ƒ  d  |  _ t |  _ t |  _ t S(   N(   R8   R   R   R7   t   startup_calledR	   t   _frozen(   R   (    (    s0   /64/home/arigo/u/pypy/interpreter/mixedmodule.pyt   _freeze_k   s
    
			c         C   sð   t  |  d ƒ pÜ h  |  _ } |  i } |  i ƒ  } x0 |  i i ƒ  D] \ } } t | | ƒ | | <qB Wx3 |  i i ƒ  D]" \ } } t | | | ƒ | | <qu Wd | j p t	 ‚ |  i
 o |  i | d <n d | j o |  i | d <qì n d S(   s    NOT_RPYTHON R   t   __file__t   __doc__N(   t   hasattrR   R   R   t   interpleveldefsR   t   getinterpevalloadert   appleveldefst   getappfileloadert   AssertionErrort   expose__file__attributet   get__file__t
   get__doc__(   R   R   R   t   appnameR"   t   spec(    (    s0   /64/home/arigo/u/pypy/interpreter/mixedmodule.pyR   t   s    	  
c         C   s_   |  i  } | i } t | | ƒ } |  i } | | ƒ } | i | i |  ƒ | i | ƒ | ƒ d  S(   N(   R   R   R@   R   t   setattrR!   (   R   R"   RH   R   R   R4   R   t   w_obj(    (    s0   /64/home/arigo/u/pypy/interpreter/mixedmodule.pyt   extra_interpdefˆ   s    			c         C   s˜   y |  i  } Wn{ t j
 oo |  i } t | d d d g ƒ } | i } t i i | ƒ i	 d ƒ p t
 ‚ t i i | ƒ } | |  _  n X| i | ƒ S(   sÐ    NOT_RPYTHON. 
        return the __file__ attribute of a MixedModule 
        which is the root-directory for the various 
        applevel and interplevel snippets that make
        up the module. 
        R=   s   __init__.pyN(   t   _fnameR1   R   t
   __import__R   R<   t   ost   patht   basenamet
   startswithRC   t   dirnameR!   (   R   R   t   fnameR   t   mod(    (    s0   /64/home/arigo/u/pypy/interpreter/mixedmodule.pyRE      s    		#c         C   s   | i  |  i ƒ S(   N(   R!   R=   (   R   R   (    (    s0   /64/home/arigo/u/pypy/interpreter/mixedmodule.pyRF   ¦   s    N(   t   __name__R   t   NOT_RPYTHON_ATTRIBUTESR   R   R	   RD   R   R   R   R   t   classmethodR$   R(   R   R*   R8   R;   R   RK   RE   RF   (    (    (    s0   /64/home/arigo/u/pypy/interpreter/mixedmodule.pyR   
   s*   									
						c            s   ‡  ‡ f d †  } | S(   s    NOT_RPYTHON c   	         s£  h  |  d <} xy t  ˆ | ƒ } WnØ t j
 oÌ } | i d i d ƒ d } | | j o ‚  n y( t ˆ  d | d  d  | g ƒ | | <Wqœt j
 o^ t i ƒ  \ } } } y  t | d  d  | g ƒ | | <Wqû t j
 o | | | ‚ qû XqœXq Xt	 | d ƒ o |  i
 t i | ƒ ƒ Sn y t | t ƒ } Wn t j
 o t } n X| o |  i | ƒ Sn t | t ƒ p t d ˆ  ˆ | f ‚ | Sq d  S(   NR   i    t   'i   R   t	   func_codesB   interpleveldef %s.%s must return a wrapped object (got %r instead)(   t   evalt	   NameErrort   argsR   RM   R   t   ImportErrort   syst   exc_infoR>   R!   R   t
   interp2appt
   issubclassR   t	   TypeErrorR7   t
   gettypeforR.   RC   (	   R   t   dt   valuet   exR"   t   etypet   evaluet   etbt   is_type(   R   RH   (    s0   /64/home/arigo/u/pypy/interpreter/mixedmodule.pyt   ifileloader­   s8    ( (    (   R   RH   Rk   (    (   R   RH   s0   /64/home/arigo/u/pypy/interpreter/mixedmodule.pyR@   «   s    $c            s(  | i  d ƒ \ } ‰ |  d | } y t | ‰  WnÞ t j
 oÒ d d k } t |  d d d g ƒ } | i | | i ƒ \ } } \ }	 }
 } | | i j p t	 ‚ | i
 ƒ  } | i ƒ  | i d ƒ p | i d ƒ o | d  } n t i | d | d | ƒ‰  ˆ  t | <n X‡ ‡  f d	 †  } | S(
   s    NOT_RPYTHON R   iÿÿÿÿNR=   s   .pycs   .pyot   filenamet   modnamec            s   ˆ i  |  ˆ  ƒ S(   N(   t   wget(   R   (   t   attrnamet   app(    s0   /64/home/arigo/u/pypy/interpreter/mixedmodule.pyt   afileloaderè   s    (   R   t   applevelcacheR,   t   impRM   R   t   find_modulet   __path__t	   PY_SOURCERC   t   readt   closet   endswithR   t   applevel(   R   RG   RH   Rm   t   impbaseRs   t   pkgt   filet   fnt   suffixt   modet   typt   sourceRq   (    (   Rp   Ro   s0   /64/home/arigo/u/pypy/interpreter/mixedmodule.pyRB   Ô   s"    '
 (   t   pypy.interpreter.moduleR    t   pypy.interpreter.functionR   R   t   pypy.interpreterR   t   pypy.interpreter.errorR   t   pypy.interpreter.baseobjspaceR   RN   R^   t   inspectR   R@   Rr   RB   (    (    (    s0   /64/home/arigo/u/pypy/interpreter/mixedmodule.pys   <module>   s   ¡	(
