ó
§Zc           @@  s|  d  d l  m Z d  d l Z d  d l Z e j d  d k Z y d j Z Wn! e k
 rk d  d l m Z n Xd  d l	 Z	 d d l
 m Z m Z m Z m Z m Z m Z m Z m Z m Z m Z m Z m Z m Z m Z m Z m Z m Z m Z d d l m Z m Z e j  Z  d d	 l! m" Z" m# Z# m$ Z$ m% Z% m& Z& e j' ƒ  Z( i  Z) d
 „  Z* d „  Z+ d e, f d „  ƒ  YZ- d „  Z. d S(   i    (   t   absolute_importNi   t    (   t	   maketransi   (   t
   Repositoryt   FunctionInfot   RegisteredTypeInfot   EnumInfot
   ObjectInfot   InterfaceInfot   ConstantInfot
   StructInfot	   UnionInfot   CallbackInfot   Structt   Boxedt	   CCallbackt   enum_addt   enum_register_new_gtype_and_addt	   flags_addt    flags_register_new_gtype_and_addt   _gobject(   t   GObjectMetat
   StructMeta(   t	   TYPE_NONEt
   TYPE_BOXEDt   TYPE_POINTERt	   TYPE_ENUMt
   TYPE_FLAGSc         C@  sp   |  j  ƒ  } | s8 |  j ƒ  } | r4 | j r4 | j St S| j ƒ  } | j ƒ  } t j d | ƒ } t | | ƒ S(   Ns   gi.repository.(	   t
   get_parentt
   get_g_typet   pytypet   objectt   get_namespacet   get_namet	   importlibt   import_modulet   getattr(   t   object_infot   parent_object_infot   gtypet	   namespacet   namet   module(    (    s/   /usr/lib64/python2.7/site-packages/gi/module.pyt   get_parent_for_objectM   s    c         C@  sb   g  } xU |  j  ƒ  D]G } | j ƒ  } | j ƒ  } t j d | ƒ } | j t | | ƒ ƒ q W| S(   Ns   gi.repository.(   t   get_interfacesR    R!   R"   R#   t   appendR$   (   R%   t
   interfacest   interface_infoR(   R)   R*   (    (    s/   /usr/lib64/python2.7/site-packages/gi/module.pyt   get_interfaces_for_objectd   s    t   IntrospectionModulec           B@  s5   e  Z d  Z d d „ Z d „  Z d „  Z d „  Z RS(   sU  An object which wraps an introspection typelib.

    This wrapping creates a python module like representation of the typelib
    using gi repository as a foundation. Accessing attributes of the module
    will dynamically pull them in and create wrappers for the members.
    These members are then cached on this introspection module.
    c         C@  s   t  j | | ƒ | |  _ | |  _ d | |  _ t  j |  j ƒ |  _ t rb |  j j d ƒ |  _ n  |  j d k r‰ t  j
 |  j ƒ |  _ n  d S(   s"   Might raise gi._gi.RepositoryErrors   gi.repository.s   UTF-8N(   t
   repositoryt   requiret
   _namespacet   _versiont   __name__t   get_typelib_patht   __path__t	   _have_py3t   decodet   Nonet   get_version(   t   selfR(   t   version(    (    s/   /usr/lib64/python2.7/site-packages/gi/module.pyt   __init__w   s    		c         @  sÙ  t  j |  j | ƒ } | s7 t d |  j | f ƒ ‚ n  t | t ƒ r©| j ƒ  } | j } | d  k rŽ| j
 ƒ  r² | j t ƒ r‘ t | ƒ } qî | t k s£ t ‚ t | ƒ } n< | j t ƒ rÐ t | ƒ } n | t k sâ t ‚ t | ƒ } | | _ d | j ƒ  | _ t d d ƒ } xE | j ƒ  D]7 } | j ƒ  j | ƒ } t | | | | j ƒ  ƒ ƒ q&Wx* | j ƒ  D] } t | | j | ƒ qnWn  | t k rÈ| | _ qÈnt | t ƒ r†| j ƒ  } t | t ƒ rt  | ƒ ‰  t! ‡  f d †  t" | ƒ Dƒ ƒ }	 ˆ  f |	 }
 t# } nß t | t$ ƒ r8t% f }
 t# } n¾ t | t& ƒ rYt' f }
 t# } n t | t( t) f ƒ rê| j t* ƒ r‰t+ f }
 nX | j t, ƒ s³| t k s³| j- | k r¿t. f }
 n" t/ d | j ƒ  | j0 ƒ  f ƒ ‚ t1 } n t2 | ƒ ‚ | t k r7| j } | d  k	 r7| |
 k r7| |  j3 | <| Sn  i | d 6d |  j d 6| d	 6} | | |
 | ƒ } | t k rÈ| | _ qÈnB t | t4 ƒ rž| } n* t | t5 ƒ r¼| j ƒ  } n t2 | ƒ ‚ | |  j3 | <| S(
   Ns   %r object has no attribute %rs   gi.repository.t   abcdefgjhijklmnopqrstuvwxyzt   ABCDEFGJHIJKLMNOPQRSTUVWXYZc         3@  s$   |  ] } t  ˆ  | ƒ s | Vq d  S(   N(   t
   issubclass(   t   .0t	   interface(   t   parent(    s/   /usr/lib64/python2.7/site-packages/gi/module.pys	   <genexpr>·   s    s$   unable to create a wrapper for %s.%st   __info__t
   __module__t	   __gtype__(6   R2   t   find_by_nameR4   t   AttributeErrorR6   t
   isinstanceR   R   R   R;   t   is_flagst   is_aR   R   R   t   AssertionErrorR   R   R   R   RF   R    RG   R   t
   get_valuest   get_name_unescapedt	   translatet   setattrt	   get_valuet   get_methodsR   R   R+   t   tupleR0   R   R   R   R   t
   GInterfaceR
   R   R   R   R   t   fundamentalR   t	   TypeErrorR!   R   t   NotImplementedErrort   __dict__R   R	   (   R=   R)   t   infot   g_typet   wrappert   ascii_upper_transt
   value_infot
   value_namet   method_infoR.   t   basest	   metaclasst   type_t   dict_(    (   RE   s/   /usr/lib64/python2.7/site-packages/gi/module.pyt   __getattr__‡   sŽ    			 "					"		
	c         C@  s;   t  j |  j ƒ } t r* | j d ƒ } n  d |  j | f S(   Ns   UTF-8s    <IntrospectionModule %r from %r>(   R2   R7   R4   R9   R:   (   R=   t   path(    (    s/   /usr/lib64/python2.7/site-packages/gi/module.pyt   __repr__ñ   s    c         C@  s^   t  t |  j ƒ ƒ } | j |  j j ƒ  ƒ t j |  j ƒ } | j d „  | Dƒ ƒ t	 | ƒ S(   Nc         s@  s*   |  ]  } t  | t ƒ s | j ƒ  Vq d  S(   N(   RK   R   R!   (   RC   R[   (    (    s/   /usr/lib64/python2.7/site-packages/gi/module.pys	   <genexpr>  s    (
   t   sett   dirt	   __class__t   updateRZ   t   keysR2   t	   get_infosR4   t   list(   R=   t   resultt   namespace_infos(    (    s/   /usr/lib64/python2.7/site-packages/gi/module.pyt   __dir__ø   s
    N(   R6   RG   t   __doc__R;   R?   Rf   Rh   Rr   (    (    (    s/   /usr/lib64/python2.7/site-packages/gi/module.pyR1   o   s
   	j	c         C@  s@   |  t  k r t  |  St j |  ƒ } t |  | ƒ } | t  |  <| S(   s€   
    :Returns:
        An object directly wrapping the gi module without overrides.

    Might raise gi._gi.RepositoryError
    (   t   _introspection_modulest   git   get_required_versionR1   (   R(   R>   R*   (    (    s/   /usr/lib64/python2.7/site-packages/gi/module.pyt   get_introspection_module  s    
(/   t
   __future__R    t   sysR"   t   version_infoR9   R   RJ   t   stringRu   t   _giR   R   R   R   R   R   R	   R
   R   R   R   R   R   R   R   R   R   R   t   typesR   R   RV   t
   _constantsR   R   R   R   R   t   get_defaultR2   Rt   R+   R0   R   R1   Rw   (    (    (    s/   /usr/lib64/python2.7/site-packages/gi/module.pyt   <module>   s$   v	(		™