???<!-- GIF89;a -->
123123123123
.....................................................................................................................................???<!-- GIF89;a -->
123123123123
.....................................................................................................................................3
<_Q(                 @   s  d dl mZ d dlZd dlZd dlmZ ejd  dkZy
djZW n  e	k
r`   d dl
mZ Y nX 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d Z+dd Z,G dd de-Z.dd Z/dS )    )absolute_importN)Lock    )	maketrans   )
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             C   sP   | j  }|s(| j }|r$|jr$|jS tS |j }|j }tjd| }t||S )Nzgi.repository.)	Z
get_parent
get_g_typepytypeobjectget_namespaceget_name	importlibimport_modulegetattr)object_infoZparent_object_infoZgtype	namespacenamemodule r-   /usr/lib64/python3.6/module.pyget_parent_for_objectL   s    
r/   c             C   sH   g }x>| j  D ]2}|j }|j }tjd| }|jt|| qW |S )Nzgi.repository.)Zget_interfacesr$   r%   r&   r'   appendr(   )r)   
interfacesZinterface_infor*   r+   r,   r-   r-   r.   get_interfaces_for_objectc   s    r2   c               @   s2   e Zd ZdZdddZdd Zdd Zd	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             C   sl   t j|| || _|| _d| | _t j| j}|g| _trH|jdg| _| jdkr`t j	| j| _t
 | _dS )z"Might raise gi._gi.RepositoryErrorzgi.repository.zUTF-8N)
repositoryZrequire
_namespaceZ_version__name__get_typelib_path__path__	_have_py3decodeZget_versionr   _lock)selfr*   versionpathr-   r-   r.   __init__v   s    

zIntrospectionModule.__init__c                s  t j| j|}|s$td| j|f t|tr<|j }| j |j	}|d kr|j
 r|jtrlt|}q|tksxtt|}n(|jtrt|}n|tkstt|}||_d|j  |_tdd}x2|j D ]&}|j j|}t||||j  qW x |j D ]}t||j| qW |tkr.||_	W d Q R X nt|tr|j }t|trt | t! fddt"|D }	 f|	 }
t#}nt|t$rt%f}
t#}nt|t&rt'f}
t#}ntt|t(t)fr*|jt*rt+f}
nB|jt,s|tks|j-|krt.f}
nt/d|j |j0 f t1}nt2|| jf |tkrl|j	}|d k	rl||
krl|| j3|< |S |d| j |d}|||
|}|tkr||_	W d Q R X n0t|t4r|}nt|t5r|j }nt2||| j3|< |S )	Nz%r object has no attribute %rzgi.repository.ZabcdefgjhijklmnopqrstuvwxyzZABCDEFGJHIJKLMNOPQRSTUVWXYZc             3   s   | ]}t  |s|V  qd S )N)
issubclass).0Z	interface)parentr-   r.   	<genexpr>   s    z2IntrospectionModule.__getattr__.<locals>.<genexpr>z$unable to create a wrapper for %s.%s)__info__
__module__Z	__gtype__)6r4   Zfind_by_namer5   AttributeErrorr6   
isinstancer   r!   r;   r"   Zis_flagsZis_ar    r   r   AssertionErrorr   r   r   r   rD   r$   rE   r   Z
get_valuesZget_name_unescaped	translatesetattrZ	get_valueZget_methodsr
   r   r/   tupler2   r   r   r   r   r   r   r   r   r   r   Zfundamentalr   	TypeErrorr%   r   NotImplementedError__dict__r	   r   )r<   r+   infoZg_typewrapperZascii_upper_transZ
value_infoZ
value_nameZmethod_infor1   bases	metaclassZtype_Zdict_r-   )rB   r.   __getattr__   s    













zIntrospectionModule.__getattr__c             C   s(   t j| j}tr|jd}d| j|f S )NzUTF-8z <IntrospectionModule %r from %r>)r4   r7   r5   r9   r:   )r<   r>   r-   r-   r.   __repr__   s    
zIntrospectionModule.__repr__c             C   sF   t t| j}|j| jj  tj| j}|jdd |D  t	|S )Nc             s   s    | ]}t |ts|j V  qd S )N)rG   r   r%   )rA   rO   r-   r-   r.   rC     s    z.IntrospectionModule.__dir__.<locals>.<genexpr>)
setdir	__class__updaterN   keysr4   Z	get_infosr5   list)r<   resultZnamespace_infosr-   r-   r.   __dir__   s
    zIntrospectionModule.__dir__)N)r6   rE   __qualname____doc__r?   rS   rT   r\   r-   r-   r-   r.   r3   n   s
   
lr3   c             C   s0   | t k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giZget_required_versionr3   )r*   r=   r,   r-   r-   r.   get_introspection_module  s    

ra   )0Z
__future__r   sysr&   Z	threadingr   version_infor9   r   rF   stringr`   Z_gir   r	   r
   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   typesr   r   Z
_constantsr   r   r   r   r    Zget_defaultr4   r_   r/   r2   r#   r3   ra   r-   r-   r-   r.   <module>   s&   
P 