Skip to content

Commit 55db005

Browse files
committed
Fix typing for registry_get_safe
1 parent c1cd61f commit 55db005

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/pytest_bdd/utils.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
from _pytest.pytester import RunResult
1818

1919
T = TypeVar("T")
20+
K = TypeVar("K")
21+
V = TypeVar("V")
2022

2123
CONFIG_STACK: list[Config] = []
2224

@@ -86,7 +88,7 @@ def setdefault(obj: object, name: str, default: T) -> T:
8688
return default
8789

8890

89-
def registry_get_safe(registry: WeakKeyDictionary[Any, T], key: Any, default: T | None = None) -> T | None:
91+
def registry_get_safe(registry: WeakKeyDictionary[K, V], key: K, default: V | None = None) -> V | None:
9092
"""Get a value from a registry, or None if the key is not in the registry.
9193
It ensures that this works even if the key cannot be weak-referenced (normally this would raise a TypeError).
9294
"""

0 commit comments

Comments
 (0)