HEX
Server: Apache
System: Linux 185.122.168.184.host.secureserver.net 5.14.0-570.60.1.el9_6.x86_64 #1 SMP PREEMPT_DYNAMIC Wed Nov 5 05:00:59 EST 2025 x86_64
User: barbeatleanalyti (1024)
PHP: 8.1.33
Disabled: NONE
Upload Files
File: //usr/lib/fm-agent/dependencies/linux/python3.9/jpype/__pycache__/_jcustomizer.cpython-39.pyc
a

��iU(�@s�ddlZddgZeeeefZddd�Zddd�Zdd�Z	d	d
�Z
dd�Zd
d�ZGdd�dej
�Zdd�Zie_ed��e�ed��e�dS)�N�JImplementationFor�JConversioncs2t|��|dur��|�d����fdd�	}|S)a� Decorator to define a method as a converted a Java type.

    Whenever a method resolution is called the JPype internal rules
    are applied, but this may be insufficient.  If only a
    single method requires modification then a class customizer can
    be applied.  But if many interfaces require the same conversion
    than a user conversion may be a better option.

    To add a user conversion define a method which take the requested
    Java type as the first argument, the target object to be converted
    as the second argument and returns a Java object or Java proxy that
    matches the required type.  If the type is not a Java type then
    a TypeError will be raised.  This method is only evaluated
    after the match has been determine prior to calling.

    Care should be used when defining a user conversion. If example
    if one has an interface that requires a specific class and you
    want it to take a Python string, then a user conversion can
    do that.  On the other hand, if you define a generic converter
    of any Python object to a Java string, then every interface
    will attempt to call the conversion method whenever a Java string
    is being matched, which can cause many methods to potentially
    become ambiguous.

    Conversion are not inherited. If the same converter needs to
    apply to multiple types, then multiple decorators can
    be applied to the same method.

    Args:
      cls(str, JClass): The class that will be produced by this
        conversion.
      exact(type): This conversion applies only to objects that have
        a type exactly equal to the argument.
      instanceof(type or protocol): This conversion applies to 
        any object that passes isinstance(obj, type).
      attribute(str): This conversion applies to any object that has
        passes hasattr(obj, arg). (deprecated)
      excludes(type): Prevents a conversion for a specified type.
        Can be used to prevent a specific type from being converted.
        For example, to prevent maps or strings from passing 
        a check for Sequence.  Exclusions are applied before all 
        other user specificied conversions.
    NcsD�dur���|d��dur,���|d��dur@���|�|S)NTF)�_addTypeConversion�_addAttributeConversion)�func��	attribute�exact�hints�
instanceof��D/usr/lib/fm-agent/dependencies/linux/python3.9/jpype/_jcustomizer.py�
customizerJszJConversion.<locals>.customizer)N)�
getClassHints�_excludeConversion)�clsr	rrZexcludesrrrr
rs
,
Fcs$t�t�std����fdd�}|S)ag Decorator to define an implementation for a class.

    Applies to a class which will serve as a prototype as for the Java class
    wrapper.  If it is registered as a base class, then the class must
    derive from JObject.  Otherwise, the methods are copied from
    the prototype to the Java class wrapper.

    The method ``__jclass_init__(cls)`` will be called with the constructed
    class as the argument.  This call is used to set methods for all classes
    that derive from the specified class.  Use ``jclass._customize()`` to
    alter the class methods.

    Using the prototype class as a base class is used mainly to support
    classes which must be derived from a Python type by design.  Use
    of a base class will produce a RuntimeError if the class has already
    been created.

    For non-base class customizers, the customizer will be applied
    retroactively if the class is already created.  Conflicts are
    resolved by the last customizer applied.

    Args:
      clsname (str): name of java class.
      base (bool, optional): if True this will be a base class.
        Default is False.

    z2ImplementationFor requires a java classname stringcs(t��}�r|�|�n|��|�|S�N)r�registerClassBase�registerClassImplementation)rr
