
    \
qi                         d dl Zd dlZd dlmZmZ d dlmZ  G d de          Z G d d          Z	 ej
        de	g          d	             ZdS )
    N)	DataFrameSeries)BaseExecutionEnginec                       e Zd ZdZd Zd ZdS )MockExecutionEnginea  
    Execution Engine to test if the execution engine interface receives and
    uses all parameters provided by the user.

    Making this engine work as the default Python engine by calling it, no extra
    functionality is implemented here.

    When testing, this will be called when this engine is provided, and then the
    same pandas.map and pandas.apply function will be called, but without engine,
    executing the default behavior from the python engine.
    c                 \    t          | t                    r|ni } | j        |fd|rdnd i|S )N	na_actionignore)
isinstancer   map)datafuncargskwargs	decoratorskip_nakwargs_to_passs          {/var/www/html/bestrading.cuttalo.com/services/ml-inference/venv/lib/python3.11/site-packages/pandas/tests/apply/conftest.pyr   zMockExecutionEngine.map   sB    #-dI#>#>FBtxXXG(EXXXX    c           	      .   t          | t                    r|                     |d|d          S t          | t                    r | j        |f|dd |dd|S t          | t          j                  sJ d }t	          j         ||          || g|R i |S )NTF)convert_dtyper   by_rowcompat)axisrawresult_typer   r   c                       fd}|S )Nc                  x     | i |}t          |t                    rt          j        |t                    }|S )N)dtype)r   strnparrayobject)r   r   resultr   s      r   wrapperzAMockExecutionEngine.apply.<locals>.wrap_function.<locals>.wrapper.   sC    !T42622F!&#.. @!#&!?!?!?!Mr    )r   r%   s   ` r   wrap_functionz0MockExecutionEngine.apply.<locals>.wrap_function,   s#    " " " " " r   )r   r   applyr   r!   ndarrayapply_along_axis)r   r   r   r   r   r   r'   s          r   r(   zMockExecutionEngine.apply   s    dF## 	Y::d$T%:PPPi(( 	Y4:      dBJ/////   &}}T':':D$XXXXQWXXXr   N)__name__
__module____qualname____doc__r   r(   r&   r   r   r   r      sD        
 
Y Y YY Y Y Y Yr   r   c                       e Zd ZeZdS )MockEngineDecoratorN)r+   r,   r-   r   __pandas_udf__r&   r   r   r0   r0   9   s        (NNNr   r0   )paramsc                     | j         S )N)param)requests    r   enginer6   =   s
    =r   )numpyr!   pytestpandasr   r   pandas.api.executorsr   r   r0   fixturer6   r&   r   r   <module>r<      s                5 4 4 4 4 4+Y +Y +Y +Y +Y- +Y +Y +Y\) ) ) ) ) ) ) ) 12333  43  r   