U
    cu                     @  sN   d Z ddlmZ ddlmZmZ ddlmZ ddlm	Z	 G dd dee
ZdS )	zj
frozen (immutable) data structures to support MultiIndexing

These are used for:

- .names (FrozenList)

    )annotations)AnyNoReturn)PandasObjectpprint_thingc                      s   e Zd ZdZd d fddZd dddZe ZZ fddZd	d
 Z	ddd fddZ
e
Z fddZeZdd ZddddZddddZddddZddddZe ZZe ZZe Z ZZe Z ZZ  ZS )
FrozenListz
    Container that doesn't allow setting item *but*
    because it's technically hashable, will be used
    for lookups, appropriately, etc.
    )returnc                   s&   t |trt|}t| t |S )aF  
        Returns a FrozenList with other concatenated to the end of self.

        Parameters
        ----------
        other : array-like
            The array-like whose elements we are concatenating.

        Returns
        -------
        FrozenList
            The collection difference between self and other.
        )
isinstancetuplelisttypesuper__add__selfother	__class__ >/tmp/pip-unpacked-wheel-g7fro6k3/pandas/core/indexes/frozen.pyunion   s    
zFrozenList.unionc                   s&   t    fdd| D }t| |S )aF  
        Returns a FrozenList with elements from other removed from self.

        Parameters
        ----------
        other : array-like
            The array-like whose elements we are removing self.

        Returns
        -------
        FrozenList
            The collection difference between self and other.
        c                   s   g | ]}| kr|qS r   r   ).0xr   r   r   
<listcomp>@   s      z)FrozenList.difference.<locals>.<listcomp>)setr   )r   r   tempr   r   r   
difference1   s    zFrozenList.differencec                   s*   t |trt| t |S t |S N)r
   slicer   r   __getitem__)r   nr   r   r   r!   F   s    
zFrozenList.__getitem__c                 C  s&   t |trt|}t| |t|  S r   )r
   r   r   r   r   r   r   r   __radd__K   s    
zFrozenList.__radd__r   bool)r   r	   c                   s"   t |ttfrt|}t |S r   )r
   r   r   r   r   __eq__r   r   r   r   r%   P   s    zFrozenList.__eq__c                   s   t | t |S r   )r   r   __mul__r   r   r   r   r&   W   s    zFrozenList.__mul__c                 C  s   t | t| ffS r   )r   r   r   r   r   r   
__reduce__\   s    zFrozenList.__reduce__intc                 C  s   t t| S r   )hashr   r'   r   r   r   __hash__`   s    zFrozenList.__hash__r   c                 O  s   t dt| j ddS )zL
        This method will not function because object is immutable.
        'z&' does not support mutable operations.N)	TypeErrorr   __name__)r   argskwargsr   r   r   	_disabledc   s    zFrozenList._disabledstrc                 C  s   t | dddS )NT)	
)Zquote_stringsZescape_charsr   r'   r   r   r   __str__i   s    zFrozenList.__str__c                 C  s   t | j dt|  dS )N())r   r.   r2   r'   r   r   r   __repr__l   s    zFrozenList.__repr__)r.   
__module____qualname____doc__r   r   r   __iadd__r!   r#   r%   __req__r&   __imul__r(   r+   r1   r6   r9   __setitem__Z__setslice____delitem__Z__delslice__popappendextendremovesortinsert__classcell__r   r   r   r   r      s&   	r   N)r<   
__future__r   typingr   r   Zpandas.core.baser   Zpandas.io.formats.printingr   r   r   r   r   r   r   <module>   s
   