
     j!                    N    d Z ddlmZ ddlZddlmZmZ ddZ	ddZ
ddZddZdS )z
Ops for masked arrays.
    )annotationsN)libmissingleft%bool | np.ndarray | libmissing.NATyperight	left_masknp.ndarray | None
right_maskc                   |t          || ||          S t          | t          j                  st	          d          t          |d           |t          j        u r|                                 }n| |z  }|| |z   }||z   }||z  ||z  z  ||z  z  }nF|du rt          j	        |          }n-|t          j        u r|  | z  |z  }n|                                }||fS )a  
    Boolean ``or`` using Kleene logic.

    Values are NA where we have ``NA | NA`` or ``NA | False``.
    ``NA | True`` is considered True.

    Parameters
    ----------
    left, right : ndarray, NA, or bool
        The values of the array.
    left_mask, right_mask : ndarray, optional
        The masks. Only one of these may be None, which implies that
        the associated `left` or `right` value is a scalar.

    Returns
    -------
    result, mask: ndarray[bool]
        The result of the logical or, and the new mask.
    N1Either `left` or `right` need to be a np.ndarray.ormethodT)
	kleene_or
isinstancenpndarray	TypeErrorraise_for_nan
libmissingNAcopy
zeros_like)r   r   r	   r   result
left_falseright_falsemasks           lC:\Users\Terasoftware\OneDrive\Desktop\faahhh\fyndo\fyndo\venv\Lib\site-packages\pandas/core/ops/mask_ops.pyr   r      s'   8  =j)<<<dBJ'' MKLLL%%%%%
  $i'(

*+*$Y&(:%' 	 D= 	$=++DDjm# 	$EYJ&)3DD >>##D4<    c                t   |t          || ||          S t          | t          j                  st	          d          t          |d           |t          j        u rt          j        |           }n| |z  }|8|t          j        u rt          j	        |          }n|
                                }n||z  }||fS )a'  
    Boolean ``xor`` using Kleene logic.

    This is the same as ``or``, with the following adjustments

    * True, True -> False
    * True, NA   -> NA

    Parameters
    ----------
    left, right : ndarray, NA, or bool
        The values of the array.
    left_mask, right_mask : ndarray, optional
        The masks. Only one of these may be None, which implies that
        the associated `left` or `right` value is a scalar.

    Returns
    -------
    result, mask: ndarray[bool]
        The result of the logical xor, and the new mask.
    Nr   xorr   )
kleene_xorr   r   r   r   r   r   r   r   	ones_liker   )r   r   r	   r   r   r   s         r   r#   r#   L   s    <  >%z9===dBJ'' MKLLL%&&&&
 t$$ &JM! 	$<	**DD>>##DD:%4<r    %bool | libmissing.NAType | np.ndarrayc                   |t          || ||          S t          | t          j                  st	          d          t          |d           |t          j        u rt          j        |           }n| |z  }|8|t          j        u r
| | z  |z  }n9|	                                }|du rd|dd<   n| |z   }||z   }|| z  || z  z  }||fS )a  
    Boolean ``and`` using Kleene logic.

    Values are ``NA`` for ``NA & NA`` or ``True & NA``.

    Parameters
    ----------
    left, right : ndarray, NA, or bool
        The values of the array.
    left_mask, right_mask : ndarray, optional
        The masks. Only one of these may be None, which implies that
        the associated `left` or `right` value is a scalar.

    Returns
    -------
    result, mask: ndarray[bool]
        The result of the logical xor, and the new mask.
    Nr   andr   F)

kleene_andr   r   r   r   r   r   r   r   r   )r   r   r	   r   r   r   r   r   s           r   r(   r(      s   6  >%z9===dBJ'' MKLLL%&&&&
 t$$ GJM! 	 I:%2DD >>##D~  QQQ i'(

*+[L(Z:+-EF4<r    r   strreturnNonec                    t          j        |           r't          j        |           rt	          d| d          d S d S )NzCannot perform logical 'z' with floating NaN)r   is_floatr   isnan
ValueError)valuer   s     r   r   r      sW    
|E Qrx QOFOOOPPPQ Q Q Qr    )r   r   r   r   r	   r
   r   r
   )r   r%   r   r%   r	   r
   r   r
   )r   r)   r*   r+   )__doc__
__future__r   numpyr   pandas._libsr   r   r   r   r#   r(   r    r    r   <module>r6      s     # " " " " "           ; ; ; ;|2 2 2 2j7 7 7 7tQ Q Q Q Q Qr    