��base�clsnamerr
rts
z&JImplementationFor.<locals>.customizer)�
isinstance�str�	TypeError)rrrrrr
rUs
cCsR|D]H}t|d�}|�dd�}|j}|r@t�||�}|�||�|�||�qdS)N�
__joverride__�rename)�getattr�get�__name__�type�__getattribute__�
_customize)r�sticky�method�attrr�name�origrrr
�_applyStickyMethods~s
r(cCs�|j��D]�\}}t|�s$t|t�r
t|dd�}|dur�|�dd�rP|�|�q
|�dd|�}||vr�t||tj	tj
f�r�||||�|||�q
dS)a (internal) Apply a customizer to a class.

    This "borrows" methods from a prototype class.
    Current behavior is:
     - Copy any string or property.
     - Copy any callable applying @JOverride
       if applicable with conflict renaming.
     - Copy __new__ method.

    rNr#Fr�_)�__dict__�items�callabler�
_jcopymembersrr�append�_jpype�_JField�_JMethod)�members�protor#�setter�p�vr%rrrr
�_applyCustomizerImpl�s
r7cCsJt�}|g}|rF|�d�}||vr$q|�|���|�|�||�qdS)Nr)�set�pop�extend�__subclasses__�add)rr$ZappliedZtodo�crrr
�	_applyAll�s

r>csrg�t�j|��fdd��t��dkrP|j�dd����fdd�}��d|�d|jvrn|jd�t���dS)z8 (internal) Customize a class after it has been created cs��||�Sr)r"�r5r6�rrr
�<lambda>��z&_applyCustomizerPost.<locals>.<lambda>r�__jclass_init__Ncs�r�|�t|��dSr�r(r@�r$r#rr
�init�sz"_applyCustomizerPost.<locals>.init)r7r*�lenrr"r>)rr3rFr)rr$r#r
�_applyCustomizerPost�s

�

rHc@s8eZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�ZdS)
�JClassHintszt ClassHints holds class customizers and conversions.

    These items can be defined before the JVM is created.
    cCsg|_g|_d|_dS)NF)�bases�implementations�instantiated)�selfrrr
�__init__�szJClassHints.__init__cCs|j�|�|jrtd��dS)zx (internal) Add an implementation for a class

        Use @JImplementationFor(cls, base=True) to access this.

        z2Base classes must be added before class is createdN)rJr.rLr)rMrrrr
r�s
�zJClassHints.registerClassBasecCs&|j�|�|jr"tt�|�|�dS)zl (internal) Add an implementation for a class

        Use @JImplementationFor(cls) to access this.
        N)rKr.rLrHr/�JClass)rMZ	classnamer3rrr
r�sz'JClassHints.registerClassImplementationcs�|jD]}|�d|�q|�dd�}t|�dkr<|d�d<g�|jD]}t�|��fdd��qFt��dkr���dd	����fd
d�}|�d<d	S)zK (internal) Called by JClass and JArray to customize a newly created class.r�.���
__module__cs��||�Sr)�__setitem__r?)r2rr
rA�rBz.JClassHints.applyCustomizers.<locals>.<lambda>rCNcs�dur�|�t|��dSrrDr@rErr
rF�sz*JClassHints.applyCustomizers.<locals>.init)rJ�insert�rsplitrGrKr7r)rMr&rJr2�b�moduler3rFr)r2r$r#r
�applyCustomizers�s


�zJClassHints.applyCustomizerscCsRd|_t|d�rNg}|jD] }d|jvr|�d|jd�q|D]}||�q@dS)zy (internal) Called after the class is created to apply any customizations
        required by inherited parents.
        TrCrN)rL�hasattr�__mro__r*rU)rMrrFrrrrr
�applyInitializers


zJClassHints.applyInitializerN)	rrS�__qualname__�__doc__rNrrrYr\rrrr
rI�srIcCs8t|tj�r|j}tj�|d�}|s4t�}|tj|<|Sr)rr/�_JClassr�_hintsrrI)r&r
rrr
rs
rz#java.lang.IndexOutOfBoundsExceptionzjava.lang.NullPointerException)NNNN)F)r/�__all__r�property�staticmethod�classmethodr-rrr(r7r>rH�_JClassHintsrIrr`r�
IndexError�
ValueErrorrrrr
�<module>s"
;
)K
��