o
    Ô­jì  ã                   @   sh   d Z ddlZddlmZ ddlZddlZddlZG dd„ dejƒZG dd„ dejƒZ	ej
jdd	„ ƒZdS )
z
Tests which scan for certain occurrences in the code, they may not find
all of these occurrences but should catch almost all.
é    N)ÚPathc                   @   s$   e Zd Zdd„ Zdd„ Zdd„ ZdS )Ú	ParseCallc                 C   s
   g | _ d S ©N)Úls)Úself© r   úV/var/www/html/CropPilot/venv/lib/python3.10/site-packages/numpy/tests/test_warnings.pyÚ__init__   s   
zParseCall.__init__c                 C   s    t j | |¡ | j |j¡ d S r   )ÚastÚNodeVisitorÚgeneric_visitr   ÚappendÚattr©r   Únoder   r   r   Úvisit_Attribute   s   zParseCall.visit_Attributec                 C   s   | j  |j¡ d S r   )r   r   Úidr   r   r   r   Ú
visit_Name   s   zParseCall.visit_NameN)Ú__name__Ú
__module__Ú__qualname__r	   r   r   r   r   r   r   r      s    r   c                       s$   e Zd Z‡ fdd„Zdd„ Z‡  ZS )Ú	FindFuncsc                    s   t ƒ  ¡  || _d S r   )Úsuperr	   Ú_FindFuncs__filename)r   Úfilename©Ú	__class__r   r   r	      s   

zFindFuncs.__init__c                 C   sâ   t ƒ }| |j¡ tj | |¡ |jd dks|jd dkr0|jd jdkr0t	d 
| j|j¡ƒ‚|jd dkrmt|jƒdksE|jd	 d
krod| jkrLd S t|jƒdkrUd S dd„ |jD ƒ}d|v rcd S t	d 
| j|j¡ƒ‚d S d S )NéÿÿÿÿÚsimplefilterÚfilterwarningsr   ÚignorezFwarnings should have an appropriate stacklevel; found in {} on line {}Úwarné   éþÿÿÿÚwarningsztesting/tests/test_warnings.pyé   c                 S   s   h | ]}|j ’qS r   )Úarg)Ú.0Úkwr   r   r   Ú	<setcomp>2   s    z'FindFuncs.visit_Call.<locals>.<setcomp>Ú
stacklevel)r   ÚvisitÚfuncr
   r   r   r   ÚargsÚvalueÚAssertionErrorÚformatr   ÚlinenoÚlenÚkeywords)r   r   Úpr-   r   r   r   Ú
visit_Call   s0   þ
þózFindFuncs.visit_Call)r   r   r   r	   r5   Ú__classcell__r   r   r   r   r      s    r   c               	   C   sš   t tjƒj} |  d¡D ]?}| d |jv rq|| d krq|| d d kr%qt t|ƒ¡�}t	 
| ¡ ¡}t|ƒ |¡ W d   ƒ n1 sEw   Y  qd S )Nz*.pyÚtestingz__init__.pyÚrandom)r   ÚnumpyÚ__file__ÚparentÚrglobÚparentsÚtokenizeÚopenÚstrr
   ÚparseÚreadr   r+   )ÚbaseÚpathÚfileÚtreer   r   r   Útest_warning_calls:   s   þ€÷rG   )Ú__doc__ÚpytestÚpathlibr   r
   r>   r9   r   r   r   ÚmarkÚslowrG   r   r   r   r   Ú<module>   s    "