
    Pi                        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mZmZ ddlmZmZ erdd	lmZ dd
lmZ ddZddZd Zd ZdS )z;
Boilerplate functions used in defining binary operations.
    )annotations)wraps)TYPE_CHECKING)item_from_zerodim)is_matching_na)ABCExtensionArrayABCIndex	ABCSeries)ensure_wrapped_if_datetimelikesanitize_array)Callable)FnamestrreturnCallable[[F], F]c                     d fd}|S )z
    Boilerplate for pandas conventions in arithmetic and comparison methods.

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

    Returns
    -------
    decorator
    methodr   r   c                $    t          |           S )N)_unpack_zerodim_and_defer)r   r   s    j/home/jaya/work/projects/VOICE-AGENT/VIET/agent-env/lib/python3.11/site-packages/pandas/core/ops/common.pywrapperz)unpack_zerodim_and_defer.<locals>.wrapper+   s    (666    )r   r   r   r    )r   r   s   ` r   unpack_zerodim_and_deferr      s(    7 7 7 7 7 7 Nr   r   r   c                n     |                     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
    _)orxorandrorrxorrandc                   t          |dd           }||| j        k    rt          S t          |          }t	          | t
                    r6t	          |t                    r!st          |d           }t          |          } | |          S )N__pandas_priority__)	getattrr%   NotImplementedr   
isinstancer   listr   r   )selfotherprio
is_logicalr   s      r   
new_methodz-_unpack_zerodim_and_defer.<locals>.new_methodC   s    u3T::d...%%!%((t.//	:5$''	: 	: #5$//E2599EvdE"""r   )stripr   )r   r   r.   r-   s   `  @r   r   r   1   sQ      C$OOJ
6]]# # # # # ]#* r   c                n    t          |t          t          f          rt          | |          }n| 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_namer4   \   s8     %)X.//  u--yKr   c                h   t          | d          }t          |d          }|r}|r{	 | j        |j        k    r| j        S t          | j        |j                  r| j        S dS # t          $ r' t          | j        |j                  r	| j        cY S Y dS t          $ r Y dS w xY w|r| j        S |r|j        S dS )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   r1   r1   r   s    ( AvEAvE  	vv// vt 	 	 	afaf-- v44 	 	 	44	 
 v	 v4s   A   A   +B	BBN)r   r   r   r   )r   r   r   r   r   r   )__doc__
__future__r   	functoolsr   typingr   pandas._libs.libr   pandas._libs.missingr   pandas.core.dtypes.genericr   r	   r
   pandas.core.constructionr   r   collections.abcr   pandas._typingr   r   r   r4   r1   r   r   r   <module>rG      sD    # " " " " "                   . . . . . . / / / / / /                
  !((((((         &( ( ( (V  ,+ + + + +r   