
    ?eJ9                       d dl m Z  ddlmZ ddlmZ ddlmZmZmZm	Z	m
Z
mZmZ ddlm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  ddl!m"Z"m#Z#m$Z$m%Z%m&Z& dd	l'm(Z(m)Z)m*Z*m+Z+m,Z,m-Z-m.Z.m/Z/m0Z0 d
 Z1dOdZ2d Z3ej4        ej5        dfej6        ej7        dfej7        ej6        dfej5        ej4        dfej8        ej9        dfej9        ej8        dfiZ:d Z;d Z<d Z=dOdZ>d Z?d Z@d ZAd ZBd ZCdOdZDd ZEd ZFd  ZGd! ZHd" ZIdOd#ZJd$ ZKd% ZLd& ZMd' ZNd( ZOd) ZPd* ZQd+ ZRd, ZSd- ZTd. ZUejV        ejW        fZXg ejY        ejZ        ej[        ej\        ej]        ej^        ej_        ej`        eja        ejb        ejc        ejd        eje        ejf        ejg        ejh        eji        ejj        ejk        ejl        ejm        ejn        ejo        ejp        ejq        ejr        ejs        ejt        eju        ejv        ejw        ejx        R Zyejz        ej{        ej|        fZ}ej~        ej        ej        ej        ej        ej        ej        fZd/ ZdPd1Zd2 Zd3 Zd4 Zd5 Zd6 Zd7 Zd8 ZdPd9Zd: Zd; Zd< Zd= Zd> Zd? Zd@ ZdA ZdOdBZdC ZdD ZdE ZdF ZdPdGZdPdHZdPdIZdJ ZdK ZdL ZdM ZdOdNZdS )Q    copy   )ErrorLog)instantiate_type_hints)is_hash_return_slotis_int_return_slotis_inplace_number_slotis_rich_compare_slotis_ssize_return_slotis_void_return_slotis_zero_arg_slot)
ScopedName)AccessSpecifierArgumentArgumentTypeClassKeyConstructorIfaceFileType
MappedTypeMemberPyQtMethodSpecifierPySlot	SignatureTransfer	ValueTypeVirtualHandlerVirtualOverloadVisibleMemberWrappedClass)encoded_template_namesame_template_signaturetemplate_codetemplate_code_blockstemplate_expansions)	append_iface_fileargument_as_strcached_namefind_iface_filefind_methodsame_argument_typesame_base_typesame_signaturesearch_typedefsc                 
   t                      }|D ]<}t          ||           |j        j                            d          d         |_        =| j        j        | j        j        D ]~}|j        
| j        j        |j        | j        _        (| j        j        |j        urC|	                    d
                    | j        j        | j        j        |j                             | j        D ]\}|j        j        2|	                    d
                    |j        j                             |j        j        j        dk    rd|_        ]t!          | j                  }g | _        |D ] }|j        j        t#          | ||           !t%          | | j        |           | j        D ]8}|j        s|j        s|j        j        t,          j        u r)t1          |           9| j        D ]$}|j        D ]}|j        rt7          | ||           %t9          | |           | j        D ]}t;          | |           | j        j        D ]}t;          | |           | j        D ]}|j        j        t,          j        u rX|j         r(|j!        s!|j"        tF          j$        ur|j%        rd|_&        tO          | |           |j         rtQ          | ||           r|j        j        t,          j        u r%|j        D ]}tS          | |j        j*        |           |D ]X}tW          | ||           |j        D ]}tS          | |j*        |           |j        D ]}|j,        j        j-        |j        _-        Y| j        D ]/}|j        j        t]          | |           t_          ||           0| j0        D ]}|j        j        }| j1        dk    s| j1        d	k    r3| j1        d
k     r(|| j        u rte          | j        j*        |j                   |j        j        t,          j3        urp|j4        |j5        || j        u s|j6        r|j7        |_8        |xj7        dz  c_7        d| j9        v r-| j:        D ]%}	|	j        | j        u rtw          |	| j                   &| j<        }
g | _<        t{          |
>                                d          D ]2}| j<        ?                    t{          |
|         d                      3t          |            |A                                 dS )zp Resolve all types of a parsed specification and create additional views
    so that code can be generated.
    .NzF'{0}' module has imported different default meta-types '{1}' and '{2}'z class '{0}' has not been definedQObjectT         	   r4   r   r5   PyQt6)reversec                     | j         S Nname)ks    Dlib/python3.11/site-packages/sipbuild/generator/resolver/resolver.py<lambda>zresolve.<locals>.<lambda>   s    16     key)Br   _set_all_imports
fq_py_namer?   splitpy_namemoduledefault_metatypeall_importslogformatclasses
iface_filefq_cpp_name	base_name
is_qobjectreversed_set_mro_resolve_moduleno_default_ctors	is_opaquetyper   	NAMESPACE_add_default_copy_ctor	overloadsis_auto_generated_add_auto_overload_move_main_module_casts_slots_add_complementary_slotsproxiesCLASSneeds_shadowis_incompletedtorr   PRIVATE
can_create
has_shadow_get_visible_py_members_get_virtuals!_iface_files_are_used_by_overloadused_create_sorted_numbered_types
real_classtype_nr_check_helpers_check_properties
exceptionsabi_versionr&   	EXCEPTIONbuiltin_base_exceptiondefined_base_exceptionneedednr_exceptionsexception_nrpluginsenums_enum_iface_file_is_used
name_cachesortedkeysextend_set_string_pool_offsetsas_exception)specmodules	error_logmodklassreversed_classesoverload	exceptionexception_modenumr}   r@   s               rA   resolver   ,   s   
 

I  9 9i((( n)//44R8 {#+;* 	7 	7C#+{+3/2/C,,-S5III`gg $ 6 $ < # 46 67 7 7  	$ 	$"*MM6==!,8: :; ; ; '1Y>>#E  --DL! ) )"*ui(((( D$+y111  & &! 	U_ 	8H8MQ^Qh8h8hu%%%%  : : 	: 	:H) :"4999	: "$	222  . . u----$ . . u----  " " M$777! (%*= (%*TcTkBkBkpu  qABk#'  $D%000 ! 6dE9555"m&===!O " "1$8H8M " " " "  	K 	K%dC;;; 	H 	HH-dCHhGGGG [ 	K 	KE','7'B'JE$$	K  , ,"*tU###%++++ _ - -	!,3 w&&4+;w+F+F4K[^eKeKe++!$+"2I4HIII $M,CCC+3	8X8`DK''9+;'%2%@I"''1,'' $,J 	< 	<D{dk))(t{;;; JDOJOO%%t444 L Lvjm9I9IJJJKKKKT""" rC   Nc                    |g }n||v rdS |j         D ]}t          | |||           t          | ||           t          | ||           t	          | |j        |           | j        D ]`}|j        j        |u rPt          | ||           t          | ||j                   t	          | |j        ||           t          | ||           at          | ||           |                    |           dS )z. Resolve a module and the modules it imports. Nseenscope)importsrV   _resolve_typedefs_resolve_variables_resolve_scope_overloadsr\   rO   rP   rJ   _resolve_ctors_set_needed_exceptionsdtor_throw_args_transform_casts_resolve_mapped_typesappend)r   r   r   r   imported_modr   s         rA   rV   rV      s5    |	
  B BlIDAAAAA dC+++tS),,,T3=)<<<  	5 	5"c))4	222 #4e.CDDD$T5?I! ! ! !T5)444 $Y///KKrC   c                 `   d}| j         D ]}|j        s
