3
���hu � @ st d Z ddlmZ ddlmZ ddlmZ ddlmZ ddl m
Z
mZmZ e
eegef d�dd �Ze
d
�dd�Zd
S )z;
Boilerplate functions used in defining binary operations.
� )�wraps)�Callable)�item_from_zerodim)�F)�ABCDataFrame�
ABCIndexClass� ABCSeries)�name�returnc s t t d�� fdd�}|S )z�
Boilerplate for pandas conventions in arithmetic and comparison methods.
Parameters
----------
name : str
Returns
-------
decorator
)�methodr
c s
t | � �S )N)�_unpack_zerodim_and_defer)r )r � �8/tmp/pip-build-5_djhm0z/pandas/pandas/core/ops/common.py�wrapper s z)unpack_zerodim_and_defer.<locals>.wrapper)r )r r r
)r r �unpack_zerodim_and_defer
s
r )r c s( |j d�d
k� t��� �fdd ��}|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�ne�lt�le�gt�gec sZ � rt | t�rt |t�rn.x,tttgD ]}t | |�r6P t ||�r&tS q&W t|�}�| |�S )N)�
isinstancer r r �NotImplementedr )�self�other�cls)�is_cmpr r
r �
new_method2 s
z-_unpack_zerodim_and_defer.<locals>.new_method> r r r r r r )�stripr )r r r r
)r r r r s r N)�__doc__� functoolsr Ztypingr Zpandas._libs.libr Zpandas._typingr Zpandas.core.dtypes.genericr r r �strr r r
r
r
r �<module> s |