
    q&i@"                         S SK r SS/rS rS rS rS rS rS	S
.S jrS r " S S\	5      r
 " S S\ R                  5      rg)    NJProxyJImplementsc           	      8   U  H  nUR                   R                  5        Hs  nUR                  5       S-  S:X  a  M  [        UR	                  5       5      U;  d  M;  [        SUR                   R	                  5       < SUR	                  5       < S35      e   M     g )Ni   r   zInterface 'z' requires method 'z' to be implemented.)class_
getMethodsgetModifiersstrgetNameNotImplementedError)
interfaces	overrides	interfacemethods       M/var/www/html/banglarbhumi/venv/lib/python3.13/site-packages/jpype/_jproxy.py_checkInterfaceOverridesr      s    	&&113F""$t+q0v~~'(I5)$$,,.0@+B C C	 4      c                     0 nU R                   R                  5        H!  u  p# [        R                  US5      nX44X'   M#     U$ ! [         a     M4  f = f)N__joverride__)__dict__itemsobject__getattribute__AttributeError)clsr   kvattrs        r   _classOverridesr   %   s\    I""$	**1o>D9IL %   		s   A
AAc                 H    [        U5      n[        U 5      n[        X#5        U$ N)_convertInterfacesr   r   )r   intf
actualIntfr   s       r   _prepareInterfacesr$   1   s$    #D)J$IZ3r   c                    ^ ^ [        T [        5      (       d  [        S[        T 5      -  5      eU U4S jnSU0n[        ST R                  -  T [        R
                  4U5      $ )zt(internal) Create a proxy from a Python class with
@JOverride notation on methods evaluated at first
instantiation.
)JImplements only applies to types, not %sc                    > [        U SS 5      nUc  [        TT5      nX0l        [        R                  R                  U S S U5      $ )N__jpype_interfaces__)getattrr$   r(   _jpype_JProxy__new__)tpargskwargsr#   r   r"   s       r   new"_createJProxyDeferred.<locals>.newB   sG     R!7>
+C6J&0#~~%%b$jAAr   r,   proxy.%s)
isinstancetype	TypeError__name__r*   r+   )r   r"   r0   memberss   ``  r   _createJProxyDeferredr8   9   s`    
 c4  749EG 	GB #G
S\\)C+@'JJr   c                    ^ [        U [        5      (       d  [        S[        U 5      -  5      e[        X5      mU4S jnSU0n[        SU R                  -  U [
        R                  4U5      $ )zl(internal) Create a proxy from a Python class with
@JOverride notation on methods evaluated at declaration.
r&   c                 x   > [         R                  R                  U S S T5      nU R                  " U/UQ70 UD6  U$ r    )r*   r+   r,   __init__)r-   r.   r/   selfr#   s       r   r0   _createJProxy.<locals>.newZ   s8    ~~%%b$jA
D*4*6*r   r,   r2   )r3   r4   r5   r$   r6   r*   r+   )r   r"   r0   r7   r#   s       @r   _createJProxyr>   P   sk     c4  749EG 	G $C.J
 #G
S\\)C+@'JJr   F)deferredc                 8   ^^ U (       a	  UU4S jnU$ UU4S jnU$ )a  Annotation for creating a new proxy that implements one or more
Java interfaces.

This annotation is placed on an ordinary Python class.  The annotation
requires a list of interfaces.  It must implement all of the java
methods for each of the interfaces.  Each implemented method
should have a @JOverride annotation.  The JVM must be running in
order to validate the class.

Args:
  interfaces (str*,JClass*): Strings or JClasses for each Java interface
    this proxy is to implement.

Kwargs:
  deferred (bool):
    Whether to defer validation of the interfaces and overrides until
    the first instance instantiation (True) or validate at declaration
    (False). Deferred validation allows a proxy class to be declared prior
    to starting the JVM.  Validation only occurs once per proxy class,
    thus there is no performance penalty.  Default False.

