U
    e»{jä  ã                   @   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__© úX/var/www/html/bwave/python/venv/lib/python3.8/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   3   s    
zHomogeneousList.insertc                    s$   |D ]}|   |¡ tƒ  |¡ qd S r   r   )r   r   r   r	   r   r   r   7   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   