Skip to content

Commit

Permalink
refactor(in_memory): enhance @in_memory_repository type hint
Browse files Browse the repository at this point in the history
  • Loading branch information
Saucisse à roulettes committed Jul 8, 2023
1 parent a707bf2 commit 992e91d
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions ppa/in_memory.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
from collections.abc import Iterable
from typing import Any, Type
from typing import Any, Type, TypeVar

T = TypeVar("T")

def in_memory_repository(
find_by_fields: Iterable[str] | None = None,
entity_already_exists_exception: Type[Exception] = ValueError,
entity_not_found_exception: Type[Exception] = ValueError,
):
def decorator(cls) -> Type:
def decorator(cls: T) -> T:
class InMemoryRepository(cls):
def __init__(self) -> None:
self._store: dict[str, Any] = {}
Expand Down

0 comments on commit 992e91d

Please sign in to comment.