509318396
Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­
<!DOCTYPE html>
<html>
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ƒr–t|ƒ}n|tks¢t‚t|ƒ}||_d|jƒ  |_tddƒ}x2|jƒ D ]&}|jƒ j|ƒ}t||||jƒ ƒƒ qÒW x |jƒ D ]}t||j|ƒ �qW |tk�r.||_	W d Q R X �nšt|tƒ�r¦|jƒ }t|tƒ�rŽt |ƒ‰ t!‡ fdd„t"|ƒD ƒƒ}	ˆ f|	 }
t#}n¤t|t$ƒ�r¦t%f}
t#}nŒt|t&ƒ�r¾t'f}
t#}ntt|t(t)fƒ�r*|jt*ƒ�rât+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 