Example:

  .. code-block:: python

      @JImplement("java.lang.Runnable")
      class MyImpl(object):
         @JOverride
         def run(self, arg):
           pass

      @JImplement("org.my.Interface1", "org.my.Interface2")
      class MyImpl(object):
         @JOverride
         def method(self, arg):
           pass

c                 "   > [        U /TQ70 TD6$ r    )r8   r   r   r/   s    r   JProxyCreator"JImplements.<locals>.JProxyCreator   s    (DzDVDDr   c                 "   > [        U /TQ70 TD6$ r    )r>   rB   s    r   rC   rD      s     <z<V<<r    )r?   r   r/   rC   s    `` r   r   r   d   s"    N 	E
 	=r   c                 
   / nU  H  n[        U[        R                  5      (       a  UR                  U5        M5  [        U[        5      (       d  [        US5      (       d  UR                  U5        Mn  UR                  U5        M     [        5       nU HP  n[        U[        5      (       a'  UR                  [        R                  " U5      5        M?  UR                  U5        MR     U(       d  [        S5      eU Hz  n[        U[        R                  5      (       d!  [        S[        U5      R                  -  5      e[        U[        R                  5      (       a  Md  [        SUR                  -  5      e   [        U5      $ )z](internal) Convert a list of interface names into
a list of interfaces suitable for a proxy.
__iter__z-At least one Java interface must be specifiedz'%s' is not a Java interface)r3   r*   JClassappendr	   hasattrextendsetaddr5   r4   r6   
issubclass
JInterfacetuple)r"   intflistitemr#   r   s        r   r!   r!      s'   
 HdFMM**OOD!c""'$
*C*COOD!OOD!  JdC  NN6==./NN4 	  GHH#v}}--: I../ 0 0 #v0011:S\\IJJ  r   c                        \ rS rSrS rS rSrg)
_JFromDict   c                     Xl         g r    dict)r<   rY   s     r   r;   _JFromDict.__init__   s    	r   c                 l     [         R                  U S5      U   $ ! [         a     Of = f[        S5      e)NrY   zattribute not found)r   r   KeyErrorr   )r<   names     r   r   _JFromDict.__getattribute__   s=    	**48>> 		233s    
((rX   N)r6   
__module____qualname____firstlineno__r;   r   __static_attributes__rF   r   r   rU   rU      s    4r   rU   c                   2    \ rS rSrSrSS jr\S 5       rSrg)r      aP  Define a proxy for a Java interface.

This is an older style JPype proxy interface that uses either a
dictionary or an object instance to implement methods defined
in Java.  The Python object can be held by Java and its lifespan
will continue as long as java holds a reference to the object
instance.  New code should use ``@JImplements`` annotation as
it will support improved type safety and error handling.

Name lookups can either made using a dictionary or an object
instance.  One of these two options must be specified.

Args:
    intf: either a single interface or a list of java interfaces.
        The interfaces can either be defined by strings or
        JClass instance.  Only interfaces may be used in a
        proxy,
    dict (dict[string, callable], optional): specifies a dictionary
        containing the methods to be called when executing the
        Java interface methods.
    inst (object, optional): specifies an object with methods
        whose names matches the Java interfaces methods.
    convert (bool, optional): if True the proxy is unwrapped
        to a Python object.
Nc                     [        U/5      nUb!  [        R                  " U[        U5      XT5      $ Ub!  [        R                  R	                  XX5U5      $ [        S5      e)Nz a dict or inst must be specified)r!   r*   r+   rU   r,   r5   )r   r"   rY   instconvertr#   s         r   r,   JProxy.__new__   s[    '/

 >>$
4(8*NN >>))#TwOO:;;r   c                 \    [        U [        R                  5      (       d  U $ U R                  $ r    )r3   r*   r+   __javainst__)objs    r   unwrapJProxy.unwrap   s$    #v~~..Jr   rF   )NNF)	r6   r_   r`   ra   __doc__r,   staticmethodrl   rb   rF   r   r   r   r      s     2<"    r   )r*   __all__r   r   r$   r8   r>   r   r!   r   rU   r+   r   rF   r   r   <module>rq      s]   $ ]
#C	K.K( ', -`#L	4 	4/ V^^ / r   