Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Add types casts
Rafał Pitoń2a7510a4a31e
diff --git a/saleor/graphql/attribute/types.py b/saleor/graphql/attribute/types.pyindex a17b337e82..c48ab64b9b 100644--- a/saleor/graphql/attribute/types.py+++ b/saleor/graphql/attribute/types.py@@ -1,6 +1,8 @@import re+from typing import castimport graphene+from django.db.models import QuerySetfrom ...attribute import AttributeInputType, AttributeType, modelsfrom ...core.exceptions import PermissionDenied@@ -186,9 +188,11 @@ class Attribute(CountableDjangoObjectType):@staticmethoddef resolve_choices(root: models.Attribute, info, **kwargs):if root.input_type in AttributeInputType.TYPES_WITH_CHOICES:- qs = root.values.all()+ qs = cast(QuerySet[models.AttributeValue], root.root.values.all())else:- qs = models.AttributeValue.objects.none()+ qs = cast(+ QuerySet[models.AttributeValue], models.AttributeValue.objects.none()+ )qs = filter_connection_queryset(qs, kwargs)return create_connection_slice(