o
    ýÑÐb  ã                   @   s  d Z ddlZddlmZ g d¢ZdZdZdd„ Zdd	„ Zd
d„ Z	dd„ Z
dd„ Zdd„ Zdd„ Zdd„ Zdd„ Zdd„ Zdd„ Zdd„ Zdd„ Zd d!„ Zd"d#„ Zd$d%„ Zd&d'„ Zd(d)„ Zd*d+„ Zd,d-„ Zd.d/„ Zd0d1„ Zd2d3„ Zd4d5„ Zd6d7„ Zd8d9„ Z d:d;„ Z!d<d=„ Z"dS )>z#Errors for invalid sequence indicesé    N)ÚUnknown)é   é   é   Z123c                   C   s   t t S )zlist index is a function)ÚTESTLISTÚid© r   r   úl/var/www/secure340b-portal/env/lib/python3.10/site-packages/pylint/test/functional/invalid_sequence_index.pyÚ	function1   ó   r
   c                   C   ó   t d S )zlist index is NoneN©r   r   r   r   r	   Ú	function2   r   r   c                   C   ó   t tdƒ S )z list index is a float expressionr   )r   Úfloatr   r   r   r	   Ú	function3   ó   r   c                   C   r   )zlist index is a str constantÚ0r   r   r   r   r	   Ú	function4   r   r   c                  C   ó   G dd„ dt ƒ} t| ƒ  S )z'list index does not implement __index__c                   @   ó   e Zd ZdZdS )zfunction5.<locals>.NonIndexTypezClass without __index__ methodN©Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   r   r	   ÚNonIndexType   ó    r   ©Úobjectr   )r   r   r   r	   Ú	function5   ó   
