HEX
Server: Apache/2.4.52 (Ubuntu)
System: Linux spn-python 5.15.0-89-generic #99-Ubuntu SMP Mon Oct 30 20:42:41 UTC 2023 x86_64
User: arjun (1000)
PHP: 8.1.2-1ubuntu2.20
Disabled: NONE
Upload Files
File: //home/arjun/projects/env/lib/python3.10/site-packages/_pytest/__pycache__/stash.cpython-310.pyc
o

%we��@s�ddlmZddlmZddlmZddlmZddlmZddlmZddgZed	�Zed
�Z	Gdd�dee�Z
Gdd�d�Zd
S)�)�Any)�cast)�Dict)�Generic)�TypeVar)�Union�Stash�StashKey�T�Dc@seZdZdZdZdS)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rr�F/home/arjun/projects/env/lib/python3.10/site-packages/_pytest/stash.pyr	sc@s�eZdZdZdZddd�Zdeededdfd	d
�Zdeedefdd�Z	deed
e
deee
ffdd�Zdeed
edefdd�Z
deeddfdd�Zdeedefdd�Zdefdd�ZdS)ra/``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�returnNcCs
i|_dS)Nr��selfrrr�__init__Ds
zStash.__init__�key�valuecCs||j|<dS)zSet a value for key.Nr)rrrrrr�__setitem__GszStash.__setitem__cCstt|j|�S)zZGet the value for key.

        Raises ``KeyError`` if the key wasn't set before.
        )rr
r�rrrrr�__getitem__KszStash.__getitem__�defaultcCs"z||WSty|YSw)zNGet the value for key, or return default if the key wasn't set
        before.��KeyError�rrrrrr�getRs

�z	Stash.getcCs*z||WSty|||<|YSw)zmReturn the value of key if already set, otherwise set the value
        of key to default and return default.rr!rrr�
setdefaultZs
�zStash.setdefaultcCs|j|=dS)z]Delete the value for key.

        Raises ``KeyError`` if the key wasn't set before.
        Nrrrrr�__delitem__cszStash.__delitem__cCs
||jvS)zReturn whether key was set.rrrrr�__contains__j�
zStash.__contains__cCs
t|j�S)z)Return how many items exist in the stash.)�lenrrrrr�__len__nr&z
Stash.__len__)rN)r
rrrrrr	r
rrrrr"r#r$�boolr%�intr(rrrrrs&
"	N)�typingrrrrrr�__all__r
rr	rrrrr�<module>s