
    IR-e                         d dl Z d dlZd dlZd dlZd dlZddlmZ g dZ ej	        ed          Z
ddZej        d ddfd	ZddZdS )    N   )indent)fixed_width_indentdiff_valuesreport_diff_valueswhere_not_allclose   )width        c                     t          | t                    rXt          |t                    rCt          j        |           rt          j        |          rdS t          j        | |||           S | |k    S )a  
    Diff two scalar values. If both values are floats, they are compared to
    within the given absolute and relative tolerance.

    Parameters
    ----------
    a, b : int, float, str
        Scalar values to compare.

    rtol, atol : float
        Relative and absolute tolerances as accepted by
        :func:`numpy.allclose`.

    Returns
    -------
    is_different : bool
        `True` if they are different, else `False`.

    Frtolatol)
isinstancefloatnpisnanallcloseabr   r   s       2lib/python3.11/site-packages/astropy/utils/diff.pyr   r      sp    ( !U 
1e 4 4 8A;; 	28A;; 	5;q!$T:::::Av    c           
         t          | t          j                  rt          |t          j                  r| j        |j        k    r_|                    t          d|                     t          t          | j                  t          |j                  ||dz              dS t          j        | j	        t          j
                  rJt          j        |j	        t          j
                  r&t          j        t          | |||                    }n*t          j        t          j        | |k                        }|j        d         }|dd         D ]{}|                                }	|                    t          d	|	d
|                     t          | t          |                   |t          |                   ||dz   ||           ||dk    r-|                    t          d|dz
  dd|                     dS |dk    S t!          |           }
t!          |          }|
|k    r`d}d}d}t          | t"          j                  r t'          |           } t'          |          }nKt          |           } t          |          }n+t)          t+          |
j                  t+          |j                            dz   }|dz   dz  }d|
j        z   dz                       |          dz   }d|j        z   dz                       |          dz   }t          | t                    }t          |t                    }|r|r|s)t          | t"          j                  rt'          |           nt          |           } |r|r|s)t          |t"          j                  rt'          |          nt          |          }d}t1          j        |                                 |                                          D ]}|d         dk    rd}||dd         z   }n!|d         dk    rd}||dd         z   }n||z   }|                    t          d                    |                    d                    |                     |S )a}  
    Write a diff report between two values to the specified file-like object.

    Parameters
    ----------
    a, b
        Values to compare. Anything that can be turned into strings
        and compared using :py:mod:`difflib` should work.

    fileobj : object
        File-like object to write to.
        The default is ``sys.stdout``, which writes to terminal.

    indent_width : int
        Character column(s) to indent.

    rtol, atol : float
        Relative and absolute tolerances as accepted by
        :func:`numpy.allclose`.

    Returns
    -------
    identical : bool
        `True` if no diff, else `False`.

    z  Different array shapes:
r   )fileobjindent_widthFr   r   N   z  at z:
)r   r   r   r   z  ...and at dz more indices.
 za>zb>(z) T-+z  {}

)r   r   ndarrayshapewriter   r   str
issubdtypedtypefloating	transposer   wheretolisttupletypenumbersNumberreprmaxlen__name__rjustdifflibndiff
splitlinesformatrstrip)r   r   r   r   r   r   diff_indices	num_diffsidxlidxtypeatypeblnpadsign_asign_bpaddingis_a_stris_b_str	identicallines                       r   r   r   2   s|   6 !RZ   (Z2:%>%> (7agMM"#@,OO   AGAG)A-	    5="+.. 	:2="+3V3V 	:<(:1adQU(V(V(VWWLL<a(8(899L &q)	# 
	 
	C::<<DMM,-@T-@-@-@,OOPPP%**%**)A-     q==MM"D9q=DDDDl   
 5A~GGEGGE~~a(( 	QAQAAAAAAAc%.))3u~+>+>??!C1#&-44W==D&-44W==Da%%a%% "* ! &07>%B%BDGGG
 Q 	
 "* ! &07>%B%BDGGG
 Q 	
 Iallnnallnn== 
 
7c>>IDH$DD!W^^IDH$DD4<Dxt{{4/@/@AA<PP	
 	
 	
 	
 r   h㈵>:0yE>c                    t          j        t          j        |                     s$t           j                            |           j        } t          j        t          j        |                    s$t           j                            |          j        }|dk    r|dk    rt          j        | |k              S t          j        t          j        | |z
            ||t          j        |          z  z   k              S )a  
    A version of :func:`numpy.allclose` that returns the indices
    where the two arrays differ, instead of just a boolean value.

    Parameters
    ----------
    a, b : array-like
        Input arrays to compare.

    rtol, atol : float
        Relative and absolute tolerances as accepted by
        :func:`numpy.allclose`.

    Returns
    -------
    idx : tuple of array
        Indices where the two arrays differ.

    r   )r   allisfinitemafix_invaliddatar,   absr   s       r   r   r      s    , 6"+a..!! &Ea  %6"+a..!! &Ea  %s{{ts{{xQ8BF1q5MMTD26!99,<%<=>>>r   )r   r   )rJ   rK   )r7   	functoolsr0   sysnumpyr   miscr   __all__partialr   r   stdoutr   r    r   r   <module>r[      s          



             'Y&vQ777    8 &)ZacPS z z z zz? ? ? ? ? ?r   