
    IR-e                     h    d dl mZ d dlmZ d dlmZ d dlmZ ddgZg dZ	d Z
 G d	 de          Zd
S )    )contextmanagerwraps)FunctionType)QTableBaseTimeSeriesautocheck_required_columns)
add_columnadd_columnskeep_columnsremove_columnremove_columnsrename_columnc                     d }t           D ]o}t          | |          r#t          t          | |          t                    st          | d          t          | | |t          | |                               p| S )a  
    This is a decorator that ensures that the table contains specific
    methods indicated by the _required_columns attribute. The aim is to
    decorate all methods that might affect the columns in the table and check
    for consistency after the methods have been run.
    c                 <     t                      fd            }|S )Nc                 H     | g|R i |}|                                   |S )N)_check_required_columns)selfargskwargsresultmethods       7lib/python3.11/site-packages/astropy/timeseries/core.pywrapperzEautocheck_required_columns.<locals>.decorator_method.<locals>.wrapper   s9    VD24222622F((***M    r   )r   r   s   ` r   decorator_methodz4autocheck_required_columns.<locals>.decorator_method   s3    	v	 	 	 	 
	
 r   z is not a valid method)COLUMN_RELATED_METHODShasattr
isinstancegetattrr   
ValueErrorsetattr)clsr   names      r   r	   r	      s       ' A AsD!! 	>GC4F4F)U)U 	><<<===T++GC,>,>??@@@@Jr   c                   6    e Zd ZdZdZdZd Zed             ZdS )r   NTFc                    d }| j         sd S | j        8| j        r"| j        d t          | j                           }n| j        }t          |          dk    rdnd}| j        s@t          | j                  dk    r(t          | j        j         d|d          d| d          | j        d t          |                   |k    rPt          | j        j         d	 ||           d
| d || j        d t          |                                        | j        r5| j        | j        d t          | j                           k    rd| _        d S d S d S d S )Nc                     t          | d          sd|  dS t          |           dk    rd| d          dS t          |           S )N__len__'   r   )r   lenstr)objs    r   as_scalar_or_list_strzEBaseTimeSeries._check_required_columns.<locals>.as_scalar_or_list_str9   sN    3	**  !3zzz!SQ$3q6}}}$3xxr   r*   s r   z object is invalid - expected 'z' as the first columnz but time series has no columnsz object is invalid - expected z as the first columnz but found F)_required_columns_enabled_required_columns_required_columns_relaxr+   colnamesr!   	__class____name__)r   r.   required_columnsplurals       r   r   z&BaseTimeSeries._check_required_columns8   s   	  	  	  - 	F!-+ :#'#9:NC<N<N:N#O  #'#9  011A55SS2F/ C4F4F!4K4K ~. - -)!,- -CI- - -   6%5!6!667;KKK ~. X X--.>??X X$X X .-dm<ScBR>S>S<S.TUUX X   ,5*=!>3t'=#>#>!>?@ @ 05,,,9 .-.5 5@ @r   c              #   V   K   d| _         d V  d| _         |                                  d S )NFT)r1   r   )r   s    r   _delay_required_column_checksz,BaseTimeSeries._delay_required_column_checksb   s7      ).&)-&$$&&&&&r   )	r6   
__module____qualname__r2   r1   r3   r   r   r:    r   r   r   r   .   sS         $ $(5 (5 (5T ' ' ^' ' 'r   N)
contextlibr   	functoolsr   typesr   astropy.tabler   __all__r   r	   r   r=   r   r   <module>rC      s    & % % % % %                        9
:     29' 9' 9' 9' 9'V 9' 9' 9' 9' 9'r   