Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Fix code formatting issues
Marcin Gębala5c962b34c27e
diff --git a/saleor/graphql/core/types/common.py b/saleor/graphql/core/types/common.pyindex 06fcecaede..1ae3fea4f1 100644--- a/saleor/graphql/core/types/common.py+++ b/saleor/graphql/core/types/common.py@@ -1,7 +1,6 @@import decimalimport graphene-import graphene_django_optimizer as gql_optimizerfrom graphene_django import DjangoObjectTypefrom saleor.core.permissions import MODELS_PERMISSIONSfrom saleor.graphql.core.utils import str_to_enumdiff --git a/saleor/graphql/order/types.py b/saleor/graphql/order/types.pyindex d4213bd5ee..f46658e81d 100644--- a/saleor/graphql/order/types.py+++ b/saleor/graphql/order/types.py@@ -266,7 +266,3 @@ class Order(CountableDjangoObjectType):price=obj.get_subtotal().gross.amount, weight=obj.get_total_weight(),country_code=obj.shipping_address.country.code)return qs-- @staticmethod- def resolve_lines(obj, info):- return obj.lines.all()diff --git a/saleor/graphql/product/filters.py b/saleor/graphql/product/filters.pyindex c6a047a6db..73818cb95b 100644--- a/saleor/graphql/product/filters.py+++ b/saleor/graphql/product/filters.py@@ -46,7 +46,7 @@ def filter_products_by_price(qs, price_lte=None, price_gte=None):def filter_products_by_categories(qs, categories):categories = [category.get_descendants(include_self=True) for category in categories]- ids = set([category.id for tree in categories for category in tree])+ ids = {category.id for tree in categories for category in tree}return qs.filter(category__in=ids)diff --git a/saleor/graphql/product/resolvers.py b/saleor/graphql/product/resolvers.pyindex 1f75ecf3c1..0198bea3ce 100644--- a/saleor/graphql/product/resolvers.py+++ b/saleor/graphql/product/resolvers.py@@ -93,7 +93,6 @@ def resolve_product_types(info):def resolve_product_variants(info, ids=None):- # FIXME: add visible_to_user for variantsqs = models.ProductVariant.objects.all()if ids:db_ids = [diff --git a/saleor/graphql/product/types.py b/saleor/graphql/product/types.pyindex 97239b2e03..07bd9c8210 100644--- a/saleor/graphql/product/types.py+++ b/saleor/graphql/product/types.py@@ -18,10 +18,7 @@ from ..core.types import (CountableDjangoObjectType, Money, MoneyRange, ReportingPeriod, TaxedMoney,TaxedMoneyRange, TaxRateType)from ..utils import get_database_id, reporting_period_to_date-from .filters import (- filter_products_by_attributes, filter_products_by_price, sort_qs)from .descriptions import AttributeDescriptions, AttributeValueDescriptions-from .scalars import AttributeScalarCOLOR_PATTERN = r'^(#[0-9a-fA-F]{3}|#(?:[0-9a-fA-F]{2}){2,4}|(rgb|hsl)a?\((-?\d+%?[,\s]+){2,3}\s*[\d\.]+%?\))$' # noqacolor_pattern = re.compile(COLOR_PATTERN)@@ -259,8 +256,8 @@ class Product(CountableDjangoObjectType):return self.get_absolute_url()@gql_optimizer.resolver_hints(- prefetch_related='variants',- only=['available_on', 'charge_taxes', 'price', 'tax_rate'])+ prefetch_related='variants',+ only=['available_on', 'charge_taxes', 'price', 'tax_rate'])def resolve_availability(self, info):context = info.contextavailability = get_availability(@@ -268,7 +265,7 @@ class Product(CountableDjangoObjectType):return ProductAvailability(**availability._asdict())@gql_optimizer.resolver_hints(- prefetch_related='product_type__product_attributes__values')+ prefetch_related='product_type__product_attributes__values')def resolve_attributes(self, info):attributes_qs = self.product_type.product_attributes.all()return resolve_attribute_list(self.attributes, attributes_qs)diff --git a/saleor/graphql/shipping/types.py b/saleor/graphql/shipping/types.pyindex 0ad0c8574b..6d6c161594 100644--- a/saleor/graphql/shipping/types.py+++ b/saleor/graphql/shipping/types.py@@ -35,11 +35,12 @@ class ShippingZone(CountableDjangoObjectType):countries = graphene.List(CountryDisplay,description='List of countries available for the method.')- shipping_methods = gql_optimizer.field(graphene.List(- ShippingMethod,- description=(- 'List of shipping methods available for orders'- ' shipped to countries within this shipping zone.')),+ shipping_methods = gql_optimizer.field(+ graphene.List(+ ShippingMethod,+ description=(+ 'List of shipping methods available for orders'+ ' shipped to countries within this shipping zone.')),model_field='shipping_methods')class Meta: