/
usr
/
lib
/
imh-dnskeyapi
/
venv
/
lib
/
python3.13
/
site-packages
/
_pytest
/
/usr/lib/imh-dnskeyapi/venv/lib/python3.13/site-packages/_pytest
mkdir
upload
Name
Size
Mode
Actions
assertion/
-
0755
rm
config/
-
0755
rm
mark/
-
0755
rm
_code/
-
0755
rm
_io/
-
0755
rm
_py/
-
0755
rm
cacheprovider.py
22373
0644
edit
dl
rm
capture.py
35330
0644
edit
dl
rm
compat.py
11467
0644
edit
dl
rm
debugging.py
13260
0644
edit
dl
rm
deprecated.py
3147
0644
edit
dl
rm
doctest.py
26255
0644
edit
dl
rm
faulthandler.py
3674
0644
edit
dl
rm
fixtures.py
73550
0644
edit
dl
rm
freeze_support.py
1291
0644
edit
dl
rm
helpconfig.py
8895
0644
edit
dl
rm
hookspec.py
42831
0644
edit
dl
rm
junitxml.py
25574
0644
edit
dl
rm
legacypath.py
16588
0644
edit
dl
rm
logging.py
35124
0644
edit
dl
rm
main.py
37416
0644
edit
dl
rm
monkeypatch.py
14598
0644
edit
dl
rm
nodes.py
26483
0644
edit
dl
rm
outcomes.py
10532
0644
edit
dl
rm
pastebin.py
3978
0644
edit
dl
rm
pathlib.py
37569
0644
edit
dl
rm
py.typed
0
0644
edit
dl
rm
pytester.py
61552
0644
edit
dl
rm
pytester_assertions.py
2244
0644
edit
dl
rm
python.py
64851
0644
edit
dl
rm
python_api.py
40122
0644
edit
dl
rm
python_path.py
745
0644
edit
dl
rm
recwarn.py
13227
0644
edit
dl
rm
reports.py
21331
0644
edit
dl
rm
runner.py
19436
0644
edit
dl
rm
scope.py
2798
0644
edit
dl
rm
setuponly.py
3306
0644
edit
dl
rm
setupplan.py
1184
0644
edit
dl
rm
skipping.py
10217
0644
edit
dl
rm
stash.py
3090
0644
edit
dl
rm
stepwise.py
4596
0644
edit
dl
rm
terminal.py
57393
0644
edit
dl
rm
threadexception.py
3005
0644
edit
dl
rm
timing.py
413
0644
edit
dl
rm
tmpdir.py
11375
0644
edit
dl
rm
unittest.py
15614
0644
edit
dl
rm
unraisableexception.py
3252
0644
edit
dl
rm
warnings.py
5211
0644
edit
dl
rm
warning_types.py
4388
0644
edit
dl
rm
_argcomplete.py
3776
0644
edit
dl
rm
_version.py
511
0644
edit
dl
rm
__init__.py
391
0644
edit
dl
rm
Edit:
/usr/lib/imh-dnskeyapi/venv/lib/python3.13/site-packages/_pytest/stash.py
(3090B)
from __future__ import annotations from typing import Any from typing import cast from typing import Generic from typing import TypeVar __all__ = ["Stash", "StashKey"] T = TypeVar("T") D = TypeVar("D") class StashKey(Generic[T]): """``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. .. versionadded:: 7.0 """ __slots__ = () class Stash: r"""``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] .. versionadded:: 7.0 """ __slots__ = ("_storage",) def __init__(self) -> None: self._storage: dict[StashKey[Any], object] = {} def __setitem__(self, key: StashKey[T], value: T) -> None: """Set a value for key.""" self._storage[key] = value def __getitem__(self, key: StashKey[T]) -> T: """Get the value for key. Raises ``KeyError`` if the key wasn't set before. """ return cast(T, self._storage[key]) def get(self, key: StashKey[T], default: D) -> T | D: """Get the value for key, or return default if the key wasn't set before.""" try: return self[key] except KeyError: return default def setdefault(self, key: StashKey[T], default: T) -> T: """Return the value of key if already set, otherwise set the value of key to default and return default.""" try: return self[key] except KeyError: self[key] = default return default def __delitem__(self, key: StashKey[T]) -> None: """Delete the value for key. Raises ``KeyError`` if the key wasn't set before. """ del self._storage[key] def __contains__(self, key: StashKey[T]) -> bool: """Return whether key was set.""" return key in self._storage def __len__(self) -> int: """Return how many items exist in the stash.""" return len(self._storage)
Save
cmd:
run