t          |j                  }| j         D ]g}t          |j                  }||k    r nJ|j        r|j        r-|j                            |j                  rd|_        |j        |z   |z
  |_         nh|j        s||_        ||dz   z  }dS )z: Set the offset into the string pool for every used name. r   Tr5   N)r}   rl   lenr?   is_substringendswithoffset)r   r   r?   name_len	prev_nameprev_name_lens         rA   r   r      s     F # #y 	ty>>  	 	I	//M((> Y%; ~&&ty11 $(!'.>I
   	# DKhl"F/# #rC   __ge____gt____le____lt____ne____eq__c                     t          |j                  D ]<}	 t          |j                 \  }}n# t          $ r Y %w xY wt          | ||||           =dS )z Add any missing complementary slots to a class.  This emulates the C++
    behaviour of automatically interpreting (for example) >= as !<.
    N)listmembers	_SLOT_MAPpy_slotKeyError_add_complementary_slot)r   r   membercompl
compl_names        rA   r`   r`     s~    
 u}%% H H	 )&. 9E:: 	 	 	H	 	 eVUJGGGGH Hs   .
;;c                 8   d}|j         D ]}|j        |us|j        s|j        |j         D ]-}|j        j        |u rt          | |j        |j                  r n.|s|j        D ]}|j        |u r n_t          |          }t          | |          |_
        ||_        |j
        j        rd|j
        _        |j                            d|           t          |          }d|_        d|_        ||_        ||_        |j                             d|            dS dS )z, Add a complementary slot if it is missing. NTr   F)r\   commonis_complementarymethod_coder   r-   py_signaturer   r   r(   rI   rl   insert
is_virtualcpp_name)r   r   r   r   r   member2r   	overload2s           rA   r   r   +  sZ    GO # #?&((H,E(I]Ii  	 	I'500^D(J_ajaw5x5x0 $} 5 5G%// 0 #6llG&1$
&C&CGO&+GO~* 4/3,M((G444 XI#(I )-I&&I!+IO""1i000EE9 # #rC   c                    |j         rdS |j        rdS |j        t          j        urdS dx}}|j        D ]}|j        |j        t          j        urt          |j        j	                  dk    s|j        j	        d         j
        d}Tt          |j        j	                  dk    r^|j        j	        d         }|j        t          j        ur|j        |u r/|j        r(|j        r!t          |j                  dk    r	|j
        d}|r+d|_        t'          |j        j        j        |j                   |r-d|_        t'          |j        j        j        |j                   dS dS )z1 See if a class supports array and copy helpers. NFr   Tr5   )is_abstractcannot_assignre   r   PUBLICctorscpp_signatureaccess_specifierr   argsdefault_valuerY   r   rb   
definitionis_referenceis_constderefsneeds_array_helperr&   rP   rJ   rl   needs_copy_helper)r   r   public_default_ctorpublic_copy_ctorctorargs         rA   rp   rp   V  s   
   z/// .32* ( (%)>oF\)\)\t!&''1,,0B0G0J0X0d"&#())Q..$)!,Cx|111~&&3+;&&QTUXU_Q`Q`deQeQejmj{  kD#'  J#' %*168HIII J"&%*168HIIIIIJ JrC   c                 ^    |g }n1 |v r-|                     d                     j                             |                                 j        D ]}t          |||            fd} j        D ]"}|j        D ]} ||            ||           #|                                dS )z Set the list of all imports for a module.  The list is ordered so that
    a module appears before any module that imports it.
    Nz$module '{0}' is imported recursivelyr   c                 R    | j         vrj                             |            d S d S r=   )rL   r   )importedr   s    rA   _append_unique_importz/_set_all_imports.<locals>._append_unique_import  s4    3?**O""8,,,,, +*rC   )rM   rN   rG   r   r   rF   rL   remove)r   r   r   direct_importr   r   s   `     rA   rF   rF     s    |	6==cnMM	O 	O 	O 	KK  > >	=====- - - - -  - -%1 	, 	,H!!(++++m,,,,KKrC   c                     | j         D ]&}|j        j        | j        u rt          | ||           '| j        j        D ](}|j        |j        | j        u rt          | ||           )dS )zs Move the casts and slots to the correct place for a main module (ie.
    the one we are generating code for).
    N)rO   rP   rJ   _move_class_castsglobal_functionsr   _move_global_slot)r   r   r   r   s       rA   r_   r_     s    
  6 6"dk11dE9555+. 7 7>%&-4;*F*FdFI6667 7rC   c           
         |j         D ]Z}|j        }t          t          j        |t          |j                  |j        |j        d|j	                  }t          |g          }t          t          j        ||d          }|j        j        | j        ur6t!          | j        j        |           t%          | j        |          }d|_        t!          |j        j        |           |j        D ]\}t+          | |j        |j        d          r=|                    d                    |j        j        |j        j                             ]|j                            |           \dS )	zS Move any class casts to its correct class, or publish as a ctor
    extender.
    T)r   r   r   r   is_insource_location)r   )r   r   is_castFstrictz) operator '{0}::{0}({1})' already definedN)castsr   r   r   rb   r   r   r   r   r   r   r   r   r   rP   rJ   _iface_file_is_usedrl   
_get_proxyno_typehintr   r-   r   rM   rN   rQ   r   )	r   r   r   cast	dst_klassr   	signaturer   dst_ctors	            rA   r   r     sy   
  % %O	 |)eDK((t7Hd $ 46 6 6 C5)))	?1	'7 7 7 &dk99 0#666"4;	::I#DI05s;;; " 	? 	?HdH$94;LUZ[[[ ?CJJ ) 4 @ % 0 <> >? ? ?
 	t$$$$9% %rC   c                 	   t          | j        j                  D ]}|j        |ur|j        j        d         }	 |j        j        d         }n# t          $ r d}Y nw xY wd}d}d}d}	d}
|j        t          j	        u r+|j
        j        }|j
        j        }|j
        j        j        }n!|j        t          j        u r,|j
        j        }|j
        j        }|j
        j        }|j
        }	n|&|j        t          j        u rnt!          |d|           |j        t          j	        u r,|j
        j        }|j
        j        }|j
        j        j        }d}
n{|j        t          j        u r.|j
        j        }|j
        j        }|j
        j        }|j
        }	d}
n:|j        t          j        u s|j        t          j        u rnt!          |d|           t#          |j                  rD|
rt!          |d|           ||j        ur&|j        t          j        u rt!          |d	|           ||j        urt#          |j                  rt'          ||j
                  }|j        D ]}|j        |j        u r n>t)          ||j        |j        |j        
          }|j                            d|           | j        j                            |           ||_        d|_        |j                            d|           |j        j        d= | j        j                            |           |	t5          |	|           d|	j        _        d}|D ]}|j        |j        u r nbt9          |          }||_        |                    d|           | j        dk     r*|j        t          j        u r|j        t<          j        u r|
sd}|
rd|_         tB          j"        |_#        ||_        d|_$        |%                    |           |rt9          |          }t9          |j                  |_        t9          |j        j                  |j        _        |j        |_&        dg|j        j        d         _'        |j        j        d= |%                    |           tQ          |j                  st#          |j                  r,tS          |j'                  dk    rd|_*        |j        j        d= tW          |j                  r|j        j        d= dS )z7 If possible, move a global slot to its correct class. r   r5   NFz$the argument must be a class or enumTz,one of the arguments must be a class or enumz"argument 1 must be a class or enumzargument 1 must be a class)r   namespace_iface_filer9   ),r   rJ   r\   r   r   r   
IndexErrorrY   r   rb   r   r   rP   ENUMslotsNONE_log_overload_errorr   r   r   r   rI   r   r   r   r   r|   rl   r   rs   r   EQis_reflectedr   r   r   	is_globalr   r   r   r
   r   dont_deref_selfr   )r   global_slotr   r   arg0arg1arg_membersarg_overloads
arg_modulearg_enum	is_secondproxyproxy_memberinject_equality_slot
arg_membereq_overloads                   rA   r   r     s    .// h. h.?+-- $)!,	(-a0DD 	 	 	DDD	 
	9***/1K O5M3:JJY,+++//K O5M/JHH\yL---#I>J J JY,,,,/1K O5M3:JIIY,+++//K O5M/JHII yL---l>O1O1O#IF " " "    344 		 #I<hH H H!333	\EV8V8V#I/K " " "[///#K$788 2":t?? %*M : :L#+{/BBB C $**k6I$/$71<1Q$S $S $SL M((L999 %,,X666 #/'+$&&q(333 ).q1 	$$X...$Xz:::$(H!  %% 	, 	,J![%888 9 k**J *Jq*--- '))di<;L.L.LQ[QcgmgpQpQp  zCQp'+$  	)$(H!$3$:!$!X&&&   		.x..K'+K,D'E'EK$,01I1N,O,OK$)(3(@K%7<gK$)!,3(-a0  --- "*"455 	.9MjN`9a9a 	.4;!##+/(%*1- J.// 	.%*1-Qh. h.s   AAAc                     | j         D ]}|j        |j        u r|c S t          |j        |j        |j        |j        ||j                  }| j                             d|           |S )z} Create a proxy for a class if it doesn't already exist.  Proxies are
    used as containers for cross-module extenders.
    )r   mrorn   superclassesr   )ra   rP   r    rI   r   r  r  r   )r   r   r   s      rA   r   r     s    
   u///LLL 0 )5=	e%:LN N NE Kq%   LrC   c                    | j         D ]}||u r|j        D ]}||u r|j        D ]}|j        |j        j        u r nAt          |j                  }|j        j        |_        |j                            d|           t          |          }||_        d|_	        |j
                            d|           |j        j        | j        u rd|j        _         ndS )z2 Add an overload that is automatically generated. r   FTN)rO   r  r   rI   r   r   rP   rJ   r   is_autogeneratedr\   rl   )r   
