Skip to content

Commit f2f13a5

Browse files
ref: add typing-only hints to dict fields for django-stubs
1 parent 11ec0eb commit f2f13a5

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

src/sentry/db/models/fields/gzippeddict.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import logging
44
import pickle
5+
from typing import Any
56

67
from django.db.models import TextField
78

@@ -20,6 +21,10 @@ class GzippedDictField(TextField):
2021
value is a dictionary.
2122
"""
2223

24+
_pyi_private_set_type = dict[str, Any]
25+
_pyi_private_get_type = dict[str, Any]
26+
_pyi_lookup_exact_type = dict[str, Any]
27+
2328
def contribute_to_class(self, cls, name):
2429
"""
2530
Add a descriptor for backwards compatibility

src/sentry/db/models/fields/jsonfield.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@
2525
OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
2626
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2727
"""
28+
from typing import Any
29+
2830
from django.core.exceptions import ValidationError
2931
from django.db import models
3032
from django.db.models.lookups import Contains, Exact, IContains, IExact, In, Lookup
@@ -54,6 +56,10 @@ class JSONField(models.TextField):
5456
description = "JSON object"
5557
no_creator_hook = False
5658

59+
_pyi_private_set_type = dict[str, Any]
60+
_pyi_private_get_type = dict[str, Any]
61+
_pyi_lookup_exact_type = dict[str, Any]
62+
5763
def __init__(self, *args, **kwargs):
5864
if not kwargs.get("null", False):
5965
kwargs["default"] = kwargs.get("default", dict)

0 commit comments

Comments
 (0)