From e6beb7fd94546d308094293429e5923a0ead43d1 Mon Sep 17 00:00:00 2001 From: John Parton Date: Thu, 15 Aug 2024 10:17:34 -0500 Subject: [PATCH] KT is a function, not an instance. --- django-stubs/db/models/fields/json.pyi | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/django-stubs/db/models/fields/json.pyi b/django-stubs/db/models/fields/json.pyi index 048d51d28..b2a078962 100644 --- a/django-stubs/db/models/fields/json.pyi +++ b/django-stubs/db/models/fields/json.pyi @@ -1,7 +1,7 @@ import json from collections.abc import Callable, Iterable from typing import Any, TypeVar, overload -from typing_extensions import Literal +from typing_extensions import Literal, Self from django.db.models import lookups from django.db.models.expressions import Combinable @@ -135,6 +135,8 @@ class KeyTransform(Transform): class KeyTextTransform(KeyTransform): postgres_operator: str = ... postgres_nested_operator: str = ... + @classmethod + def from_lookup(cls, lookup: str) -> Self: ... class KeyTransformTextLookupMixin: def __init__(self, key_transform: Any, *args: Any, **kwargs: Any) -> None: ... @@ -187,4 +189,4 @@ class KeyTransformFactory: def __init__(self, key_name: Any) -> None: ... def __call__(self, *args: Any, **kwargs: Any) -> Any: ... -KT: KeyTextTransform = ... +KT = KeyTextTransform.from_lookup