auto_klassauto_overloadr   	mro_klassr   r   s          rA   r^   r^     s      J 	 	IJ&&#m 4 4F~)=)EEE F "-"677F$)$4$;FMM((F333.."(,1)&&q(333#*dk99*.FN'% ' rC   c                    || j         v rdS |g }|j        +t          | |j        ||           |j        j        rd|_        |j        j        t          j        u r|j        	                    |           |j
        ||_        |	                    |           |j        D ]4}||v r>|                    d                    |j        j        |j        j                             E|j        t"          j        u r2|                    d                    |j        j                             t          | |||           |j        D ]}||j        vr|j        	                    |           |j        j        | j        u rd|j        _        |j        rd|_        |j        rd|_        |j        rd|_        |j        rd|_        |j        |j        |_        6|                    |           |j        :t5          |j                  dk    r"|j        j        |j        j        j        |_        |j        |j        j        | j        u rd|j        _        |j        :t5          |j                  dk    r"|j        j        |j        j        j        |_        |j        &|j        j                             d          rd|_        |j        |j        j        | j        u rd|j        _        |j        )tC          |j        j        j        |j        j                   |j"        s|j#        tH          j%        u s|j&        sd|_'        n4|j(        D ],}|j)        r#|j*        tH          j%        u rd|_'        d|_&         n-| j         	                    |           dS )	zr Set the MRO for a class and add it to the list of classes so that it is
    after any classes it depends on.
    Nr   Tz3recursive class hierarchy detected: '{0}' and '{1}'z#union '{0}' cannot be a super-classr   zsip.wrapperF)+rO   r   rU   
