Skip to content

Commit b8c6806

Browse files
authored
Merge pull request #1477 from vitalik/1441-patch-dict-type-check
PatchDict typing enhancement
2 parents 0ecb14e + 4f0bbbc commit b8c6806

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

ninja/patch_dict.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
from typing import TYPE_CHECKING, Any, Dict, Optional, Type
1+
from typing import TYPE_CHECKING, Any, Dict, Generic, Optional, Type, TypeVar
22

33
from pydantic_core import core_schema
4-
from typing_extensions import Annotated
54

65
from ninja import Body
76
from ninja.utils import is_optional_type
@@ -47,6 +46,10 @@ def __getitem__(self, schema_cls: Any) -> Any:
4746

4847

4948
if TYPE_CHECKING: # pragma: nocover
50-
PatchDict = Annotated[dict, "<PatchDict>"]
49+
T = TypeVar("T")
50+
51+
class PatchDict(Dict[Any, Any], Generic[T]):
52+
pass
53+
5154
else:
5255
PatchDict = PatchDictUtil()

0 commit comments

Comments
 (0)