Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Made type more pythonic
NyanKiyoshi0e15b38e3cfa
diff --git a/saleor/graphql/product/types/attributes.py b/saleor/graphql/product/types/attributes.pyindex d4146a3cc9..9b82c42469 100644--- a/saleor/graphql/product/types/attributes.py+++ b/saleor/graphql/product/types/attributes.py@@ -5,7 +5,7 @@ import graphene_django_optimizer as gql_optimizerfrom graphene import relayfrom ....product import models-from ....product.utils.attributes import T_ASSIGNMENT_REL+from ....product.utils.attributes import AttributeAssignmentTypefrom ...core.connection import CountableDjangoObjectTypefrom ...core.resolvers import resolve_meta, resolve_private_metafrom ...core.types import MetadataObjectType@@ -205,7 +205,7 @@ class SelectedAttribute(graphene.ObjectType):description = "Represents a custom attribute."@staticmethod- def resolve_value(root: T_ASSIGNMENT_REL, _info):+ def resolve_value(root: AttributeAssignmentType, _info):return root.values.first()diff --git a/saleor/product/utils/attributes.py b/saleor/product/utils/attributes.pyindex c162fb1bdb..9a88153070 100644--- a/saleor/product/utils/attributes.py+++ b/saleor/product/utils/attributes.py@@ -9,7 +9,7 @@ from ..models import (ProductVariant,)-T_ASSIGNMENT_REL = Union[AssignedProductAttribute, AssignedVariantAttribute]+AttributeAssignmentType = Union[AssignedProductAttribute, AssignedVariantAttribute]def generate_name_for_variant(variant: ProductVariant) -> str:@@ -26,7 +26,7 @@ def generate_name_for_variant(variant: ProductVariant) -> str:def _associate_attribute_to_instance(instance: Union[Product, ProductVariant], attribute_pk: Attribute-) -> T_ASSIGNMENT_REL:+) -> AttributeAssignmentType:"""Associate a given attribute to an instance."""if isinstance(instance, Product):attribute_rel = instance.product_type.attributeproduct.get(@@ -65,7 +65,7 @@ def associate_attribute_values_to_instance(instance: Union[Product, ProductVariant],attribute: Attribute,*values: AttributeValue,-) -> T_ASSIGNMENT_REL:+) -> AttributeAssignmentType:"""Assign given attribute values to a product or variant.Note: be award this function invokes the ``set`` method on the instance's