deprecatedrP   rY   r   rb   r  r   convert_to_subclass_codesubclass_baser  rM   rN   rQ   	class_keyr   UNIONrJ   rw   rS   r   rc   r   metatyper   rK   rl   	supertypedefault_supertyper?   r   r&   rd   re   r   rf   rg   rh   r\   r   r   )r   r   r   r   
superklasssuperklass_mror   s          rA   rU   rU     s     | {u{ID9999;! 	$#E 333	)5"'E 	E, .	H .	HJT!!MTT % 0 < * 5 AC CD D D  #x~55=DD * 5 AC CD D D
 T:yt<<<< #-. H H!22I$$^444#*dk997;N-4!, ,'+E$ ", ,'+E$ "/ /*.E' ". .)-E& "/;*8*FE'9H< 	E >!c%*<&=&=&B&B&2!&!1!8!I>%%*:*AT[*P*P"&EN ?"s5+='>'>!'C'C&2"'"2"9"K?& #,,];; '"&?&5+;+Bdk+Q+Q#'EO  &%*16#.	0 	0 	0  ejO,CCC5K[C   	 	H# (A_E\(\(\#(  $)  	LrC   c                 p    | j         D ]-}|j        |u r"t          | |j        |j        |j        |           .dS )z6 Resolve the base types for all typedefs of a module. N)typedefsrJ   _resolve_typer   rY   )r   r   r   typedefs       rA   r   r   5  sP     =  >S  $w|   rC   c                     | j         D ]R}|j        j        |u rB|j        j        t          j        u rt          | ||           :t          | |j        ||           SdS )z> Resolve the data types for mapped types based on a template. r   N)	mapped_typesrP   rJ   rY   r   TEMPLATE_resolve_mapped_type_typesr   r\   )r   r   r   mapped_types       rA   r   r   >  s~     ( 6 6!(C//$(===*4iHHHH({/D!6 6 6 66 6rC   c                 B   |j         D ]}t          | |||           |j        m|j         D ]e}||u r n^|j        t          | |j        |j                  }| n7|r4|                    d                    |j        j                              nf|j	        rd|_	        dS )z- Resolve the data types for a class's ctors. Nz4class '{0}' has ctors with the same Python signatureT)
r   _resolve_ctor_typesr   _same_python_signaturer   rM   rN   rP   rQ   r  )r   r   r   r   previous_ctor	sig_states         rA   r   r   J  s      # #D%y999
 #!&   D((E ,824%2D4EG G	 $E MMRYY$)$4$@B BC C C E	  	#"DO9# #rC   c                    |j         D ]x}t          | |j        j        |||           |j        t
          j        u r3|j        t
          j        ur2|                    d	                    |j        j
                             ydS )z, Resolve the data type for a list of casts. z&operator cast '{0}' must be to a classN)r   r  rP   rJ   rY   r   r   rb   rM   rN   rQ   )r   r   r   r   s       rA   r   r   l  s      	; 	;dE,3UD)LLL9)))Yl000MM<CC!,8: :; ; ;	; 	;rC   c                    | j         D ]}|j        D ]y}t          |j        j                  dk    r |j        j        d         }t          |j                  dk    r/|j        r(|j        t          j	        u r|j
        j        |j        u r nz|j        t          j        u r
d| _         dS || j         d         u r dS  t!          t          j	        | ddd          }t!          t          j                  }t%          |g|          }t'          t          j        ||          }| j        rd|_        | j        sd| _        | j                            |           dS )z& Add a default copy ctor if required. r5   r   TN)r   r   r   r   )r   result)r   r   )r  r   r   r   r   r   r   rY   r   rb   r   rP   r   r   rf   cannot_copyr   VOIDr   r   r   r  r   rg   r   )r   r
  r   r   r&  r   s         rA   r[   r[   {  s    Y  	O 	 	D4$)**a//#(+C3:!##(8#8|111cn6OS\Sg6g6gE  O$;;; $EFF 	!$$FF 	 <%%d' ' 'Cl'((FuV444I-I#% % %D     
KtrC   c                 x   |D ]}t          | |j        j        |||           |j        _| j        rX|D ]U}||u r nN|j        |j        ur|j        t          | |j        |j                  }| n|rt          |d||            nVt          |t                    r|j
        rd|_
        |j        rd|_        dS )z1 Resolve the data types for a scope's overloads. Nz7has overloaded functions with the same Python signaturer   T)_resolve_func_typesr   rJ   r   	is_strictr!  r   r   
isinstancer    r  r   )r   r\   r   r   r   previous_overloadr#  s          rA   r   r     s,     $) $)D(/"8%	 	 	 'DN'%.  !$00E$+8?BB$0<24)68MO O	 $E '	U$E3 3 3 3 E	 e\** 	) +&*## )$(!I$) $)rC   c                 N    | j         D ]}|j        |u rt          | ||           dS )z7 Resolve the data types for the variables of a module. N)	variablesrJ   _resolve_variable_type)r   r   r   variables       rA   r   r     s?     N > >?c!!"49===> >rC   c           	         |j         D ]}|j        D ]}|j        D ]}|j        j        |j        u r nt          ||          }|j                            d|           |j        D ]w}|j        |u rld}|j	        rd|_	        |j
        j        | j        u r,||u s|j        t          j        u r|j        rd}d|j        _        t#          | |j
        j        ||           x̌dS )z> Set the list of visible Python member functions for a class. r   FT
need_typesN)r  r   visible_membersr   rI   r   r   r\   r   r   rP   rJ   r   r   	PROTECTEDrh   rl   rk   )r   r   r
  r   visible_memberr   r4  s          rA   ri   ri     sX    Y 8 8	' 	8 	8F
 #("7 8 8!(0FNBBE C "/vy!A!A%,,Q??? ) 3 8 8H&00%*

 $/ 504E- +2dkAAuPYGYGY^f^w  |K  |U  _U  _U  Z_  Zj  _U)-J26FN/9$ % 0 5x+57 7 7 75	88 8rC   c           	         |j         D ]}|j        D ]}d}|j        D ]}|j        j        |j        k    rd}|j        r ngt          | |j        |          rPd|_        d|_        |j	        |j        j	        |_	        |j
        |j        j
        |_
        t          | |||           |rt          | |j        ||           |j        D ])}|j        r |j        s|j        st          | |||           *dS )z. Get all the virtuals for a particular class. TFN)r  virtual_overloadsr\   r   r   is_final_same_cpp_overloadr   is_virtual_reimplementationvirtual_catcher_codevirtual_error_handler_add_virtual_overload)r   r   r   r  virtual_overloadimplicitr   s          rA   rj   rj      si   
 ( (# (#
 * < '	# '	#H!O L L#,59JJJ $ E &d,<,ExPP L*.H';?H8  4<8H8Q8f5  5=9I9R9h6)$%KKK  #%d,<,Eu!# # #M'	#T O D D 	Dx'K 	DT\Te 	D!$%CCCD DrC   c                    |j         j        | j        u rAt          | |||          }d|j        j        _        t          | | j        j        |d           nd}t          ||          }|j        	                    d|           dS )z6 Add an overload to the list of virtuals for a class. Tr3  Nr   )
rP   rJ   _get_virtual_handlerr   rI   rl   rk   r   r9  r   )r   r   r   r   virtual_handlerr@  s         rA   r?  r?  5  s    
 $+--.tXu  (,$ 	*$0@(	! 	! 	! 	! 	!  'xAA	""1&677777rC   c                    |j         rdS |j        j        }|j        }|5|j        D ]}|j        }| n!|j        }||j        D ]}|j        }| ndS | j        D ]}|j        |k    r n+|	                    d
                    |                     dS ||j        ur1|j        dk     r&|j        j        |_        |j        xj        dz  c_        |S )z/ Get the virtual error handler for a function. Nz#unknown virtual error handler '{0}'r   r5   )no_virtual_error_handlerrP   rJ   r>  r  default_virtual_error_handlerrL   virtual_error_handlersr?   rM   rN   
handler_nrnr_virtual_error_handlers)	r   r   r   r   	klass_modhandler_namer
  r   handlers	            rA   _get_virtual_error_handlerrN  M  s9    ( t 'I 1L 	  	 I$:L' ( %BL#$0    C#&#DL#/ 0  4 .  <<''E ( 	5<<\JJ	L 	L 	Lt &&7+=+A+A$^E00A500NrC   c                 r   | j         D ]}t          | ||          r|c S t          |j        |j        |j        t          | |||                    }| j        |_        | xj        dz  c_        |j	        s|j
        t          j        u rd|_        |j        rd|_        | j                             d|           |S )z* Get the virtual handler for an overload. r5   Tr   )virtual_handlers_check_virtual_handlerr   r   r   r=  rN  nr_virtual_handlersrI  factorytransferr   TRANSFER_BACKtransfer_resultabort_on_exceptionr   )r   r   r   r   rM  s        rA   rC  rC    s     (  !$':: 	NNN	 X3X5J)&tXuiHHJ JG 1G! '8,0FFF"&" *%)"  G,,,NrC   c                 B   |j         |j         urdS |j        |j        |j        |j        j        k    rdS |j        s|j        t
          j        u r	|j        sdS |j        |j        urdS t          | |j
        j        |j
        j                  sdS |j
        j        j        |j
        j        j        urdS |j
        j        j        |j
        j        j        urdS t          | |j
        |j
                  sdS t          |j
        j        |j
        j                  D ]'\  }}|j        |j        ur dS |j        |j        ur dS (|j
        |j        u r|j
        |j        u rdS t          | |j        j        |j        j                  sdS t          | |j        |j                  S )zB Return True if a virtual handler is appropriate for an overload. FNT)r=  r>  r?   rS  rT  r   rU  rV  rW  r+   r   r&  
