a
    ߙfb                     @   s   d Z G dd deZdS )z5
A module containing specialized collection classes.
c                       sd   e Zd ZdZg f fdd	Zdd Zdd Z fdd	Z fd
dZ fddZ	 fddZ
  ZS )HomogeneousListz
    A subclass of list that contains only elements of a given type or
    types.  If an item that is not of the specified type is added to
    the list, a `TypeError` is raised.
    c                    s   || _ t   | | dS )z
        Parameters
        ----------
        types : sequence of types
            The types to accept.

        values : sequence, optional
            An initial set of values.
        N)_typessuper__init__extend)selftypesvalues	__class__ 8lib/python3.9/site-packages/astropy/utils/collections.pyr      s    

zHomogeneousList.__init__c                 C   s"   t || jstd| j dd S )Nz4homogeneous list must contain only objects of type '')
isinstancer   	TypeErrorr   xr   r   r   _assert   s    zHomogeneousList._assertc                 C   s   |  | | S N)r   )r   otherr   r   r   __iadd__    s    
zHomogeneousList.__iadd__c                    s@   t |tr(t|}|D ]}| | qn
| | t ||S r   )r   slicelistr   r   __setitem__)r   idxvalueitemr	   r   r   r   $   s    

zHomogeneousList.__setitem__c                    s   |  | t |S r   r   r   appendr   r	   r   r   r   -   s    
zHomogeneousList.appendc                    s   |  | t ||S r   )r   r   insert)r   ir   r	   r   r   r   1   s    
zHomogeneousList.insertc                    s$   |D ]}|  | t | qd S r   r   )r   r   r   r	   r   r   r   5   s    
zHomogeneousList.extend)__name__
__module____qualname____doc__r   r   r   r   r   r   r   __classcell__r   r   r	   r   r      s   	r   N)r#   r   r   r   r   r   r   <module>   s   