
    `Vg                        d Z ddlmZ ddlmZ ddlmZ ddlmZ ddl	m
Z
 ddlmZ ddlmZmZmZ dd	Zdd
Zd Zd Zy)z;
Boilerplate functions used in defining binary operations.
    )annotations)wraps)Callable)item_from_zerodim)is_matching_na)F)ABCDataFrameABCIndex	ABCSeriesc                     d fd}|S )z
    Boilerplate for pandas conventions in arithmetic and comparison methods.

    Parameters
    ----------
    name : str

    Returns
    -------
    decorator
    c                    t        |       S N)_unpack_zerodim_and_defer)methodnames    W/var/www/html/hubwallet-dev/venv/lib/python3.12/site-packages/pandas/core/ops/common.pywrapperz)unpack_zerodim_and_defer.<locals>.wrapper!   s    (66    )r   r   returnr    )r   r   s   ` r   unpack_zerodim_and_deferr      s    7 Nr   c                X     |j                  d      dv t                fd       }|S )aM  
    Boilerplate for pandas conventions in arithmetic and comparison methods.

    Ensure method returns NotImplemented when operating against "senior"
    classes.  Ensure zero-dimensional ndarrays are always unpacked.

    Parameters
    ----------
    method : binary method
    name : str

    Returns
    -------
    method
    __>   eqgegtleltnec                    r!t        | t              rt        |t              rn8t        t        t        fD ]$  }t        | |      r nt        ||      st        c S  t        |      } | |      S r   )
isinstancer
   r   r	   NotImplementedr   )selfotherclsis_cmpr   s      r   
new_methodz-_unpack_zerodim_and_defer.<locals>.new_method9   si     jx0Zy5Q$i: *dC(eS)))	* "%(dE""r   )stripr   )r   r   r'   r&   s   `  @r   r   r   '   s7      ZZ!EEF
6]# #  r   c                f    t        |t        t        f      rt        | |      }|S | j                  }|S )a  
    Find the appropriate name to pin to an operation result.  This result
    should always be either an Index or a Series.

    Parameters
    ----------
    left : {Series, Index}
    right : object

    Returns
    -------
    name : object
        Usually a string
    )r!   r   r
   _maybe_match_namer   )leftrightr   s      r   get_op_result_namer-   M   s6     %)X./ u- K yyKr   c                   t        | d      }t        |d      }|rU|rS	 | j                  |j                  k(  r| j                  S t        | j                  |j                        r| j                  S y|r| j                  S |r|j                  S y# t        $ r1 t        | j                  |j                        r| j                  cY S Y yt        $ r Y yw xY w)a  
    Try to find a name to attach to the result of an operation between
    a and b.  If only one of these has a `name` attribute, return that
    name.  Otherwise return a consensus name if they match or None if
    they have different names.

    Parameters
    ----------
    a : object
    b : object

    Returns
    -------
    name : str or None

    See Also
    --------
    pandas.core.common.consensus_name_attr
    r   N)hasattrr   r   	TypeError
ValueError)aba_hasb_hass       r   r*   r*   c   s    ( AvEAvE	vvvv/vv 
vv	vv  	affaff-vv 		s   $B +B 5CCCN)r   strr   zCallable[[F], F])r   r6   )__doc__
__future__r   	functoolsr   typingr   pandas._libs.libr   pandas._libs.missingr   pandas._typingr   pandas.core.dtypes.genericr	   r
   r   r   r   r-   r*   r   r   r   <module>r?      s=    #   . /  &#L,+r   