allow_nonedisallow_noner-   zipr   r   is_outr   )r   r   rD  r   arg2s        rA   rQ  rQ    s    $O,PPPu %108H<Z^m  _D  _I  =I  =I5 H-1GGGRaRqGu"/*LLLudH$9$@/B^Beff u#.o6R6Y6dddu#19U9\9jjju$ 57STT u (/4o6R6WXX  
d:TZ''55;dk))55 *  666?;W[j[x;x;xtdH$:$A?C`Cghh u$ 6)+ + +rC   c           	          |j         j        j        }|j        D ]4}|j         t          j        urt          | |j        j        d||d           5d|_	        t          |j        j        |           dS )z9 Resolve the types of a mapped type based on a template. NTallow_defined)rY   r   typesr   r   r  r  rP   rJ   r&  "_iface_files_are_used_by_signaturerl   )r   r  r   template_typestemplate_types        rA   r  r    s     !%06N', B B\%:::$ 6 =t!9DB B B B !N&{'='B    rC   c           	      T   t          | |j        j        |j                   |j        <|j        |j        ur.|j        j        D ]!}t          | |j        j        |||d           "t          |j        j                  D ]\  }}t          | |j        j        |||           |j	        t          j        u r6t          |d||          s7|                    d                    |dz   |j        j                             t!          |j        j        |           t%          | ||           dS )z Resolve the types of a ctor. NTr_  zargument {0} of ctor '{1}' has an unsupported type for a Python signature - provide a valid type, %MethodCode and a C++ signaturer5   )r   rP   rJ   
throw_argsr   r   r   r  	enumeraterY   r   r   _supported_typerM   rN   rQ   r   rl   _scope_default_value)r   r   r   r   r   arg_nrs         rA   r   r     se    4!1!8$/JJJ %$*<DDU*U*U%* 	( 	(C$ 0 7Y"&( ( ( ( ( !!2!788 / /dE,3UCKKK8|(((udC;; 	MM X  _  _"QJ(8(DF FG G G E,13777T5#..../ /rC   c           	         t          | ||j                   |j        |j        ur|j        j        }t          | ||||d           |j        t          j        ust          |j
                  dk    r3|j        r,t          ||||          s|j        t          |d||           |j        j        D ]}t          | ||||d           t!          | ||||           |j        j        }t#          |j        j                  rs| j        dk    rt          j        f}nt          j        t          j        f}|j        |vs&t          |j
                  dk    s|j        s|j        rt          |d||           t3          |j        j                  rL|j        t          j        us&t          |j
                  dk    s|j        s|j        rt          |d	||           t5          |j        j                  rL|j        t          j        us&t          |j
                  dk    s|j        s|j        rt          |d
||           t7          |j        j                  r| j        dk    rt          j        }d}	nt          j        }d}	|j        |us&t          |j
                  dk    s|j        s|j        r*t          |d                    |	          ||           dS dS dS )z" Resolve the types of a function. Tr_  r   NzMhas an unsupported virtual function return type - provide %VirtualCatcherCoder   r9   zmust return a Py_ssize_tzmust return an intzmust return void	Py_hash_tlongzmust return a {0})r   rf  r   r   r&  r  rY   r   r(  r   r   r   rh  r=  r   r   _resolve_py_signature_typesr   r   r   rs   SSIZEINTr   r   r	   r   r   HASHLONGrN   )
r   r   r   r   r   r&  r   required_typesrequired_typerequired_type_names
             rA   r*  r*    sq    4h&9::: X%:::'.dC	NNNNK|000C4F4F!4K4KQYQd4Km|  ~C  EM  OU  W`  na  na4K  fn  fC  fK	cE+ + + + ). 	P 	PC$UC$OOOOO  c5(IFFF")F HO344 +w&&*03NN*0,2BCN;n,,FM0B0Ba0G0G6K^0Gbhbq0G	+EE+ + + + (/122 !;l...#fm2D2D2I2IVM`2Idjds2I	+?! ! ! ! 8?233 !;l///3v}3E3E3J3JfNa3Jeket3J	+=x! ! ! ! 8?233 !w&&(-M!,(-M!';m++s6=/A/AQ/F/F&J]/Fagap/F	'../ABBH! ! ! ! ! !! ! 0G/FrC   c                    |j         j        }|j        t          j        ust          |j                  dk    r|j        t          j	        u rt          |d||           t          | ||||           |j        t          j        u rnVt          ||||          sD|j        |j         u s|j        /t          |d                    | j        rdnd          ||           t%          |j         j                  D ]\  }}t          | ||||           |j        t          j        u r,|j        t          j	        u r<t          ||||          s)t          |d                    |d	z             ||           nmt          ||||d
          sY|j        r)t          |d                    |d	z             ||           t          |d                    |d	z             ||           |t+          | ||           dS )z* Resolve the types of a Python signature. r   z is a signal and must return voidr   NzHhas an unsupported return type - provide %MethodCode and a {0} signatureCzC++z;argument {0} has an unsupported type for a Python signaturer5   T)outputszargument {0} has an unsupported type for a Python signature - provide a valid type, %MethodCode, %VirtualCatcherCode and a C++ signaturezsargument {0} has an unsupported type for a Python signature - provide a valid type, %MethodCode and a C++ signature)r   r&  rY   r   r(  r   r   pyqt_method_specifierr   SIGNALr   r  r   rh  r   r   rN   
c_bindingsrg  r   r   ri  )r   r   r   r   r   r&  rj  r   s           rA   rn  rn  9  s    ")F{,+++s6=/A/AQ/F/F)-@-GGG	+ME+ + + + 	dC	::: ;,+++ &)DD 	/%)>>>(BVB^#Ibii'+ AEC C / / / /
 !!6!;<< 3 3dCY7778|((( )-@-GGG"5(CCC /#IU\\ &
, , / / / /
 !#y$OOO 
	+" /#I c  j  j &
, , / / / /
  	 J  Q  Q"QJ( (E+ + + +
  uc22293 3rC   c                    d}|j         }t          | |j        |j        ||           |t          j        u rdS |j         t          v rt          |j                  dk    rd}n|j         t          v r"|j
        st          |j                  dk    rd}n_|j         t          v r"|j
        st          |j                  dk    rd}n/|j         t          v r!|j
        st          |j                  dk    rd}|rO|j        |j        sA|j        :|j        rd}nd}|                    d                    |j        |                     |j         t          j        ur4|j        -|                    d	                    |j                             |j         t+          |j        j        j        |           nt+          |j        j        |           |j        (|j        #|j        j        sd|_        d|j        _        dS dS dS dS )
z! Resolve the type of a variable. TNr5   Fr    z and %SetCodez3'{0}' has an unsupported type - provide %GetCode{1}z0'{0}' has %AccessCode but isn't a class instance)rY   r  rJ   r   r   r   _CLASS_TYPESr   r   _STRING_TYPESr   _SIMPLE_TYPES_POINTER_TYPESget_code	no_setterset_coderM   rN   rQ   rb   access_coder   rP   rl   is_hidden_namespaceneeds_handlerhas_variable_handlers)r   r1  r   bad_typevariable_typeset_ss         rA   r0  r0    sB    HMM$   )))\))}#$$))H		}	,	, ) 	c-2F.G.G1.L.LH		}	,	,) 	c-2F.G.G1.L.LH		~	-	-) 	c-2F.G.G1.L.LH 2X&.x7I.hN_Ng 	$EE#EELL(%1 1	2 	2 	2 !3338L8XBII(* *	+ 	+ 	+ ~!HN5:MJJJJHO0-@@@ #>%hn.P%%)H"37HN000 $#%%%%rC   Fc                    |j         t          v r|j        rVt          |j                  dk    rt          |           dS t          |j                  dk    r|rt          |           dS nt          |j                  dk    rt          | |||           dS t          |j                  dk    r&|rt          |           nt          | |||           dS t          |j                  dk    r|rt          |           dS nN|j         t          v r|j        r-t          |j                  dk    r|rt          |           dS nt          |j                  dk    rt          | |||           dS t          |j                  dk    r&|rt          |           nt          | |||           dS t          |j                  dk    r|rt          |           dS nu|j         t          v r|j        rH|j
        rt          | |||           dS t          |j                  dk    r|rt          |           dS nt          |j                  dk    rt          | |||           dS t          |j                  dk    r|rt          |           dS n|j         t          v r|j        r,t          |j                  dk    r|rt          |           dS nt          |j                  dk    rt          | |||           dS t          |j                  dk    r|rt          |           dS n'|j         t          j        u rt          | |||           dS dS )z3 See if a type is supported by the generated code. r   Tr5   r   F)rY   r~  r   r   r   _default_input_default_output_ensure_inputr  r  r   r  r   ELLIPSIS)r   r   r   r   rx  s        rA   rh  rh    sw    x< 	3:!##s###t3:!###$$$t__!!%3	:::4__!! ?s####eXsI>>>4__!!g!C   4	]	"	" 	3:!###$$$t__!!%3	:::4__!! ?s####eXsI>>>4__!!g!C   4	]	"	" 	| eXsI>>>t3:!###$$$t__!!%3	:::4__!!g!C   4	^	#	# 	3:!###$$$t__!!%3	:::4__!!g!C   4	\*	*	*eXsI666t 5rC   c                 H    |j         rt          |d||            d|_        dS )z2 Ensure the direction of an argument is an input. z&has an invalid argument type for /Out/r   TN)r\  r   r   )r   r   r   r   s       rA   r  r    s<     z I8(	 	 	 	 CIIIrC   c                 &    | j         s	d| _        dS dS )z3 Default the direction of an argument to an input. TN)r\  r   r   s    rA   r  r  %  s#     : 			 rC   c                 X    | j         s | j        s| j        r	d| _        dS d| _         dS dS dS )zY Default the direction of an argument to an output unless the argument
    is const.
    TN)r\  r   r   r  s    rA   r  r  ,  sK    
 : ci < 	CIIICJJJ	   rC   c                 X    |j         |j         urdS t          | |j        |j                  S )z= Compare two overloads and return True if they are the same. F)r   r-   r   )r   	overload1r   s      rA   r;  r;  8  s9     !333u$	 7#% % %rC   c                    dx}}	 t          ||          \  }}t          ||          \  }}||j        t          j        u rdS ||j        t          j        u rdS |dk     s|dk     rnt	          | ||d          sdS w|dk     o|dk     S )z See if two Python signatures are the same as far as Python is
    concerned.  Return None if any argument's type is unknown.
    r1   TNr   Fr   )_next_significant_argrY   r   r   r+   )r   
