a
    =‹db7  ã                   @   s¶   d Z dZddlmZ ddlmZ G dd„ deƒZdd„ Zed	d
ƒZeddƒZ	eddƒZ
eddƒZeddƒZeddƒZeddƒZeddƒZeddƒZdd„ Zdd„ Zdd „ Zd!d"„ Zd#S )$aå  
signatures.py
=============

A handy API for writing JNI signatures easily

Author: chrisjrn

This module aims to provide a more human-friendly API for
wiring up Java proxy methods in PyJnius.

You can use the signature function to produce JNI method
signautures for methods; passing PyJnius JavaClass classes
as return or argument types; provided here are annotations
representing Java's primitive and array times.

Methods can return just a standard primitive type:

>>> signature(jint, ())
'()I'

>>> s.signature(jvoid, [jint])
'(I)V'

Or you can use autoclass proxies to specify Java classes
for return types.

>>> from jnius import autoclass
>>> String = autoclass("java.lang.String")
>>> signature(String, ())
'()Ljava/lang/String;'

z0.0.1é   )Ú	JavaClass)Újava_methodc                   @   s   e Zd ZdZdS )Ú_JavaSignaturePrimitiveÚ N)Ú__name__Ú
__module__Ú__qualname__Ú_spec© r
   r
   ú</home/tom/ab/renpy-build/tmp/py3/pyjnius/jnius/signatures.pyr   ,   s   r   c                    s$   G ‡ ‡fdd„dt ƒ}dˆ  |_|S )Nc                       s   e Zd Zd”   ” Z”ZdS )z,_MakeSignaturePrimitive.<locals>.__Primitivez$ PyJnius signature for Java %s type N)r   r   r   Ú_namer	   r
   ©ÚnameÚspecr
   r   Ú__Primitive1   s   r   Új)r   r   )r   r   r   r
   r   r   Ú_MakeSignaturePrimitive0   s    
r   ZbooleanÚZZbyteÚBÚcharÚCZdoubleÚDÚfloatÚFÚintÚIZlongÚJZshortÚSZvoidÚVc                 C   s   dt | ƒ }td|ƒS )zR Signature helper for identifying arrays of a given object or
    primitive type. ú[Zarray)Ú_jni_type_specr   )Zof_typer   r
   r
   r   ÚJArrayE   s    r!   c                 C   s   t | |ƒ}t|ƒS )zg Alternative version of @java_method that takes JavaClass
    objects to produce the method signature. )Ú	signaturer   )ÚreturnsÚtakesZsigr
   r
   r   Úwith_signatureM   s    
r%   c                 C   s6   g }|D ]}|  t|ƒ¡ qdd |¡ d t| ƒ S )zi Produces a JNI method signature, taking the provided arguments
    and returning the given return type. ú(r   ú))Úappendr    Újoin)r#   r$   Z	out_takesÚargr
   r
   r   r"   U   s    r"   c                 C   s,   t | tƒrd| j d S t | tƒr(| jS dS )zÕ Produces a JNI type specification string for the given argument.
    If the argument is a jnius.JavaClass, it produces the JNI type spec
    for the class. Signature primitives return their stored type spec.
    ÚLú;N)Ú
issubclassr   Z__javaclass__r   r	   )Zjclassr
   r
   r   r    `   s    

r    N)Ú__doc__Ú__version__r   r   r   Úobjectr   r   ZjbooleanZjbyteZjcharZjdoubleZjfloatZjintZjlongZjshortZjvoidr!   r%   r"   r    r
   r
   r
   r   Ú<module>   s$   "









