Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Clean up string formatting
Jakub Draganeka217390030eb
diff --git a/saleor/graphql/account/mutations.py b/saleor/graphql/account/mutations.pyindex c5c66509bd..b4fcbb2dc1 100644--- a/saleor/graphql/account/mutations.py+++ b/saleor/graphql/account/mutations.py@@ -1,4 +1,3 @@-import graphenefrom django.conf import settingsfrom django.contrib.auth.tokens import default_token_generator@@ -616,14 +615,12 @@ class UserAvatarUpdate(BaseMutation):)class Meta:- description = (- '''+ description = '''Create a user avatar. Only for staff members. This mutation mustbe sent as a `multipart` request. More detailed specs of theupload format can be found here:https://github.com/jaydenseric/graphql-multipart-request-spec'''- )@classmethod@staff_member_requireddiff --git a/saleor/graphql/core/types/common.py b/saleor/graphql/core/types/common.pyindex 90f1ebb650..b9a38f483c 100644--- a/saleor/graphql/core/types/common.py+++ b/saleor/graphql/core/types/common.py@@ -14,9 +14,9 @@ class CountryDisplay(graphene.ObjectType):class Error(graphene.ObjectType):field = graphene.String(- description=("""Name of a field that caused the error. A value of+ description="""Name of a field that caused the error. A value of`null` indicates that the error isn't associated with a particular- field."""), required=False)+ field.""", required=False)message = graphene.String(description='The error message.')class Meta:diff --git a/saleor/graphql/core/types/money.py b/saleor/graphql/core/types/money.pyindex b7b9859a50..f27df22288 100644--- a/saleor/graphql/core/types/money.py+++ b/saleor/graphql/core/types/money.py@@ -37,9 +37,9 @@ class TaxedMoney(graphene.ObjectType):tax = graphene.Field(Money, description='Amount of taxes.', required=True)class Meta:- description = ("""Represents a monetary value with taxes. In+ description = """Represents a monetary value with taxes. Incase when taxes were not applied, net and gross values will be equal.- """)+ """class TaxedMoneyRange(graphene.ObjectType):diff --git a/saleor/graphql/core/types/upload.py b/saleor/graphql/core/types/upload.pyindex 353f4f7fdd..06d96f1e6a 100644--- a/saleor/graphql/core/types/upload.py+++ b/saleor/graphql/core/types/upload.py@@ -4,10 +4,10 @@ import grapheneclass Upload(graphene.types.Scalar):class Meta:- description = ('''Variables of this type must be set to null in+ description = '''Variables of this type must be set to null inmutations. They will be replaced with a filename from a followingmultipart part containing a binary file. See:- https://github.com/jaydenseric/graphql-multipart-request-spec''')+ https://github.com/jaydenseric/graphql-multipart-request-spec'''@staticmethoddef serialize(value):diff --git a/saleor/graphql/discount/types.py b/saleor/graphql/discount/types.pyindex b42eb22b9b..03a4eb54f7 100644--- a/saleor/graphql/discount/types.py+++ b/saleor/graphql/discount/types.py@@ -39,9 +39,9 @@ class Sale(CountableDjangoObjectType):resolver=resolve_translation)class Meta:- description = ("""+ description = """Sales allow creating discounts for categories, collections or- products and are visible to all the customers.""")+ products and are visible to all the customers."""interfaces = [relay.Node]model = models.Saleonly_fields = ['end_date', 'id', 'name', 'start_date', 'type', 'value']@@ -86,10 +86,10 @@ class Voucher(CountableDjangoObjectType):resolver=resolve_translation)class Meta:- description = ("""+ description = """Vouchers allow giving discounts to particular customers on categories,collections or specific products. They can be used during checkout by- providing valid voucher codes.""")+ providing valid voucher codes."""only_fields = ['apply_once_per_order', 'code', 'discount_value','discount_value_type', 'end_date', 'id', 'min_amount_spent',diff --git a/saleor/graphql/menu/mutations.py b/saleor/graphql/menu/mutations.pyindex bd6fbf253d..e1dc17df58 100644--- a/saleor/graphql/menu/mutations.py+++ b/saleor/graphql/menu/mutations.py@@ -29,9 +29,9 @@ class MenuItemCreateInput(MenuItemInput):description='Menu to which item belongs to.', name='menu',required=True)parent = graphene.ID(- description=('''+ description='''ID of the parent menu. If empty, menu will be top level- menu.'''),+ menu.''',name='parent')@@ -124,9 +124,9 @@ class MenuItemCreate(ModelMutation):class Arguments:input = MenuItemCreateInput(required=True,- description=("""Fields required to update a menu item.+ description="""Fields required to update a menu item.Only one of 'url', 'category', 'page', 'collection' is allowed- per item"""))+ per item""")class Meta:description = 'Creates a new Menu'@@ -151,9 +151,9 @@ class MenuItemUpdate(MenuItemCreate):required=True, description='ID of a menu item to update.')input = MenuItemInput(required=True,- description=("""Fields required to update a menu item.+ description="""Fields required to update a menu item.Only one of 'url', 'category', 'page', 'collection' is allowed- per item"""))+ per item""")class Meta:description = 'Updates a menu item.'diff --git a/saleor/graphql/menu/types.py b/saleor/graphql/menu/types.pyindex 13d555bf74..9e10b006b4 100644--- a/saleor/graphql/menu/types.py+++ b/saleor/graphql/menu/types.py@@ -23,9 +23,8 @@ class Menu(CountableDjangoObjectType):prefetch_related=prefetch_menus)class Meta:- description = (- """Represents a single menu - an object that is used- to help navigate through the store.""")+ description = """Represents a single menu - an object that is used+ to help navigate through the store."""interfaces = [relay.Node]only_fields = ['id', 'name']model = models.Menu@@ -52,8 +51,8 @@ class MenuItem(CountableDjangoObjectType):resolver=resolve_translation)class Meta:- description = ("""Represents a single item of the related menu.- Can store categories, collection or pages.""")+ description = """Represents a single item of the related menu.+ Can store categories, collection or pages."""interfaces = [relay.Node]only_fields = ['category', 'collection', 'id', 'level', 'menu', 'name', 'page',diff --git a/saleor/graphql/order/mutations/draft_orders.py b/saleor/graphql/order/mutations/draft_orders.pyindex 350e93cacf..3f868c7d02 100644--- a/saleor/graphql/order/mutations/draft_orders.py+++ b/saleor/graphql/order/mutations/draft_orders.py@@ -47,8 +47,8 @@ class DraftOrderInput(InputObjectType):class DraftOrderCreateInput(DraftOrderInput):lines = graphene.List(OrderLineCreateInput,- description=("""Variant line input consisting of variant ID- and quantity of products."""))+ description="""Variant line input consisting of variant ID+ and quantity of products.""")class DraftOrderCreate(ModelMutation, I18nMixin):diff --git a/saleor/graphql/order/mutations/fulfillments.py b/saleor/graphql/order/mutations/fulfillments.pyindex 7a5a853336..d49dbf44b7 100644--- a/saleor/graphql/order/mutations/fulfillments.py+++ b/saleor/graphql/order/mutations/fulfillments.py@@ -185,8 +185,8 @@ class FulfillmentCancel(BaseMutation):description='Fields required to cancel an fulfillment.')class Meta:- description = ("""Cancels existing fulfillment- and optionally restocks items.""")+ description = """Cancels existing fulfillment+ and optionally restocks items."""permissions = ('order.manage_orders', )@classmethoddiff --git a/saleor/graphql/order/schema.py b/saleor/graphql/order/schema.pyindex 1142e5cbfe..7f30188b4e 100644--- a/saleor/graphql/order/schema.py+++ b/saleor/graphql/order/schema.py@@ -38,8 +38,8 @@ class OrderDraftFilterInput(FilterInputObjectType):class OrderQueries(graphene.ObjectType):homepage_events = PrefetchingConnectionField(- OrderEvent, description=('''List of activity events to display on- homepage (at the moment it only contains order-events).'''))+ OrderEvent, description='''List of activity events to display on+ homepage (at the moment it only contains order-events).''')order = graphene.Field(Order, description='Lookup an order by ID.',id=graphene.Argument(graphene.ID, required=True))diff --git a/saleor/graphql/order/types.py b/saleor/graphql/order/types.pyindex fd7ceaa6e6..a7f7f54a96 100644--- a/saleor/graphql/order/types.py+++ b/saleor/graphql/order/types.py@@ -123,9 +123,9 @@ class OrderLine(CountableDjangoObjectType):variant = graphene.Field(ProductVariant,required=False,- description=('''+ description='''A purchased product variant. Note: this field may be null if the- variant has been removed from stock at all.'''))+ variant has been removed from stock at all.''')class Meta:description = 'Represents order line of particular order.'diff --git a/saleor/graphql/page/types.py b/saleor/graphql/page/types.pyindex 721459a604..d12721ad0b 100644--- a/saleor/graphql/page/types.py+++ b/saleor/graphql/page/types.py@@ -26,9 +26,8 @@ class Page(CountableDjangoObjectType):resolver=resolve_translation)class Meta:- description = (- """A static page that can be manually added by a shop- operator through the dashboard.""")+ description = """A static page that can be manually added by a shop+ operator through the dashboard."""only_fields = ['content', 'content_json', 'created', 'id', 'is_published','publication_date', 'seo_description', 'seo_title', 'slug',diff --git a/saleor/graphql/payment/mutations.py b/saleor/graphql/payment/mutations.pyindex 07ec3fe63e..6fc49e022c 100644--- a/saleor/graphql/payment/mutations.py+++ b/saleor/graphql/payment/mutations.py@@ -33,9 +33,8 @@ class PaymentInput(graphene.InputObjectType):'all taxes and discounts. If no amount is provided, ''the checkout total will be used.'))billing_address = AddressInput(- description=(- '''Billing address. If empty, the billing address associated with- the checkout instance will be used.'''))+ description='''Billing address. If empty, the billing address associated with+ the checkout instance will be used.''')class CheckoutPaymentCreate(BaseMutation, I18nMixin):diff --git a/saleor/graphql/product/mutations/digital_contents.py b/saleor/graphql/product/mutations/digital_contents.pyindex 057baa96d2..2819546315 100644--- a/saleor/graphql/product/mutations/digital_contents.py+++ b/saleor/graphql/product/mutations/digital_contents.py@@ -47,10 +47,10 @@ class DigitalContentCreate(BaseMutation):description='Fields required to create a digital content.')class Meta:- description = ('''Create new digital content. This mutation must+ description = '''Create new digital content. This mutation mustbe sent as a `multipart` request. More detailed specs of the uploadformat can be found here:- https://github.com/jaydenseric/graphql-multipart-request-spec''')+ https://github.com/jaydenseric/graphql-multipart-request-spec'''@classmethod@permission_required('product.manage_products')diff --git a/saleor/graphql/product/mutations/products.py b/saleor/graphql/product/mutations/products.pyindex a6176bbb1b..f814f20848 100644--- a/saleor/graphql/product/mutations/products.py+++ b/saleor/graphql/product/mutations/products.py@@ -37,9 +37,9 @@ class CategoryCreate(ModelMutation):input = CategoryInput(required=True, description='Fields required to create a category.')parent_id = graphene.ID(- description=('''+ description='''ID of the parent category. If empty, category will be top level- category.'''), name='parent')+ category.''', name='parent')class Meta:description = 'Creates a new category.'@@ -274,17 +274,17 @@ class ProductInput(graphene.InputObjectType):weight = WeightScalar(description='Weight of the Product.', required=False)sku = graphene.String(- description=("""Stock keeping unit of a product. Note: this- field is only used if a product doesn't use variants."""))+ description="""Stock keeping unit of a product. Note: this+ field is only used if a product doesn't use variants.""")quantity = graphene.Int(- description=("""The total quantity of a product available for+ description="""The total quantity of a product available forsale. Note: this field is only used if a product doesn't- use variants."""))+ use variants.""")track_inventory = graphene.Boolean(- description=("""Determines if the inventory of this product+ description="""Determines if the inventory of this productshould be tracked. If false, the quantity won't change when customersbuy this item. Note: this field is only used if a product doesn't- use variants."""))+ use variants.""")class ProductCreateInput(ProductInput):@@ -381,9 +381,9 @@ class ProductUpdate(ProductCreate):@classmethoddef clean_sku(cls, product_type, cleaned_input):input_sku = cleaned_input.get('sku')- if (not product_type.has_variants- and input_sku- and models.ProductVariant.objects.filter(sku=input_sku).exists()):+ if (not product_type.has_variants and+ input_sku and+ models.ProductVariant.objects.filter(sku=input_sku).exists()):raise ValidationError({'sku': 'Product with this SKU already exists.'})@@ -429,10 +429,9 @@ class ProductVariantInput(graphene.InputObjectType):quantity = graphene.Int(description='The total quantity of this variant available for sale.')track_inventory = graphene.Boolean(- description=(- """Determines if the inventory of this variant should+ description="""Determines if the inventory of this variant shouldbe tracked. If false, the quantity won't change when customers- buy this item."""))+ buy this item.""")weight = WeightScalar(description='Weight of the Product Variant.', required=False)@@ -532,24 +531,24 @@ class ProductVariantDelete(ModelDeleteMutation):class ProductTypeInput(graphene.InputObjectType):name = graphene.String(description='Name of the product type.')has_variants = graphene.Boolean(- description=("""Determines if product of this type has multiple+ description="""Determines if product of this type has multiplevariants. This option mainly simplifies product managementin the dashboard. There is always at least one variant created under- the hood."""))+ the hood.""")product_attributes = graphene.List(graphene.ID,description='List of attributes shared among all product variants.',name='productAttributes')variant_attributes = graphene.List(graphene.ID,- description=("""List of attributes used to distinguish between- different variants of a product."""),+ description="""List of attributes used to distinguish between+ different variants of a product.""",name='variantAttributes')is_shipping_required = graphene.Boolean(- description=("""Determines if shipping is required for products- of this variant."""))+ description="""Determines if shipping is required for products+ of this variant.""")is_digital = graphene.Boolean(- description=("Determines if products are digital."),+ description='Determines if products are digital.',required=False)weight = WeightScalar(description='Weight of the ProductType items.')tax_rate = TaxRateType(description='A type of goods.')@@ -628,10 +627,10 @@ class ProductImageCreate(BaseMutation):description='Fields required to create a product image.')class Meta:- description = ('''Create a product image. This mutation must be+ description = '''Create a product image. This mutation must besent as a `multipart` request. More detailed specs of the upload formatcan be found here:- https://github.com/jaydenseric/graphql-multipart-request-spec''')+ https://github.com/jaydenseric/graphql-multipart-request-spec'''permissions = ('product.manage_products', )@classmethoddiff --git a/saleor/graphql/product/schema.py b/saleor/graphql/product/schema.pyindex 917bc1287b..b050d135ee 100644--- a/saleor/graphql/product/schema.py+++ b/saleor/graphql/product/schema.py@@ -68,13 +68,11 @@ class ProductQueries(graphene.ObjectType):description='List of the shop\'s attributes.',query=graphene.String(description=DESCRIPTIONS['attributes']),in_category=graphene.Argument(- graphene.ID, description=(- '''Return attributes for products belonging to the given- category.''')),+ graphene.ID, description='''Return attributes for products+ belonging to the given category.'''),in_collection=graphene.Argument(- graphene.ID, description=(- '''Return attributes for products belonging to the given- collection.''')), )+ graphene.ID, description='''Return attributes for products+ belonging to the given collection.'''), )categories = PrefetchingConnectionField(Category, query=graphene.String(description=DESCRIPTIONS['category']),@@ -103,12 +101,9 @@ class ProductQueries(graphene.ObjectType):collections=graphene.List(graphene.ID, description='Filter products by collections.'),price_lte=graphene.Float(- description=(- '''Filter by price less than or equal to the given value.''')),+ description='Filter by price less than or equal to the given value.'),price_gte=graphene.Float(- description=(- '''- Filter by price greater than or equal to the given value.''')),+ description='Filter by price greater than or equal to the given value.'),sort_by=graphene.Argument(ProductOrder, description='Sort products.'),stock_availability=graphene.Argument(diff --git a/saleor/graphql/product/types/attributes.py b/saleor/graphql/product/types/attributes.pyindex 92edf30f83..b600027f98 100644--- a/saleor/graphql/product/types/attributes.py+++ b/saleor/graphql/product/types/attributes.py@@ -72,9 +72,9 @@ class Attribute(CountableDjangoObjectType):resolver=resolve_translation)class Meta:- description = ("""+ description = """Custom attribute of a product. Attributes can be- assigned to products and variants at the product type level.""")+ assigned to products and variants at the product type level."""only_fields = ['id', 'product_type', 'product_variant_type']interfaces = [relay.Node]model = models.Attributediff --git a/saleor/graphql/product/types/products.py b/saleor/graphql/product/types/products.pyindex e237fc6b3e..64d745d4c9 100644--- a/saleor/graphql/product/types/products.py+++ b/saleor/graphql/product/types/products.py@@ -136,18 +136,17 @@ class ProductVariant(CountableDjangoObjectType):required=True, description='Quantity of a product available for sale.')price_override = graphene.Field(Money,- description=(- """Override the base price of a product if necessary.+ description="""+ Override the base price of a product if necessary.A value of `null` indicates that the default product- price is used."""))+ price is used.""")price = graphene.Field(Money, description='Price of the product variant.',deprecation_reason=('Has been replaced by \'pricing.price_undiscounted\''))availability = graphene.Field(- VariantPricingInfo, description=(- """Informs about variant's availability in the- storefront, current price and discounted price."""),+ VariantPricingInfo, description="""Informs about variant's availability in the+ storefront, current price and discounted price.""",deprecation_reason='Has been renamed to \'pricing\'.')pricing = graphene.Field(VariantPricingInfo,@@ -165,10 +164,10 @@ class ProductVariant(CountableDjangoObjectType):quantity_ordered = graphene.Int(description='Total quantity ordered.')revenue = graphene.Field(TaxedMoney, period=graphene.Argument(ReportingPeriod),- description=('''Total revenue generated by a variant in given+ description='''Total revenue generated by a variant in givenperiod of time. Note: this field should be queried using`reportProductSales` query as it uses optimizations suitable- for such calculations.'''))+ for such calculations.''')images = gql_optimizer.field(graphene.List(lambda: ProductImage,@@ -189,8 +188,8 @@ class ProductVariant(CountableDjangoObjectType):model_field='digital_content')class Meta:- description = ("""Represents a version of a product such as- different size or color.""")+ description = """Represents a version of a product such as+ different size or color."""only_fields = ['id', 'name', 'product', 'quantity', 'quantity_allocated', 'sku','track_inventory', 'weight']@@ -281,14 +280,12 @@ class Product(CountableDjangoObjectType):size=graphene.Argument(graphene.Int, description='Size of thumbnail'))availability = graphene.Field(ProductPricingInfo,- description=(- """Informs about product's availability in the- storefront, current price and discounts."""),+ description="""Informs about product's availability in the+ storefront, current price and discounts.""",deprecation_reason='Has been renamed to \'pricing\'.')pricing = graphene.Field(- ProductPricingInfo, description=(- """Lists the storefront product's pricing,- the current price and discounts, only meant for displaying."""))+ ProductPricingInfo, description="""Lists the storefront product's pricing,+ the current price and discounts, only meant for displaying.""")is_available = graphene.Boolean(description='Whether the product is in stock and visible or not.')base_price = graphene.Field(@@ -338,8 +335,8 @@ class Product(CountableDjangoObjectType):resolver=resolve_translation)class Meta:- description = ("""Represents an individual item for sale in the- storefront.""")+ description = """Represents an individual item for sale in the+ storefront."""interfaces = [relay.Node]model = models.Productonly_fields = [@@ -449,8 +446,8 @@ class ProductType(CountableDjangoObjectType):Attribute, description='Product attributes of that product type.')class Meta:- description = ("""Represents a type of product. It defines what- attributes are available to products of this type.""")+ description = """Represents a type of product. It defines what+ attributes are available to products of this type."""interfaces = [relay.Node]model = models.ProductTypeonly_fields = [@@ -555,9 +552,9 @@ class Category(CountableDjangoObjectType):resolver=resolve_translation)class Meta:- description = ("""Represents a single category of products.+ description = """Represents a single category of products.Categories allow to organize products in a tree-hierarchies which can- be used for navigation in the storefront.""")+ be used for navigation in the storefront."""only_fields = ['description', 'description_json', 'id', 'level', 'name', 'parent','seo_description', 'seo_title', 'slug']diff --git a/saleor/graphql/shipping/mutations.py b/saleor/graphql/shipping/mutations.pyindex a5e8181bb2..f0fa3805db 100644--- a/saleor/graphql/shipping/mutations.py+++ b/saleor/graphql/shipping/mutations.py@@ -34,10 +34,9 @@ class ShippingZoneInput(graphene.InputObjectType):graphene.String,description='List of countries in this shipping zone.')default = graphene.Boolean(- description=(- """+ description="""Is default shipping zone, that will be used- for countries not covered by other zones."""))+ for countries not covered by other zones.""")class ShippingZoneMixin:diff --git a/saleor/graphql/shipping/types.py b/saleor/graphql/shipping/types.pyindex c7d2532d85..9242bb551c 100644--- a/saleor/graphql/shipping/types.py+++ b/saleor/graphql/shipping/types.py@@ -25,10 +25,10 @@ class ShippingMethod(CountableDjangoObjectType):resolver=resolve_translation)class Meta:- description = ("""+ description = """Shipping method are the methods you'll use to getcustomer's orders to them.- They are directly exposed to the customers.""")+ They are directly exposed to the customers."""model = models.ShippingMethodinterfaces = [relay.Node]only_fields = [@@ -51,10 +51,10 @@ class ShippingZone(CountableDjangoObjectType):model_field='shipping_methods')class Meta:- description = ("""+ description = """Represents a shipping zone in the shop. Zones are the conceptused only for grouping shipping methods in the dashboard,- and are never exposed to the customers directly.""")+ and are never exposed to the customers directly."""model = models.ShippingZoneinterfaces = [relay.Node]only_fields = ['default', 'id', 'name']diff --git a/saleor/graphql/shop/types.py b/saleor/graphql/shop/types.pyindex 4576bd766c..4b472a9419 100644--- a/saleor/graphql/shop/types.py+++ b/saleor/graphql/shop/types.py@@ -66,10 +66,9 @@ class Shop(graphene.ObjectType):description='Customer\'s geolocalization data.')authorization_keys = graphene.List(AuthorizationKey,- description=(- '''List of configured authorization keys. Authorization+ description='''List of configured authorization keys. Authorizationkeys are used to enable third party OAuth authorization- (currently Facebook or Google).'''),+ (currently Facebook or Google).''',required=True)countries = graphene.List(CountryDisplay, description='List of countries available in the shop.',@@ -126,9 +125,9 @@ class Shop(graphene.ObjectType):'Default number of days which digital content url will be valid'))class Meta:- description = ('''+ description = '''Represents a shop resource containing general shop\'s data- and configuration.''')+ and configuration.'''@permission_required('site.manage_settings')def resolve_authorization_keys(self, _info):