o
    Ú­jB  ã                   @   sŒ   d Z ddlmZ ddlmZ ddlmZ ddlmZ er&ddlm	Z	 e	d Z
eG dd	„ d	eƒƒZeeƒZd
d„ eeƒD ƒZdd„ eD ƒZdS )a"  
Scope definition and related utilities.

Those are defined here, instead of in the 'fixtures' module because
their use is spread across many other pytest modules, and centralizing it in 'fixtures'
would cause circular references.

Also this makes the module light to import, as it should.
é    )ÚEnum)Útotal_ordering)ÚOptional)ÚTYPE_CHECKING)ÚLiteral)ÚsessionÚpackageÚmoduleÚclassÚfunctionc                
   @   sš   e Zd ZU dZdZded< dZded< dZded< d	Zded
< dZ	ded< ddd„Z
ddd„Zdd defdd„Ze	ddddedee dd fdd„ƒZdS )ÚScopezì
    Represents one of the possible fixture scopes in pytest.

    Scopes are ordered from lower to higher, that is:

              ->>> higher ->>>

    Function < Class < Module < Package < Session

              <<<- lower  <<<-
    r   Ú
_ScopeNameÚFunctionr
   ÚClassr	   ÚModuler   ÚPackager   ÚSessionÚreturnc                 C   s*   t |  }|dkrt| › d�ƒ‚t|d  S )zReturn the next lower scope.r   z is the lower-most scopeé   )Ú_SCOPE_INDICESÚ
ValueErrorÚ_ALL_SCOPES©ÚselfÚindex© r   úJ/var/www/html/CropPilot/venv/lib/python3.10/site-packages/_pytest/scope.pyÚ
next_lower*   s   zScope.next_lowerc                 C   s2   t |  }|tt ƒd krt| › d�ƒ‚t|d  S )zReturn the next higher scope.r   z is the upper-most scope)r   Úlenr   r   r   r   r   r   Únext_higher1   s   zScope.next_higherÚotherc                 C   s   t |  }t | }||k S ©N)r   )r   r    Ú
self_indexÚother_indexr   r   r   Ú__lt__8   s   zScope.__lt__NÚ
scope_nameÚdescrÚwherec              
   C   sV   ddl m} zt|ƒ}W |S  ty*   |d ||r d|› d�nd|¡dd� Y |S w )	a  
        Given a scope name from the user, return the equivalent Scope enum. Should be used
        whenever we want to convert a user provided scope name to its enum object.

        If the scope name is invalid, construct a user friendly message and call pytest.fail.
        r   )Úfailz'{} {}got an unexpected scope value '{}'zfrom ú Ú F)Úpytrace)Ú_pytest.outcomesr(   r   r   Úformat)Úclsr%   r&   r'   r(   Úscoper   r   r   Ú	from_user=   s   

ùÿüùzScope.from_user)r   r   r!   )Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   Ú__annotations__r   r   r   r   r   r   Úboolr$   ÚclassmethodÚstrr   r0   r   r   r   r   r      s*   
 

ÿÿÿÿþr   c                 C   s   i | ]\}}||“qS r   r   )Ú.0r   r/   r   r   r   Ú
<dictcomp>W   s    r:   c                 C   s   g | ]	}|t jur|‘qS r   )r   r   )r9   Úxr   r   r   Ú
<listcomp>[   s    r<   N)r4   Úenumr   Ú	functoolsr   Útypingr   r   Útyping_extensionsr   r   r   Úlistr   Ú	enumerater   ÚHIGH_SCOPESr   r   r   r   Ú<module>   s    	@