signature1
signature2a1a2r   r]  s          rA   r!  r!  C  s    
 LB(R88D(R88D	\-> > >4	\-> > >466R!VV!$d5AAA 	5  6b1frC   c                     |dz  }|t          | j                  k     rP| j        |         }|j        n;|j        t          j        u s|j        r||fS |dz  }|t          | j                  k     PdS )z Return the next significant argument from a Python signature (ie. one
    that is not optional or an output only argument.  Return -1 if there isn't
    one.
    r5   N)r1   N)r   r   r   rY   r   r   r   )r   ar   s      rA   r  r  ]  s     FA
c).!!
!
!nQ(8|(((CI(c6M	Q c).!!
!
! 8rC   c                    |j         dS |j         D ]#}|j        t          j        u r|j        j        r n$dS g }|j         D ]}t          |          }|                    |           |j        t          j        us|j        j        sF|j        j        }|j	        D ]e}| j
        D ]Z}|j        |ur|j        D ]D}	|	j        |k    r7t          |j        j                  }
|
                    |           |
|_         nEY ne ||_         dS )zL Add an explicit scope to the default value of an argument if possible.
    N)r   
value_typer   SCOPEDvalue	is_simpler   r   rR   r  r{   r   r   r   r   rP   rQ   )r   r   r   r  new_default_value	new_valueoriginal_namer
  r   enum_membernew_names              rA   ri  ri  s  sY     "  y///EK4I/E " % %KK	  +++ 9#3335;;P3
 - 	 	I
  :Y..#'<  K"+}<< $.i.B.N#O#O 666*2	  = )CrC   c                 0   |j         t          j        u r|j        }t          j        |_         |j        sy|}|Z|j        j         t          j        u rt          | |||           nt          | |||           |j         t          j        urn	|j        }|Z|j         t          j        urn|j        }t          | |||           |j         t          j        u rE|rt          j        |_         n/|                    d                    |          |j                   dS |j         t          j        u t#          | |           |j         t          j        t          j        t          j        fv rt+          | ||           |j         t          j        u rs| j        D ]k}|j        j         j        j        |j        j        k    rEt3          |j        j         j        j        |j        j        d          rt7          | ||||            nl|| j        u rt;          |           dS dS )z Resolve a type if possible. Nz'{0}' is undefinedr   T)deep)rY   r   DEFINEDr   r   is_absoluterP   r   rb   _search_class_scope_search_scoper   absolute_name_lookuprM   rN   r   $_resolve_instantiated_class_templateSTRUCTr  r  _search_mapped_typesmapped_type_templatesr  r   r"   ra  !_instantiate_mapped_type_templaterJ   _set_needed_type)	r   r   r   rY   r   r`  scoped_nameklass_scopemapped_type_templates	            rA   r  r    sx    )|+
