
    	h                         d dl mZ d dl mZ d dl mZ d dl mZ d dl mZ d dl mZ ddgZ ed	          Z ed
          Z	 G d dee                   Z
 G d d          ZdS )    )Any)cast)Dict)Generic)TypeVar)UnionStashStashKeyTDc                       e Zd ZdZdZdS )r
   z``StashKey`` is an object used as a key to a :class:`Stash`.

    A ``StashKey`` is associated with the type ``T`` of the value of the key.

    A ``StashKey`` is unique and cannot conflict with another key.
     N)__name__
__module____qualname____doc__	__slots__r       Z/var/www/html/web-builder-api.evdpl.com/venv/lib/python3.11/site-packages/_pytest/stash.pyr
   r
      s          IIIr   c                       e Zd ZdZdZddZdee         deddfdZdee         defd	Z	dee         d
e
deee
f         fdZdee         d
edefdZdee         ddfdZdee         defdZdefdZdS )r	   a/  ``Stash`` is a type-safe heterogeneous mutable mapping that
    allows keys and value types to be defined separately from
    where it (the ``Stash``) is created.

    Usually you will be given an object which has a ``Stash``, for example
    :class:`~pytest.Config` or a :class:`~_pytest.nodes.Node`:

    .. code-block:: python

        stash: Stash = some_object.stash

    If a module or plugin wants to store data in this ``Stash``, it creates
    :class:`StashKey`\s for its keys (at the module level):

    .. code-block:: python

        # At the top-level of the module
        some_str_key = StashKey[str]()
        some_bool_key = StashKey[bool]()

    To store information:

    .. code-block:: python

        # Value type must match the key.
        stash[some_str_key] = "value"
        stash[some_bool_key] = True

    To retrieve the information:

    .. code-block:: python

        # The static type of some_str is str.
        some_str = stash[some_str_key]
        # The static type of some_bool is bool.
        some_bool = stash[some_bool_key]
    _storagereturnNc                     i | _         d S )Nr   selfs    r   __init__zStash.__init__D   s    57r   keyvaluec                     || j         |<   dS )zSet a value for key.Nr   )r   r   r   s      r   __setitem__zStash.__setitem__G   s    "cr   c                 B    t          t          | j        |                   S )zZGet the value for key.

        Raises ``KeyError`` if the key wasn't set before.
        )r   r   r   r   r   s     r   __getitem__zStash.__getitem__K   s    
 At}S)***r   defaultc                 8    	 | |         S # t           $ r |cY S w xY w)zNGet the value for key, or return default if the key wasn't set
        before.KeyErrorr   r   r%   s      r   getz	Stash.getR   s5    	9 	 	 	NNN	s   
 c                 B    	 | |         S # t           $ r
 || |<   |cY S w xY w)zmReturn the value of key if already set, otherwise set the value
        of key to default and return default.r'   r)   s      r   
setdefaultzStash.setdefaultZ   s>    	9 	 	 	DINNN	s   
 c                     | j         |= dS )z]Delete the value for key.

        Raises ``KeyError`` if the key wasn't set before.
        Nr   r#   s     r   __delitem__zStash.__delitem__c   s    
 M#r   c                     || j         v S )zReturn whether key was set.r   r#   s     r   __contains__zStash.__contains__j   s    dm##r   c                 *    t          | j                  S )z)Return how many items exist in the stash.)lenr   r   s    r   __len__zStash.__len__n   s    4=!!!r   )r   N)r   r   r   r   r   r   r
   r   r!   r$   r   r   r*   r,   r.   boolr0   intr3   r   r   r   r	   r	      sV       $ $L I8 8 8 8#x{ #1 # # # # #+x{ +q + + + +x{ Q 5A;    hqk A !    x{ t    $ $ $ $ $ $" " " " " " "r   N)typingr   r   r   r   r   r   __all__r   r   r
   r	   r   r   r   <module>r8      s                                       J
 GCLLGCLL    wqz   U" U" U" U" U" U" U" U" U" U"r   