
    HR-e                         d dl Z d dlZd dlmZ d dlmZ  G d de          Z G d de          Zg dZ	 G d	 d
          Z
 G d de          ZdS )    N)indent)AstropyUserWarningc                       e Zd ZdZdS )VerifyErrorz!
    Verify exception class.
    N__name__
__module____qualname____doc__     6lib/python3.11/site-packages/astropy/io/fits/verify.pyr   r   
              r   r   c                       e Zd ZdZdS )VerifyWarningz
    Verify warning class.
    Nr   r   r   r   r   r      r   r   r   )ignorewarn	exceptionfix	silentfixz
fix+ignorezfix+warnzfix+exceptionzsilentfix+ignorezsilentfix+warnzsilentfix+exceptionc                   $    e Zd ZdZ	 d	dZd
dZdS )_Verifyz*
    Shared methods for verification.
    r    Fixed.NTc                 T    |}|dv rd}n|sd| }n|r
 |             |d|z   z  }||fS )z@
        Execute the verification with selected option.
        )r   r   FzUnfixable error: z  r   )selfoptionerr_textfix_textr   fixabletexts          r   
run_optionz_Verify.run_option*   s^     ***GG 	$-t--DD D8O#Dr   c                    |                                 }|t          vrt          d|d          |dk    rdS |                     |          }d|v r|                    d          \  }}n|dv r|d}}nd|}}|dk    r|dk    rdS |dk    rd	 }n#|d
k    r|dk    rt          j        d          }nd}d}g }|                    |          D ]\  }	}
|	|	 }|                    |
            |r|	                    dd           |                    d           |dk    r|sdS |dk    s|d
k    r#|s!|D ]}t          j        |t                     dS t          dd                    |          z             dS )a  
        Verify all values in the instance.

        Parameters
        ----------
        option : str
            Output verification option.  Must be one of ``"fix"``,
            ``"silentfix"``, ``"ignore"``, ``"warn"``, or
            ``"exception"``.  May also be any combination of ``"fix"`` or
            ``"silentfix"`` with ``"+ignore"``, ``"+warn"``, or ``"+exception"``
            (e.g. ``"fix+warn"``).  See :ref:`astropy:verify` for more info.
        zOption z not recognized.r   N+)r   r   r   r   c                     | d          S Nr   r   )xs    r   <lambda>z _Verify.verify.<locals>.<lambda>f   s    !H r   r   r   F)filterzVerification reported errors:z0Note: astropy.io.fits uses zero-based indexing.
r   
)lowerVERIFY_OPTIONS
ValueError_verifysplitoperator
itemgetter
iter_linesappendinsertwarningsr   r   r   join)r   r   opterrsfix_opt
report_optline_filter	unfixablemessagesr    messagelines               r   verifyz_Verify.verify>   s    llnnn$$AvAAABBB(??F||C   #::"%))C..GZZ((( #&{ZGG"&ZGk!!jH&<&<Fk!! -,KK*"8"8 #-a00KKK	 ${ C C 	% 	%GW" 'K	OOG$$$$ 
	>OOA>???OOOPPP+%%i%v%%'U*:*:9*:$ 7 7DM$66667 7 "$8)<)<"<===
	> 
	>r   )r   r   r   NT)r   )r   r	   r
   r   r"   r@   r   r   r   r   r   %   sS         
 PT   (B> B> B> B> B> B>r   r   c                   2     e Zd ZdZd	 fd	Zd Zd
dZ xZS )_ErrListz
    Verification errors list class.  It has a nested list structure
    constructed by error messages generated by verifications at
    different class levels.
    r   Elementc                 X    t                                          |           || _        d S )N)super__init__unit)r   valrG   	__class__s      r   rF   z_ErrList.__init__   s&    			r   c                 d    d                     d |                                 D                       S )Nr*   c              3   &   K   | ]}|d          V  dS )   Nr   ).0items     r   	<genexpr>z#_ErrList.__str__.<locals>.<genexpr>   s&      ??Ta??????r   )r6   r2   )r   s    r   __str__z_ErrList.__str__   s-    yy??T__->->??????r   Nr   c              #     K   d}| D ]E}t          |t                    s.| ||          r!|d         t          |d         |          fV  F| D ]}t          |t                    rw|                    ||dz             }	 t	          |          }n# t
          $ r d}Y nw xY w|+| j        r dt          | j         d| d|          fV  |V  |E d{V  |dz  }dS )z
        Iterate the nested structure as a list of strings with appropriate
        indentations for each level of structure.
        r   NrL   )shift)r)   rR    :)
isinstancerB   r   r2   nextStopIterationrG   )r   r)   rR   elementrN   
next_lines
first_lines          r   r2   z_ErrList.iter_lines   s]     
   	@ 	@DdH-- @>VVD\\>q'6$q'#?#?#?????  	 	D$)) !__F%!)_LL
&!%j!1!1JJ$ & & &!%JJJ& )y S #Fdi+D+D'+D+D+DE$R$R$RRRRR$$$$%%%%%%%%1#	 	s   BB B )r   rC   r&   )r   r	   r
   r   rF   rP   r2   __classcell__)rI   s   @r   rB   rB      sm              @ @ @               r   rB   )r0   r5   astropy.utilsr   astropy.utils.exceptionsr   	Exceptionr   r   r,   r   listrB   r   r   r   <module>r`      s                 7 7 7 7 7 7    )       &     [> [> [> [> [> [> [> [>|. . . . .t . . . . .r   