r    c                   C   r   )zTuple index is NoneN©Ú	TESTTUPLEr   r   r   r	   Ú	function6#   r   r$   c                   C   r   )zString index is NoneN©ÚTESTSTRr   r   r   r	   Ú	function7'   r   r'   c                  C   ó   G dd„ dt ƒ} | ƒ d S )z"Index of subclass of tuple is Nonec                   @   r   )zfunction8.<locals>.TupleTestúSubclass of tupleNr   r   r   r   r	   Ú	TupleTest-   r   r*   N©Útuple©r*   r   r   r	   Ú	function8+   ó   
r.   c                   C   r   )zlist index is an int constantr   r   r   r   r   r	   Ú	function93   r   r0   c                   C   r   )z#list index is an integer expressiong        )r   Úintr   r   r   r	   Ú
function107   r   r2   c                   C   s   t tdddƒ S )zlist index is a slicer   r   r   )r   Úslicer   r   r   r	   Ú
function11;   s   r4   c                  C   r   )zlist index implements __index__c                   @   ó   e Zd ZdZdd„ ZdS )zfunction12.<locals>.IndexTypeúClass with __index__ methodc                 S   ó   dS ©z7Allow objects of this class to be used as slice indicesr   r   ©Úselfr   r   r	   Ú	__index__C   ó   z'function12.<locals>.IndexType.__index__N©r   r   r   r   r;   r   r   r   r	   Ú	IndexTypeA   ó    r>   r   )r>   r   r   r	   Ú
function12?   s   
r@   c                  C   s*   G dd„ dt ƒ} G dd„ d| ƒ}t|ƒ  S )z/list index implements __index__ in a superclassc                   @   r5   )zfunction13.<locals>.IndexTyper6   c                 S   r7   r8   r   r9   r   r   r	   r;   M   r<   z'function13.<locals>.IndexType.__index__Nr=   r   r   r   r	   r>   K   r?   r>   c                   @   r   )z function13.<locals>.IndexSubTypezClass with __index__ in parentNr   r   r   r   r	   ÚIndexSubTypeQ   r   rA   r   )r>   rA   r   r   r	   Ú
function13I   ó   
rB   c                   C   r   )zTuple index is an int constantr   r"   r   r   r   r	   Ú
function14W   r   rD   c                   C   r   )zString index is an int constantr   r%   r   r   r   r	   Ú
function15[   r   rE   c                  C   r(   )z-Index of subclass of tuple is an int constantc                   @   r   )zfunction16.<locals>.TupleTestr)   Nr   r   r   r   r	   r*   a   r   r*   r   r+   r-   r   r   r	   Ú
function16_   r/   rF   c                  C   r(   )z:Index of subclass of tuple with custom __getitem__ is Nonec                   @   r5   )zfunction17.<locals>.TupleTestú)Subclass of tuple with custom __getitem__c                 S   r7   ©zAllow non-integer indicesr   r   ©r:   Úindexr   r   r	   Ú__getitem__j   r<   z)function17.<locals>.TupleTest.__getitem__N©r   r   r   r   rK   r   r   r   r	   r*   h   r?   r*   Nr+   r-   r   r   r	   Ú
function17f   s   
rM   c                  C   s*   G dd„ dt ƒ} G dd„ d| ƒ}|ƒ d S )zAIndex of subclass of tuple with __getitem__ in superclass is Nonec                   @   r5   )zfunction18.<locals>.TupleTestrG   c                 S   r7   rH   r   rI   r   r   r	   rK   s   r<   z)function18.<locals>.TupleTest.__getitem__NrL   r   r   r   r	   r*   q   r?   r*   c                   @   r   )z function18.<locals>.SubTupleTestzSubclass of a subclass of tupleNr   r   r   r   r	   ÚSubTupleTestw   r   rN   Nr+   )r*   rN   r   r   r	   Ú
function18o   rC   rO   c                   C   s   dt d< dt d< dS )z!Set with None and integer indicesr   Nr   r   r   r   r	   Ú
function19~   s   rP   c                   C   s   t d= t d= dS )z%Delete with None and integer indiciesNr   r   r   r   r   r	   Ú
function20ƒ   s   
rQ   c                  C   s6   G dd„ dt ƒ} | ƒ }d|d< |d= d|d< |d= dS )z$Set and delete on a subclass of listc                   @   r   )zfunction21.<locals>.ListTestz%Inherit all list get/set/del handlersNr   r   r   r   r	   ÚListTestŠ   r   rR   r   N©Úlist©rR   Útestr   r   r	   Ú
function21ˆ   s   
rW   c                  C   sN   G dd„ dt ƒ} | ƒ }d|d d< |d= d|d d< d|d< d|d< |d= dS )zEGet, set, and delete on a subclass of list that overrides __setitem__c                   @   r5   )zfunction22.<locals>.ListTestz#Override setitem but not get or delc                 S   ó   d S ©Nr   )r:   ÚkeyÚvaluer   r   r	   Ú__setitem__›   ó   z(function22.<locals>.ListTest.__setitem__N)r   r   r   r   r\   r   r   r   r	   rR   ™   r?   rR   r   NrS   rU   r   r   r	   Ú
function22—   s   
r^   c                  C   sN   G dd„ dt ƒ} | ƒ }d|d d< d|d< d|d d< d|d< |d= |d= dS )zEGet, set, and delete on a subclass of list that overrides __delitem__c                   @   r5   )zfunction23.<locals>.ListTestz#Override delitem but not get or setc                 S   rX   rY   r   ©r:   rZ   r   r   r	   Ú__delitem__­   r]   z(function23.<locals>.ListTest.__delitem__N)r   r   r   r   r`   r   r   r   r	   rR   «   r?   rR   r   NrS   rU   r   r   r	   Ú
function23©   s   
ra   c                  C   sN   G dd„ dt ƒ} | ƒ }d|d< |d= d|d d< d|d d< d|d< |d= dS )zEGet, set, and delete on a subclass of list that overrides __getitem__c                   @   r5   )zfunction24.<locals>.ListTestz#Override gelitem but not del or setc                 S   rX   rY   r   r_   r   r   r	   rK   ¿   r]   z(function24.<locals>.ListTest.__getitem__NrL   r   r   r   r	   rR   ½   r?   rR   r   NrS   rU   r   r   r	   Ú
function24»   s   
rb   c                   C   r   )zExtended slice used with a list©.r   r   r   r   r   r	   Ú
function25Î   r   rd   c                  C   r(   )z>Extended slice used with an object that implements __getitem__c                   @   r5   )z function26.<locals>.ExtSliceTestz2Permit extslice syntax by implementing __getitem__c                 S   r7   )Nr   r   rI   r   r   r	   rK   Ö   r]   z,function26.<locals>.ExtSliceTest.__getitem__NrL   r   r   r   r	   ÚExtSliceTestÔ   r?   re   rc   )r   )re   r   r   r	   Ú
function26Ò   r!   rf   c                  C   s<   G dd„ dt ƒ} | d | ƒ t  }| d | ƒ d  }||fS )zIDon't warn in the case where the indexed object has unknown base classes.c                   @   ó   e Zd ZdS )zfunction27.<locals>.UnknownBaseN©r   r   r   r   r   r   r	   ÚUnknownBaseÜ   s    ri   Zaaaarc   )r   r   )ri   ZslicesZ
ext_slicesr   r   r	   Ú
function27Ú   s   rj   c                  C   sT   G dd„ dt ƒ} t | ¡G dd„ dtƒƒ}t | ¡G dd„ dtƒƒ}|d |d  S )z5Don't emit for classes with the right implementation.c                   @   s   e Zd Zdd„ ZdS )zfunction28.<locals>.Metac                 S   r7   )Né   r   )ÚclsÚargr   r   r	   rK   ç   r]   z$function28.<locals>.Meta.__getitem__N)r   r   r   rK   r   r   r   r	   ÚMetaæ   s    rn   c                   @   rg   )zfunction28.<locals>.WorksNrh   r   r   r   r	   ÚWorksê   ó    ro   c                   @   rg   )zfunction28.<locals>.ErrorNrh   r   r   r   r	   ÚErrorî   rp   rq   Zhello)ÚtypeÚsixÚadd_metaclassr   rT   )rn   ro   rq   r   r   r	   Ú
function28ã   s   ru   )#r   rs   Úunknownr   r   r#   r&   r
   r   r   r   r    r$   r'   r.   r0   r2   r4   r@   rB   rD   rE   rF   rM   rO   rP   rQ   rW   r^   ra   rb   rd   rf   rj   ru   r   r   r   r	   Ú<module>   sD    
		