+
+o %	 & 	/K)).-2EEE'k;MMMM!$[$GGG9L$555)/ ) y 111 &.KT3T2229))) >(0		299+FF(,(<  > > > FE )|+
+
+J )t444 y\(,*<l>STTTT3--- 9---(,(B  $'38CLPTP_Phhh  nE  FZ  Ff  Fk  Fv  F|  ~B  ~M  ~S  Z^  n_  n_  n_h5dC0$	C C CE dk rC   c                     | j         t          j        t          j        fv rd| j        j        _        dS | j         t          j        u rd| j        _        dS dS )z* Specify that a generated type is needed. TN)rY   r   rb   MAPPEDr   rP   rw   r   r  s    rA   r  r    sW     xL&(;<<<+/!(((	\&	&	& $ 
'	&rC   c                 h    || j         u r"|"|j        |j        D ]}t          |           dS dS dS dS )z4 Specify that a set of thrown arguments are needed. N)rJ   	arguments_set_needs_exception)r   r   rf  r   s       rA   r   r     s_     dkj49M9Y#- 	, 	,I ++++ 449Y9Y	, 	,rC   c                 H    | j         d| j         j        _        dS d| _        dS )z& Specify that an exception is needed. NT)class_exceptionrP   rw   )r   s    rA   r  r    s/      ,6:	!,333	rC   c                 8   |j         t          j        urdS |j        }|j        }|j        D ]}t          | |           | j        D ]T}|j        K|j        j	        |j	        k    r6t          | |j        j        |          rt          j        |_         ||_         dS UdS )z~ If the type corresponds to a previously instantiated class template
    then replace it with the class that was created.
    N)rY   r   r  r   ra  r   r  rO   templater   r-   rb   )r   rY   r  template_signaturer   r   s         rA   r  r    s    
 y---H!!& 8 8,T37777  >%%.*AXEV*V*V[ijnpup~  qE  GY  \Z  \Z*V$*DI#DOEE	 rC   c                 j   t          |j        j        j        j        |j        j        |j                  }t          | |t          |j                  t          j	        |j
        |          }||_        t          |t          |                    }g |j        _        d|j        _        d|j        _        t#          | t%          |j                            |_        || j        u rd|j        _        |j        }|j        |_        |j        |_        |j        |_        |j        |_        |j        |_        |j        |_        |j        |_        |j        t;          | |j        |          |_        |j        j        }	t?          | |	|j        j         |          |j        _         |j!        tE          | |	|j!        |          |_!        |j#        tE          | |	|j#        |          |_#        |j$        tE          | |	|j$        |          |_$        | j%        &                    d|           tO          ||           dS )z% Instantiate a mapped type template. )declared_names)cpp_typeFTNr   )(r%   r  rY   r   ra  r   r)   r!   r   MAPPED_TYPErM   rJ   r   r   r   r   r   r(   r'   r   rl   handles_noneneeds_user_stateno_assignment_operatorno_copy_ctorno_default_ctor
no_release
pyqt_flags
type_hintsr   rP   r$   type_header_codeconvert_from_type_coder#   convert_to_type_coderelease_coder  r   _replace_template_type)
r   r   r  rY   r   
expansionsrP   r  proto_mapped_typerl   s
             rA   r  r  !  s;    % ,1<BO!/9; ; ;J
 !s!$/22M4MMD* * *J JZd44K K %K$)K!&t_[=M-N-NOOK
dk$(!,80=K#4#EK ):)QK&0=K"3"CK.9K.9K#/!7!,j": ": !&D.B4(9:/G /GK+ /;-:4!8*.F .F* -9+8t!6
,D ,D( %1#0t!.
$< $<  	Q,,,;-----rC   c                 j    |j         D ]*}t          | |||           |j        t          j        ur dS +dS )zL Search for a name in a class scope and resolve the corresponding type.
    N)r  r  rY   r   r   )r   r   r  rY   r
  s        rA   r  r  \  sO     Y  	dI{D9999L---EE . rC   c                     t          |          }|                    |j        j                   t	          | |j        j        ||           dS )zB Search for a name in a scope and resolve the corresponding type. N)r   prependrP   rQ   r  rJ   )r   r   r  rY   fq_names        rA   r  r  g  sI     %%GOOE$0111u'.>>>>>rC   c                    t          | |||           |j        t          j        urdS t	          | ||           |j        t          j        urdS t          | ||           |j        t          j        urdS t          | |||           dS )z3 Look up a name and resole the corresponding type. N)r  rY   r   r   r.   _search_enums_search_classes)r   r   r  rY   s       rA   r  r  q  s     sD+666y)))D+t,,,y)))$T***y)))D#{D11111rC   c                     ||j         }||_         t          j        |_        | j        D ]}t          |j        |          r n|||_         t          j        |_        dS t          ||           dS )z: Search the mapped types for a name and resolve the type. N)r   r   r  rY   r  r,   r   r  )r   r   rY   r  	orig_namer  s         rA   r  r    s     O	% (	( 	 	+*D11 	E	 "'DO$)DI;-----rC   c                    | j         j         t          j        u rd}t          |j        j        j                  D ]\  }}|j        |t          |           } t          | j                   | _         t          | j         j                  | j         _        t          | j         j        j                  | j         j        _        d | j         j        j        j        D             | j         j        j        _        | j         j        j        }|j        |j        |         _        t          j	        |_         | |_        | j
        |_
        dS )z If a mapped type is based on a template then update the type with a
    copy that keeps the original types of the template arguments.
    Nc                 ,    g | ]}t          |          S  r   ).0r   s     rA   
<listcomp>z*_replace_template_type.<locals>.<listcomp>  s0     :@ :@ :@$s)) :@ :@ :@rC   )rY   r   r  rg  r   ra  r   original_typedefr   r  r  )r  rY   	dst_typesrj  r   s        rA   r  r    s-   
  555	$T_%:%?@@ 	K 	KKFC#+  ";//#'(8#9#9 .2;3C3N.O.O +489I9T9Z4[4[ +1:@ :@#(39>:@ :@ :@ +16',7=	696JIN6"33 #DI!DO!,DOOOrC   c                     | |S || S | j         |j         | _         | j        |j        | _        | j        |j        | _        | S )zS Return a TypeHints object that is the merge of another and some
    defaults.
    )hint_inhint_outr   )r  defaultss     rA   _merged_type_hintsr    s]    
 !%-
"&/
'#+#9
 rC   c                 v    | j         D ]0}|j        
