
    b^M%                         d dl Z d 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 ddlmZmZmZmZmZ  ej                    Zi Z d Z!d Z" G d d	e#          Z$d
 Z%dS )    N   )
RepositoryFunctionInfoRegisteredTypeInfoEnumInfo
ObjectInfoInterfaceInfoConstantInfo
StructInfo	UnionInfoCallbackInfoStructBoxed	CCallbackenum_addenum_register_new_gtype_and_add	flags_add flags_register_new_gtype_and_add
GInterface)GObjectMeta
StructMeta)	TYPE_NONE
TYPE_BOXEDTYPE_POINTER	TYPE_ENUM
TYPE_FLAGSc                 "   |                                  }|s+|                                 }|r|j        r|j        S t          S |                                }|                                }t          j        d|z             }t          ||          S Ngi.repository.)	
get_parent
get_g_typepytypeobjectget_namespaceget_name	importlibimport_modulegetattr)object_infoparent_object_infogtype	namespacenamemodules         +/usr/lib/python3/dist-packages/gi/module.pyget_parent_for_objectr0   @   s    $//11  &&(( 	 U\ 	 < "0022I&&((D$%5	%ABBF64       c                     g }|                                  D ]d}|                                }|                                }t          j        d|z             }|                    t          ||                     e|S r   )get_interfacesr$   r%   r&   r'   appendr(   )r)   
interfacesinterface_infor,   r-   r.   s         r/   get_interfaces_for_objectr7   W   s    J%4466 1 1"0022	&&((()9I)EFF'&$//0000r1   c                   ,    e Zd ZdZddZd Zd Zd ZdS )IntrospectionModuleaU  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.
    Nc                    t                               ||           || _        || _        d|z   | _        t                               | j                  }|g| _        | j        &t                               | j                  | _        dS dS )z"Might raise gi._gi.RepositoryErrorr   N)
repositoryrequire
_namespace_version__name__get_typelib_path__path__get_version)selfr,   versionpaths       r/   __init__zIntrospectionModule.__init__j   s}     	9g...#(94**4?;;= &224?CCDMMM ! r1   c           	      x   t                               | j        |          }|st          | j        d|          t          |t                    r|                                }|j        }|q|	                                rG|
                    t                    rt          |          }nc|t          k    sJ t          |          }nF|
                    t                    rt!          |          }n|t          k    sJ t#          |          }||_        d|                                z   |_        d                    dd          }|                                D ]U}|                                                    |          }t3          || ||                                                     V|                                D ]}t3          ||j        |           |t          k    r||_        n:t          |t8                    r|                                }t          |t:                    rFt=          |          t?          fdtA          |          D                       }	f|	z   }
tB          }nt          |tD                    rtF          f}
tB          }nt          |tH                    rtJ          f}
tB          }nt          |tL          tN          f          r|
                    tP                    r	tR          f}
nr|
                    tT                    s|t          k    s|j+        |k    r	tX          f}
n9t[          d|                                d|.                                          t^          }nta          |          |t          k    r|j        }|||
vr|| j1        |<   |S |d| j        z   |d	} |||
|          }|t          k    r||_        nQt          |td                    r|}n9t          |tf                    r|                                }nta          |          || j1        |<   |S )
Nz object has no attribute r    abcdefgjhijklmnopqrstuvwxyzABCDEFGJHIJKLMNOPQRSTUVWXYZc              3   <   K   | ]}t          |          |V  d S N)
issubclass).0	interfaceparents     r/   	<genexpr>z2IntrospectionModule.__getattr__.<locals>.<genexpr>   sN       #I #I*4VY*G*G#I9 #I #I #I #I #I #Ir1   zunable to create a wrapper for .)__info__
__module__	__gtype__)4r;   find_by_namer=   AttributeErrorr?   
isinstancer   r!   r"   is_flagsis_ar   r   r   r   r   r   r   rS   r$   rT   	maketrans
get_valuesget_name_unescaped	translatesetattr	get_valueget_methodsr   r   r0   tupler7   r   r   r   r	   r   r   r   r   r   r   fundamentalr   	TypeErrorr%   r   NotImplementedError__dict__r   r
   )rC   r-   infog_typewrapperascii_upper_trans
value_info
value_namemethod_infor5   bases	metaclasstype_dict_rP   s                 @r/   __getattr__zIntrospectionModule.__getattr__x   si   &&t== 	7 !%"6 7 7 7 dH%% \	,__&&FmG==?? H{{:.. I"+F"3"3%2222"B4"H"H{{9-- H"*6"2"2%2222"A$"G"G#' %58J8J8L8L%L"
 %'LL11%3 %3! #'//"3"3 R RJ!+!>!>!@!@!J!JK\!]!]JGZ9M9M9O9O1P1PQQQQ#'#3#3#5#5 H HKG[%9;GGGG"" '011 8	,__&&F $
++ 0.t44" #I #I #I #I>WX\>]>] #I #I #I I I
	J.'		D,// 0"'		D-00 0#'		D:y"9:: 0;;z** v"HEEkk,// v	))(F22#IEE#)dN`N`NbNbNbNbdhdqdqdsdsds$tuuu&		)$/// ""$e););*/DM$' L !.@# E
  ieU33G "" 'l++ 	,GGl++ 	,nn&&GG%d+++
 &dr1   c                 \    t                               | j                  }d| j        d|dS )Nz<IntrospectionModule z from >)r;   r@   r=   )rC   rE   s     r/   __repr__zIntrospectionModule.__repr__   s.    **4?;;59___dddKKr1   c                 6   t          t          | j                            }|                    | j                                                   t                              | j                  }|                    d |D                        t          |          S )Nc              3   h   K   | ]-}t          |t                    |                                V  .d S rL   )rX   r   r%   )rN   rg   s     r/   rQ   z.IntrospectionModule.__dir__.<locals>.<genexpr>   sL       : :$$T<88:dmmoo : : : : : :r1   )
setdir	__class__updaterf   keysr;   	get_infosr=   list)rC   resultnamespace_infoss      r/   __dir__zIntrospectionModule.__dir__   s    S(())dm((**+++ %..t?? : :/ : : : 	: 	: 	: F||r1   rL   )r?   rT   __qualname____doc__rF   rr   ru   r    r1   r/   r9   r9   b   sj         D D D Dh h hTL L L    r1   r9   c                     | t           v rt           |          S t          j        |           }t          | |          }|t           | <   |S )z
    :Returns:
        An object directly wrapping the gi module without overrides.

    Might raise gi._gi.RepositoryError
    )_introspection_modulesgiget_required_versionr9   )r,   rD   r.   s      r/   get_introspection_moduler      sJ     ***%i00%i00G G44F(.9%Mr1   )&r&   r   _gir   r   r   r   r   r	   r
   r   r   r   r   r   r   r   r   r   r   r   typesr   r   
_constantsr   r   r   r   r   get_defaultr;   r   r0   r7   r#   r9   r   r   r1   r/   <module>r      s  .     				                                       &                     $Z#%%
  ! ! !.  Q Q Q Q Q& Q Q Qh    r1   