|j        |k    rt          j        |_        ||_         dS 1dS )z3 Search the enums for a name and resolve the type. N)r{   rQ   r   r   rY   r   )r   r  rY   r   s       rA   r  r    sV     
  #{**$)DI"DOEE +	 rC   c                     | j         D ]b}|j        r|j        j        |ur|j        j        |k    r:t
          j        |_        ||_        t          |j
        |j
                  |_
         dS cdS )zU Search the classes for one with a particular name and resolve it as a
    type.
    N)rO   externalrP   rJ   rQ   r   rb   rY   r   r  r  )r   r   r  rY   r   s        rA   r  r    s    
    > 	e.5S@@';66$*DI#DO0$& &DO EE 7 rC   c                 z    |j         t          | |j         |           |j        D ]}t          | ||           dS )z9 Make sure all interface files for a signature are used. Nr3  )r&  r   r   )rl   r   r4  r   s       rA   rb  rb    sX     #D)"2zJJJJ~ > >D#*=====> >rC   c                 L   t          ||j        |           |j        |j        urt          ||j        |           | j        dk    s| j        dk    r| j        dk     rdS |j        }|7|j        2|j        D ],}t          ||j                   |rt          |           )dS dS dS )z9 Make sure all interface files for an overload are used. r3  r3   r6   r9   N)	rb  r   r   rs   rf  r  r&   rP   r  )r   rl   r   r4  rf  r   s         rA   rk   rk     s     'tX-B!# # # # X%:::*41G%	' 	' 	' 	' 7""t'77'B'BtGWZaGaGa$J*"6"B#- 	0 	0IdI$8999 0$Y/// "B"B	0 	0rC   c                 V   |j         t          j        t          j        fv r|j        j        }n*|j         t          j        u rt          |j                  }nd}|=t          | |           |j         t          j        u r|j	        D ]}t          | |           |rt          |           dS dS )z If a type has an interface file then add it to the the given list of
    used interface files so that the header file is #included in the generated
    code.
    N)rY   r   rb   r  r   rP   r   _get_iface_file_for_enumr&   rl   r  )rl   r   r4  rP   used_iface_files        rA   r   r     s     xL&(;<<<^.

	\&	&	&-cn==


$
+++
 8|***#-? 9 9!$8888  rC   c                 V    t          |           }|t          |j        |           dS dS )z8 Add an enum's interface file to that used by a module. N)r  r&   rl   )r   r   enum_iface_files      rA   r|   r|   -  s7     /t44O"#(O44444 #"rC   c                 :    | j         | j        | j        j        S dS )zL Return the interface file for an enum, or None if it doesn't have one.
    N)rQ   r   rP   )r   s    rA   r  r  6  s%     #:!:((4rC   c                     | j         D ]k}|j        j        |ur|| j        u s|j        j        rE|j        s>|j                            t          t          j	        ||j        j
                             l| j        D ]_}|j        j        |ur|| j        u s|j        j        r9|j                            t          t          j        ||j
                             `| j        D ]]}|j        |ur|j        || j        u s|j        r9|j                            t          t          j        ||j                             ^|j                            d            d}|j        D ]}|j        t          j	        u rJ||j        j        _        |j        j        dk    r(| j        |                    d           |j        | _        nD|j        t          j        u r||j        j        _        n|j        t          j        u r||j        _        |dz  }dS )	z Create the sorted list of numbered types for a module.  For the main
    module this will be every type defined in the module.  For other modules
    this will be every type needed by the main module.
    )r   r?   Nc                     | j         j         S r=   r>   )ts    rA   rB   z/_create_sorted_numbered_types.<locals>.<lambda>e  s
     rC   rD   r   r2   z/class 'QObject' has been defined more than oncer5   )rO   rP   rJ   rw   r  needed_typesr   r   r   rb   r   r  r  r{   rQ   r   cached_fq_cpp_namesortrY   r   ro   r?   pyqt_qobjectrM   )r   r   r   r   r  r   needed_type_nrneeded_types           rA   rm   rm   A  s     K K"#--$+!1!8, K ''1C#(u/?/H)J )J )J K K K ( H H!(33$+!7!>##H\-@*1E%G %G %G H H H 
 	D 	D;c!!#$+##H\->#$*A%C %C %C D D D 33444N'  |1118FK"-5 $	11$0MMMO O O %0$:!!4448FK"-55!222-;K"*!% rC   c                    | j         D ]}t          | |j                  C|                    d                    | j        j        |j        j        |j                             |j        Xt          | |j                  C|                    d                    | j        j        |j        j        |j                             dS )z& Check that any properties are valid. Nz&property '{0}.{1}' has no getter '{3}'z&property '{0}.{1}' has no setter '{3}')
propertiesr*   getterrM   rN   rI   r?   setter)r   r   props      rA   rq   rq   ~  s       	N 	Nudk**2MM<CC!M.	M MN N N ;"{5$+'F'F'NMM<CC!M.	M MN N N	N 	NrC   c                     ||j         }n|j        j         d|j          }|                     d| d| |j                   dS )z! Log an error about an overload. Nz::'z' r  )r   rP   rQ   rM   r   )r   textr   r   rQ   s        rA   r   r     sm     }')5LL9JLLMM+k++T++$4  6 6 6 6 6rC   r=   )F)r   r   r   instantiationsr   python_slotsr   r	   r
   r   r   r   r   r  r   specificationr   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r    	templatesr!   r"   r#   r$   r%   utilsr&   r'   r(   r)   r*   r+   r,   r-   r.   r   rV   r   LTGELEGTr   NEr   r`   r   rp   rF   r_   r   r   r   r^   rU   r   r   r   r   r[   r   r   ri   rj   r?  rN  rC  rQ  r  r   r*  rn  r  rb   r~  CFLOATFLOATCDOUBLEDOUBLEr   BOOLCBOOLBYTESBYTEUBYTEUSHORTSHORTUINTCINTrp  ULONGrr  	ULONGLONGLONGLONGrq  ro  SIZEPYOBJECTPYTUPLEPYLISTPYDICT
PYCALLABLEPYSLICEPYTYPEPYBUFFERPYENUMCAPSULEr  r  r  r(  r  ASCII_STRINGLATIN1_STRINGUTF8_STRINGSSTRINGUSTRINGSTRINGWSTRINGr  r0  rh  r  r  r  r;  r!  r  ri  r  r  r   r  r  r  r  r  r  r  r  r  r  r  rb  rk   r   r|   r  rm   rq   r   r  rC   rA   <module>r5     s|  2                   3 3 3 3 3 3/ / / / / / / / / / / / / / / / / / % $ $ $ $ $6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6B B B B B B B B B B B B B B) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) )
_ _ _D# # # #L# # #B IH%
IH%
IH%
IH%
IH%
IH%	H H H( ( (V'J 'J 'JT   B7 7 7!% !% !%Hk. k. k.\  "  <B B B BJ  	6 	6 	6# # #D; ; ;- - -`') ') ') ')T> > > 8  8  8F2D 2D 2Dj8 8 80/ / /d  6-+ -+ -+`  $/ / /<<! <! <!~33 33 33n #\%78
3$ 
3l&8 
3,:N 
3
3).
30<0A
3
3(-
3/;/A
3 	
3 )/
3 2>1C
3 		
3 (,	
3 /;.>	
3
 	
3
 )-
3
 0</E
3 	
3  ,0
3 3?2D
3 	
3 (0
3 3?2F
3 	
3 *0
3 3?2I
3 	
3 +1
3 4@3H
3 	
3 *1
3 
3 %|'9<;LM*L,F ,"68L\13
98 98 98xY Y Y Yx    	 	 	% % %  4  ,>* >* >*B; ; ; ;|% % %, , ,       *8. 8. 8.v  ? ? ?2 2 2$. . . ..- - ->  .
 
 
  (> > > >0 0 0 0.   65 5 5  : : :zN N N	6 	6 	6 	6 	6 	6rC   