Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Reformat code after update black (#6682)
Damian Wysocki8a9c2ed6955e
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yamlindex bf28a3cb04..e78555a8c8 100644--- a/.pre-commit-config.yaml+++ b/.pre-commit-config.yaml@@ -1,6 +1,6 @@repos:- repo: https://github.com/ambv/black- rev: 19.10b0+ rev: 20.8b1hooks:- id: blacklanguage_version: python3.8@@ -26,9 +26,10 @@ repos:- id: seed-isort-config- repo: https://github.com/pre-commit/mirrors-isort- rev: v4.3.21+ rev: v5.7.0hooks:- id: isort+ args: ["--profile", "black"]- repo: https://github.com/pycqa/pydocstylerev: 5.1.1diff --git a/pyproject.toml b/pyproject.tomlindex dfaf9e8ec8..ffb4ddbe84 100644--- a/pyproject.toml+++ b/pyproject.toml@@ -71,7 +71,7 @@ uvicorn = {extras = ["standard"], version = "^0.12.2"}gunicorn = "^20.0.4"[tool.poetry.dev-dependencies]-black = "19.10b0"+black = "20.8b1"codecov = "^2.1.11"coverage = "^5.3"django-debug-toolbar = "^3.2"@@ -79,7 +79,7 @@ django-debug-toolbar-request-history = "^0"django-graphiql-debug-toolbar = "^0.1.4"django-extensions = "^3.1.0"flake8 = "^3.8.4"-isort = "^4.3.21"+isort = "^5.7.0"pre-commit = "^2.9"pycodestyle = "^2.5"pydocstyle = "^5.1"diff --git a/requirements_dev.txt b/requirements_dev.txtindex a2ddf547c8..097c23d9ab 100644--- a/requirements_dev.txt+++ b/requirements_dev.txt@@ -11,7 +11,7 @@ babel==2.9.0; (python_version >= "2.7" and python_full_version < "3.0.0") or (pybeautifulsoup4==4.7.1beautifultable==0.7.0billiard==3.6.3.0; python_version >= "3.6"-black==19.10b0; python_version >= "3.6"+black==20.8b1; python_version >= "3.6"boto3==1.16.32botocore==1.19.32braintree==4.5.0@@ -92,7 +92,7 @@ httptools==0.1.1; sys_platform != "win32" and sys_platform != "cygwin" and platfidentify==1.5.10; python_full_version >= "3.6.1"idna==2.10; python_version >= "3.6" and python_full_version < "3.0.0" or python_full_version >= "3.5.0" and python_version >= "3.6"iniconfig==1.1.1; python_version >= "3.5" and python_full_version < "3.0.0" or python_full_version >= "3.5.0" and python_version >= "3.5"-isort==4.3.21; (python_version >= "2.7" and python_full_version < "3.0.0") or (python_full_version >= "3.4.0")+isort==5.7.0; (python_version >= "2.7" and python_full_version < "3.0.0") or (python_full_version >= "3.4.0")jaeger-client==4.3.0jdcal==1.4.1; python_version >= "3.6"jinja2==2.11.2; python_version >= "2.7" and python_full_version < "3.0.0" or python_full_version >= "3.5.0"diff --git a/saleor/account/migrations/0039_auto_20200221_0257.py b/saleor/account/migrations/0039_auto_20200221_0257.pyindex a821fb6437..249427fd1e 100644--- a/saleor/account/migrations/0039_auto_20200221_0257.py+++ b/saleor/account/migrations/0039_auto_20200221_0257.py@@ -11,7 +11,9 @@ class Migration(migrations.Migration):operations = [migrations.RenameField(- model_name="serviceaccount", old_name="meta", new_name="metadata",+ model_name="serviceaccount",+ old_name="meta",+ new_name="metadata",),migrations.RenameField(model_name="serviceaccount",@@ -19,9 +21,13 @@ class Migration(migrations.Migration):new_name="private_metadata",),migrations.RenameField(- model_name="user", old_name="meta", new_name="metadata",+ model_name="user",+ old_name="meta",+ new_name="metadata",),migrations.RenameField(- model_name="user", old_name="private_meta", new_name="private_metadata",+ model_name="user",+ old_name="private_meta",+ new_name="private_metadata",),]diff --git a/saleor/account/migrations/0040_auto_20200225_0237.py b/saleor/account/migrations/0040_auto_20200225_0237.pyindex 24fffb44e3..69283ba112 100644--- a/saleor/account/migrations/0040_auto_20200225_0237.py+++ b/saleor/account/migrations/0040_auto_20200225_0237.py@@ -18,7 +18,8 @@ class Migration(migrations.Migration):},),migrations.AlterModelOptions(- name="staffnotificationrecipient", options={"ordering": ("staff_email",)},+ name="staffnotificationrecipient",+ options={"ordering": ("staff_email",)},),migrations.AlterModelOptions(name="user",diff --git a/saleor/account/migrations/0043_rename_service_account_to_app.py b/saleor/account/migrations/0043_rename_service_account_to_app.pyindex fa2e5562d9..ddfcf543cf 100644--- a/saleor/account/migrations/0043_rename_service_account_to_app.py+++ b/saleor/account/migrations/0043_rename_service_account_to_app.py@@ -13,15 +13,30 @@ class Migration(migrations.Migration):]operations = [- migrations.RenameModel(old_name="ServiceAccount", new_name="App",),- migrations.RenameModel(old_name="ServiceAccountToken", new_name="AppToken",),- migrations.AlterModelTable(name="app", table="app_app",),- migrations.AlterModelTable(name="apptoken", table="app_apptoken",),+ migrations.RenameModel(+ old_name="ServiceAccount",+ new_name="App",+ ),+ migrations.RenameModel(+ old_name="ServiceAccountToken",+ new_name="AppToken",+ ),+ migrations.AlterModelTable(+ name="app",+ table="app_app",+ ),+ migrations.AlterModelTable(+ name="apptoken",+ table="app_apptoken",+ ),migrations.RenameField(- model_name="apptoken", old_name="service_account", new_name="app",+ model_name="apptoken",+ old_name="service_account",+ new_name="app",),migrations.AlterModelOptions(- name="app", options={"permissions": (("manage_apps", "Manage apps"),)},+ name="app",+ options={"permissions": (("manage_apps", "Manage apps"),)},),migrations.AlterField(model_name="app",diff --git a/saleor/account/migrations/0044_unmount_app_and_app_token.py b/saleor/account/migrations/0044_unmount_app_and_app_token.pyindex 6cb48def17..a110098557 100644--- a/saleor/account/migrations/0044_unmount_app_and_app_token.py+++ b/saleor/account/migrations/0044_unmount_app_and_app_token.py@@ -11,9 +11,16 @@ class Migration(migrations.Migration):]state_operations = [- migrations.RemoveField(model_name="apptoken", name="app",),- migrations.DeleteModel(name="App",),- migrations.DeleteModel(name="AppToken",),+ migrations.RemoveField(+ model_name="apptoken",+ name="app",+ ),+ migrations.DeleteModel(+ name="App",+ ),+ migrations.DeleteModel(+ name="AppToken",+ ),]operations = [diff --git a/saleor/app/installation_utils.py b/saleor/app/installation_utils.pyindex 15b2d23899..941947e9f8 100644--- a/saleor/app/installation_utils.py+++ b/saleor/app/installation_utils.py@@ -30,7 +30,8 @@ def validate_manifest_fields(manifest_data):def install_app(- app_installation: AppInstallation, activate: bool = False,+ app_installation: AppInstallation,+ activate: bool = False,):response = requests.get(app_installation.manifest_url, timeout=REQUEST_TIMEOUT)response.raise_for_status()diff --git a/saleor/app/migrations/0001_initial.py b/saleor/app/migrations/0001_initial.pyindex 01057d94b8..df94e1c957 100644--- a/saleor/app/migrations/0001_initial.py+++ b/saleor/app/migrations/0001_initial.py@@ -151,7 +151,13 @@ class Migration(migrations.Migration):migrations.SeparateDatabaseAndState(state_operations=state_operations, database_operations=database_operations),- migrations.AlterModelTable(name="app", table=None,),- migrations.AlterModelTable(name="apptoken", table=None,),+ migrations.AlterModelTable(+ name="app",+ table=None,+ ),+ migrations.AlterModelTable(+ name="apptoken",+ table=None,+ ),migrations.RunPython(convert_service_account_permissions_to_app_permissions),]diff --git a/saleor/app/models.py b/saleor/app/models.pyindex ca2d3ec3f6..27f370309a 100644--- a/saleor/app/models.py+++ b/saleor/app/models.py@@ -35,7 +35,12 @@ class App(ModelWithMetadata):class Meta:ordering = ("name", "pk")- permissions = ((AppPermission.MANAGE_APPS.codename, "Manage apps",),)+ permissions = (+ (+ AppPermission.MANAGE_APPS.codename,+ "Manage apps",+ ),+ )def get_permissions(self) -> Set[str]:"""Return the permissions of the app."""diff --git a/saleor/app/tests/test_app_tasks.py b/saleor/app/tests/test_app_tasks.pyindex 75d067fee1..644da8a806 100644--- a/saleor/app/tests/test_app_tasks.py+++ b/saleor/app/tests/test_app_tasks.py@@ -20,7 +20,8 @@ def test_install_app_task(app_installation):@pytest.mark.vcrdef test_install_app_task_wrong_format_of_target_token_url():app_installation = AppInstallation.objects.create(- app_name="External App", manifest_url="http://localhost:3000/manifest-wrong",+ app_name="External App",+ manifest_url="http://localhost:3000/manifest-wrong",)install_app_task(app_installation.id, activate=False)app_installation.refresh_from_db()@@ -47,7 +48,8 @@ def test_install_app_task_request_timeout(monkeypatch, app_installation):@pytest.mark.vcrdef test_install_app_task_wrong_response_code(monkeypatch):app_installation = AppInstallation.objects.create(- app_name="External App", manifest_url="http://localhost:3000/manifest-wrong1",+ app_name="External App",+ manifest_url="http://localhost:3000/manifest-wrong1",)mocked_post = Mock()mocked_post.status_code = 404diff --git a/saleor/attribute/migrations/0001_initial.py b/saleor/attribute/migrations/0001_initial.pyindex 3b8a017e03..a3cc5165c1 100644--- a/saleor/attribute/migrations/0001_initial.py+++ b/saleor/attribute/migrations/0001_initial.py@@ -484,7 +484,8 @@ class Migration(migrations.Migration):unique_together={("product", "assignment")},),migrations.AlterUniqueTogether(- name="assignedpageattribute", unique_together={("page", "assignment")},+ name="assignedpageattribute",+ unique_together={("page", "assignment")},),]diff --git a/saleor/attribute/migrations/0002_auto_20201030_1141.py b/saleor/attribute/migrations/0002_auto_20201030_1141.pyindex 272690efda..60a956290e 100644--- a/saleor/attribute/migrations/0002_auto_20201030_1141.py+++ b/saleor/attribute/migrations/0002_auto_20201030_1141.py@@ -11,14 +11,44 @@ class Migration(migrations.Migration):]operations = [- migrations.AlterModelTable(name="assignedpageattribute", table=None,),- migrations.AlterModelTable(name="assignedproductattribute", table=None,),- migrations.AlterModelTable(name="assignedvariantattribute", table=None,),- migrations.AlterModelTable(name="attribute", table=None,),- migrations.AlterModelTable(name="attributepage", table=None,),- migrations.AlterModelTable(name="attributeproduct", table=None,),- migrations.AlterModelTable(name="attributetranslation", table=None,),- migrations.AlterModelTable(name="attributevalue", table=None,),- migrations.AlterModelTable(name="attributevaluetranslation", table=None,),- migrations.AlterModelTable(name="attributevariant", table=None,),+ migrations.AlterModelTable(+ name="assignedpageattribute",+ table=None,+ ),+ migrations.AlterModelTable(+ name="assignedproductattribute",+ table=None,+ ),+ migrations.AlterModelTable(+ name="assignedvariantattribute",+ table=None,+ ),+ migrations.AlterModelTable(+ name="attribute",+ table=None,+ ),+ migrations.AlterModelTable(+ name="attributepage",+ table=None,+ ),+ migrations.AlterModelTable(+ name="attributeproduct",+ table=None,+ ),+ migrations.AlterModelTable(+ name="attributetranslation",+ table=None,+ ),+ migrations.AlterModelTable(+ name="attributevalue",+ table=None,+ ),+ migrations.AlterModelTable(+ name="attributevaluetranslation",+ table=None,+ ),+ migrations.AlterModelTable(+ name="attributevariant",+ table=None,+ ),]diff --git a/saleor/attribute/models.py b/saleor/attribute/models.pyindex 170d7467f9..8c761b3729 100644--- a/saleor/attribute/models.py+++ b/saleor/attribute/models.py@@ -11,9 +11,10 @@ from ..product.models import Product, ProductType, ProductVariantfrom . import AttributeInputType, AttributeTypeif TYPE_CHECKING:- from ..account.models import Userfrom django.db.models import OrderBy+ from ..account.models import User+class BaseAttributeQuerySet(models.QuerySet):@staticmethoddiff --git a/saleor/attribute/utils.py b/saleor/attribute/utils.pyindex 2771028c78..f59c648caa 100644--- a/saleor/attribute/utils.py+++ b/saleor/attribute/utils.py@@ -16,7 +16,7 @@ AttributeAssignmentType = Union[if TYPE_CHECKING:- from .models import AttributeProduct, AttributeVariant, AttributePage+ from .models import AttributePage, AttributeProduct, AttributeVariantdef _associate_attribute_to_instance(diff --git a/saleor/channel/models.py b/saleor/channel/models.pyindex 3ce4b25883..08760bdddc 100644--- a/saleor/channel/models.py+++ b/saleor/channel/models.py@@ -14,7 +14,10 @@ class Channel(models.Model):ordering = ("slug",)app_label = "channel"permissions = (- (ChannelPermissions.MANAGE_CHANNELS.codename, "Manage channels.",),+ (+ ChannelPermissions.MANAGE_CHANNELS.codename,+ "Manage channels.",+ ),)def __str__(self):diff --git a/saleor/checkout/base_calculations.py b/saleor/checkout/base_calculations.pyindex e6339ebcc9..36384470aa 100644--- a/saleor/checkout/base_calculations.py+++ b/saleor/checkout/base_calculations.py@@ -16,6 +16,7 @@ from ..discount import DiscountInfoif TYPE_CHECKING:# flake8: noqa+ from ..channel.models import Channelfrom ..product.models import (Collection,Product,@@ -23,7 +24,6 @@ if TYPE_CHECKING:ProductVariantChannelListing,)from .models import Checkout, CheckoutLine- from ..channel.models import Channeldef base_checkout_shipping_price(checkout: "Checkout", lines=None) -> TaxedMoney:diff --git a/saleor/checkout/calculations.py b/saleor/checkout/calculations.pyindex 1d939fc3e8..85455609ed 100644--- a/saleor/checkout/calculations.py+++ b/saleor/checkout/calculations.py@@ -6,17 +6,18 @@ from ..discount import DiscountInfoif TYPE_CHECKING:from prices import TaxedMoney+from ..account.models import Addressfrom ..channel.models import Channel+ from ..plugins.manager import PluginsManagerfrom ..product.models import (Collection,Product,ProductVariant,ProductVariantChannelListing,)- from ..plugins.manager import PluginsManager- from .models import Checkout, CheckoutLinefrom . import CheckoutLineInfo+ from .models import Checkout, CheckoutLinedef checkout_shipping_price(diff --git a/saleor/checkout/checkout_cleaner.py b/saleor/checkout/checkout_cleaner.pyindex 6dde2660b0..31141467fe 100644--- a/saleor/checkout/checkout_cleaner.py+++ b/saleor/checkout/checkout_cleaner.py@@ -3,7 +3,8 @@ from typing import TYPE_CHECKING, Iterable, Optional, Type, Unionfrom django.core.exceptions import ValidationErrorfrom ..discount import DiscountInfo-from ..payment import gateway, models as payment_models+from ..payment import gateway+from ..payment import models as payment_modelsfrom ..payment.error_codes import PaymentErrorCodefrom ..plugins.manager import PluginsManagerfrom . import CheckoutLineInfodiff --git a/saleor/checkout/complete_checkout.py b/saleor/checkout/complete_checkout.pyindex 80b826c666..a0f4679c5b 100644--- a/saleor/checkout/complete_checkout.py+++ b/saleor/checkout/complete_checkout.py@@ -460,7 +460,10 @@ def _get_order_data("""Prepare data that will be converted to order and its lines."""try:order_data = _prepare_order_data(- manager=manager, checkout=checkout, lines=lines, discounts=discounts,+ manager=manager,+ checkout=checkout,+ lines=lines,+ discounts=discounts,)except InsufficientStock as e:raise ValidationError(f"Insufficient product stock: {e.item}", code=e.code)@@ -557,7 +560,9 @@ def complete_checkout(if not action_required:try:order = _create_order(- checkout=checkout, order_data=order_data, user=user, # type: ignore+ checkout=checkout,+ order_data=order_data,+ user=user, # type: ignore)# remove checkout after order is successfully createdcheckout.delete()diff --git a/saleor/checkout/migrations/0025_auto_20200221_0257.py b/saleor/checkout/migrations/0025_auto_20200221_0257.pyindex 1d24163fd1..de47f44b91 100644--- a/saleor/checkout/migrations/0025_auto_20200221_0257.py+++ b/saleor/checkout/migrations/0025_auto_20200221_0257.py@@ -11,9 +11,13 @@ class Migration(migrations.Migration):operations = [migrations.RenameField(- model_name="checkout", old_name="meta", new_name="metadata",+ model_name="checkout",+ old_name="meta",+ new_name="metadata",),migrations.RenameField(- model_name="checkout", old_name="private_meta", new_name="private_metadata",+ model_name="checkout",+ old_name="private_meta",+ new_name="private_metadata",),]diff --git a/saleor/checkout/migrations/0030_checkout_channel_listing.py b/saleor/checkout/migrations/0030_checkout_channel_listing.pyindex 231005d192..db1275794a 100644--- a/saleor/checkout/migrations/0030_checkout_channel_listing.py+++ b/saleor/checkout/migrations/0030_checkout_channel_listing.py@@ -18,7 +18,8 @@ def add_channel_slug(apps, schema_editor):if not channel:name = f"Channel {currency}"channel, _ = Channel.objects.get_or_create(- currency_code=currency, defaults={"name": name, "slug": slugify(name)},+ currency_code=currency,+ defaults={"name": name, "slug": slugify(name)},)channels_dict[currency] = channeldiff --git a/saleor/checkout/models.py b/saleor/checkout/models.pyindex b27da6fce8..2a491d0760 100644--- a/saleor/checkout/models.py+++ b/saleor/checkout/models.py@@ -25,9 +25,9 @@ if TYPE_CHECKING:# flake8: noqafrom django_measurement import Weight+ from ..checkout.utils import CheckoutLineInfofrom ..payment.models import Paymentfrom ..product.models import ProductVariant- from ..checkout.utils import CheckoutLineInfodef get_default_country():@@ -50,7 +50,9 @@ class Checkout(ModelWithMetadata):token = models.UUIDField(primary_key=True, default=uuid4, editable=False)quantity = models.PositiveIntegerField(default=0)channel = models.ForeignKey(- Channel, related_name="checkouts", on_delete=models.PROTECT,+ Channel,+ related_name="checkouts",+ on_delete=models.PROTECT,)billing_address = models.ForeignKey(Address, related_name="+", editable=False, null=True, on_delete=models.SET_NULL@@ -67,7 +69,9 @@ class Checkout(ModelWithMetadata):)note = models.TextField(blank=True, default="")- currency = models.CharField(max_length=settings.DEFAULT_CURRENCY_CODE_LENGTH,)+ currency = models.CharField(+ max_length=settings.DEFAULT_CURRENCY_CODE_LENGTH,+ )country = CountryField(default=get_default_country)discount_amount = models.DecimalField(diff --git a/saleor/checkout/tests/test_checkout.py b/saleor/checkout/tests/test_checkout.pyindex 8b56ca9d13..539a8e364d 100644--- a/saleor/checkout/tests/test_checkout.py+++ b/saleor/checkout/tests/test_checkout.py@@ -634,13 +634,16 @@ def test_recalculate_checkout_discount_with_sale(lines = fetch_checkout_lines(checkout)recalculate_checkout_discount(manager, checkout, lines, [discount_info])assert checkout.discount == Money("1.50", "USD")- assert calculations.checkout_total(- manager=manager,- checkout=checkout,- lines=lines,- address=checkout.shipping_address,- discounts=[discount_info],- ).gross == Money("13.50", "USD")+ assert (+ calculations.checkout_total(+ manager=manager,+ checkout=checkout,+ lines=lines,+ address=checkout.shipping_address,+ discounts=[discount_info],+ ).gross+ == Money("13.50", "USD")+ )def test_recalculate_checkout_discount_voucher_not_applicable(@@ -683,12 +686,15 @@ def test_recalculate_checkout_discount_free_shipping_subtotal_less_than_shippingmanager = get_plugins_manager()lines = fetch_checkout_lines(checkout)channel_listing = shipping_method.channel_listings.get(channel_id=channel_USD.id)- channel_listing.price = calculations.checkout_subtotal(- manager=manager,- checkout=checkout,- lines=lines,- address=checkout.shipping_address,- ).gross + Money("10.00", "USD")+ channel_listing.price = (+ calculations.checkout_subtotal(+ manager=manager,+ checkout=checkout,+ lines=lines,+ address=checkout.shipping_address,+ ).gross+ + Money("10.00", "USD")+ )channel_listing.save()recalculate_checkout_discount(manager, checkout, lines, None)@@ -720,12 +726,15 @@ def test_recalculate_checkout_discount_free_shipping_subtotal_bigger_than_shippimanager = get_plugins_manager()lines = fetch_checkout_lines(checkout)channel_listing = shipping_method.channel_listings.get(channel=channel_USD)- channel_listing.price = calculations.checkout_subtotal(- manager=manager,- checkout=checkout,- lines=lines,- address=checkout.shipping_address,- ).gross - Money("1.00", "USD")+ channel_listing.price = (+ calculations.checkout_subtotal(+ manager=manager,+ checkout=checkout,+ lines=lines,+ address=checkout.shipping_address,+ ).gross+ - Money("1.00", "USD")+ )channel_listing.save()recalculate_checkout_discount(manager, checkout, lines, None)@@ -847,7 +856,10 @@ def test_add_voucher_to_checkout_fail(lines = fetch_checkout_lines(checkout_with_item)with pytest.raises(NotApplicable):add_voucher_to_checkout(- manager, checkout_with_item, lines, voucher_with_high_min_spent_amount,+ manager,+ checkout_with_item,+ lines,+ voucher_with_high_min_spent_amount,)assert checkout_with_item.voucher_code is Nonediff --git a/saleor/checkout/tests/test_checkout_complete.py b/saleor/checkout/tests/test_checkout_complete.pyindex 1698a1135d..1c8fb32063 100644--- a/saleor/checkout/tests/test_checkout_complete.py+++ b/saleor/checkout/tests/test_checkout_complete.py@@ -17,7 +17,10 @@ from ..utils import add_variant_to_checkout, fetch_checkout_linesdef test_create_order_captured_payment_creates_expected_events(- checkout_with_item, customer_user, shipping_method, payment_txn_captured,+ checkout_with_item,+ customer_user,+ shipping_method,+ payment_txn_captured,):checkout = checkout_with_itemcheckout_user = customer_user@@ -42,7 +45,10 @@ def test_create_order_captured_payment_creates_expected_events(order = _create_order(checkout=checkout,order_data=_prepare_order_data(- manager=manager, checkout=checkout, lines=lines, discounts=None,+ manager=manager,+ checkout=checkout,+ lines=lines,+ discounts=None,),user=customer_user,)@@ -149,7 +155,10 @@ def test_create_order_captured_payment_creates_expected_events(def test_create_order_captured_payment_creates_expected_events_anonymous_user(- checkout_with_item, customer_user, shipping_method, payment_txn_captured,+ checkout_with_item,+ customer_user,+ shipping_method,+ payment_txn_captured,):checkout = checkout_with_itemcheckout_user = None@@ -175,7 +184,10 @@ def test_create_order_captured_payment_creates_expected_events_anonymous_user(order = _create_order(checkout=checkout,order_data=_prepare_order_data(- manager=manager, checkout=checkout, lines=lines, discounts=None,+ manager=manager,+ checkout=checkout,+ lines=lines,+ discounts=None,),user=AnonymousUser(),)@@ -275,7 +287,10 @@ def test_create_order_captured_payment_creates_expected_events_anonymous_user(def test_create_order_preauth_payment_creates_expected_events(- checkout_with_item, customer_user, shipping_method, payment_txn_preauth,+ checkout_with_item,+ customer_user,+ shipping_method,+ payment_txn_preauth,):checkout = checkout_with_itemcheckout_user = customer_user@@ -300,7 +315,10 @@ def test_create_order_preauth_payment_creates_expected_events(order = _create_order(checkout=checkout,order_data=_prepare_order_data(- manager=manager, checkout=checkout, lines=lines, discounts=None,+ manager=manager,+ checkout=checkout,+ lines=lines,+ discounts=None,),user=customer_user,)@@ -378,7 +396,10 @@ def test_create_order_preauth_payment_creates_expected_events(def test_create_order_preauth_payment_creates_expected_events_anonymous_user(- checkout_with_item, customer_user, shipping_method, payment_txn_preauth,+ checkout_with_item,+ customer_user,+ shipping_method,+ payment_txn_preauth,):checkout = checkout_with_itemcheckout_user = None@@ -404,7 +425,10 @@ def test_create_order_preauth_payment_creates_expected_events_anonymous_user(order = _create_order(checkout=checkout,order_data=_prepare_order_data(- manager=manager, checkout=checkout, lines=lines, discounts=None,+ manager=manager,+ checkout=checkout,+ lines=lines,+ discounts=None,),user=AnonymousUser(),)@@ -489,7 +513,10 @@ def test_create_order_insufficient_stock(lines = fetch_checkout_lines(checkout)with pytest.raises(InsufficientStock):_prepare_order_data(- manager=manager, checkout=checkout, lines=lines, discounts=None,+ manager=manager,+ checkout=checkout,+ lines=lines,+ discounts=None,)@@ -512,12 +539,16 @@ def test_create_order_doesnt_duplicate_order()order_1 = _create_order(- checkout=checkout, order_data=order_data, user=customer_user,+ checkout=checkout,+ order_data=order_data,+ user=customer_user,)assert order_1.checkout_token == checkout.tokenorder_2 = _create_order(- checkout=checkout, order_data=order_data, user=customer_user,+ checkout=checkout,+ order_data=order_data,+ user=customer_user,)assert order_1.pk == order_2.pk@@ -559,7 +590,10 @@ def test_create_order_with_gift_card(order = _create_order(checkout=checkout,order_data=_prepare_order_data(- manager=manager, checkout=checkout, lines=lines, discounts=None,+ manager=manager,+ checkout=checkout,+ lines=lines,+ discounts=None,),user=customer_user if not is_anonymous_user else AnonymousUser(),)@@ -598,7 +632,10 @@ def test_create_order_with_gift_card_partial_use(order = _create_order(checkout=checkout,order_data=_prepare_order_data(- manager=manager, checkout=checkout, lines=lines, discounts=None,+ manager=manager,+ checkout=checkout,+ lines=lines,+ discounts=None,),user=customer_user,)@@ -651,7 +688,10 @@ def test_create_order_with_many_gift_cards(order = _create_order(checkout=checkout,order_data=_prepare_order_data(- manager=manager, checkout=checkout, lines=lines, discounts=None,+ manager=manager,+ checkout=checkout,+ lines=lines,+ discounts=None,),user=customer_user,)@@ -678,7 +718,10 @@ def test_note_in_created_order(checkout_with_item, address, customer_user):order = _create_order(checkout=checkout_with_item,order_data=_prepare_order_data(- manager=manager, checkout=checkout_with_item, lines=lines, discounts=None,+ manager=manager,+ checkout=checkout_with_item,+ lines=lines,+ discounts=None,),user=customer_user,)@@ -705,7 +748,9 @@ def test_create_order_with_variant_tracking_false()order_1 = _create_order(- checkout=checkout, order_data=order_data, user=customer_user,+ checkout=checkout,+ order_data=order_data,+ user=customer_user,)assert order_1.checkout_token == checkout.token@@ -733,10 +778,14 @@ def test_create_order_use_tanslations(product = lines[0].productProductTranslation.objects.create(- language_code="fr", product=product, name=translated_product_name,+ language_code="fr",+ product=product,+ name=translated_product_name,)ProductVariantTranslation.objects.create(- language_code="fr", product_variant=variant, name=translated_variant_name,+ language_code="fr",+ product_variant=variant,+ name=translated_variant_name,)order_data = _prepare_order_data(diff --git a/saleor/checkout/utils.py b/saleor/checkout/utils.pyindex 9c2c41740d..70fa487307 100644--- a/saleor/checkout/utils.py+++ b/saleor/checkout/utils.py@@ -36,9 +36,10 @@ from .models import Checkout, CheckoutLineif TYPE_CHECKING:# flake8: noqa- from ..account.models import Addressfrom prices import TaxedMoney+ from ..account.models import Address+def get_user_checkout(user: User, checkout_queryset=Checkout.objects.all()@@ -116,7 +117,8 @@ def add_variants_to_checkout(checkout, variants, quantities):check_stock_quantity_bulk(variants, country_code, quantities)channel_listings = product_models.ProductChannelListing.objects.filter(- channel_id=checkout.channel.id, product_id__in=[v.product_id for v in variants],+ channel_id=checkout.channel.id,+ product_id__in=[v.product_id for v in variants],)channel_listings_by_product_id = {cl.product_id: cl for cl in channel_listings}diff --git a/saleor/core/jwt.py b/saleor/core/jwt.pyindex 69d5dbd04d..aeed424edb 100644--- a/saleor/core/jwt.py+++ b/saleor/core/jwt.py@@ -51,7 +51,9 @@ def jwt_user_payload(def jwt_encode(payload: Dict[str, Any]) -> str:return jwt.encode(- payload, settings.SECRET_KEY, JWT_ALGORITHM, # type: ignore+ payload,+ settings.SECRET_KEY, # type: ignore+ JWT_ALGORITHM,).decode("utf-8")@@ -82,7 +84,10 @@ def create_refresh_token(user: User, additional_payload: Optional[Dict[str, Any]] = None) -> str:payload = jwt_user_payload(- user, JWT_REFRESH_TYPE, settings.JWT_TTL_REFRESH, additional_payload,+ user,+ JWT_REFRESH_TYPE,+ settings.JWT_TTL_REFRESH,+ additional_payload,)return jwt_encode(payload)diff --git a/saleor/core/payments.py b/saleor/core/payments.pyindex 8629f94332..8b2a9c545b 100644--- a/saleor/core/payments.py+++ b/saleor/core/payments.py@@ -23,7 +23,8 @@ class PaymentInterface(ABC):@abstractmethoddef checkout_available_payment_gateways(- self, checkout: "Checkout",+ self,+ checkout: "Checkout",) -> List["PaymentGateway"]:passdiff --git a/saleor/core/tests/test_auth_backend.py b/saleor/core/tests/test_auth_backend.pyindex 5e9ddd6a66..88116b4cbb 100644--- a/saleor/core/tests/test_auth_backend.py+++ b/saleor/core/tests/test_auth_backend.py@@ -44,8 +44,16 @@ def test_incorect_type_of_token(rf, staff_user):def test_incorrect_token(rf, staff_user, settings):- payload = jwt_user_payload(staff_user, JWT_ACCESS_TYPE, settings.JWT_TTL_ACCESS,)- token = jwt.encode(payload, "Wrong secret", JWT_ALGORITHM,).decode("utf-8")+ payload = jwt_user_payload(+ staff_user,+ JWT_ACCESS_TYPE,+ settings.JWT_TTL_ACCESS,+ )+ token = jwt.encode(+ payload,+ "Wrong secret",+ JWT_ALGORITHM,+ ).decode("utf-8")request = rf.request(HTTP_AUTHORIZATION=f"JWT {token}")backend = JSONWebTokenBackend()with pytest.raises(InvalidSignatureError):diff --git a/saleor/core/tests/test_postgresql_search.py b/saleor/core/tests/test_postgresql_search.pyindex 2312b0c9f3..ede00a57f1 100644--- a/saleor/core/tests/test_postgresql_search.py+++ b/saleor/core/tests/test_postgresql_search.py@@ -23,7 +23,9 @@ def named_products(category, product_type, channel_USD):category=category,)ProductChannelListing.objects.create(- product=product, channel=channel_USD, is_published=True,+ product=product,+ channel=channel_USD,+ is_published=True,)return productdiff --git a/saleor/core/utils/__init__.py b/saleor/core/utils/__init__.pyindex d40b3939c3..3da46af46a 100644--- a/saleor/core/utils/__init__.py+++ b/saleor/core/utils/__init__.py@@ -134,7 +134,9 @@ def create_thumbnails(pk, model, size_set, image_attr=None):def generate_unique_slug(- instance: Type[Model], slugable_value: str, slug_field_name: str = "slug",+ instance: Type[Model],+ slugable_value: str,+ slug_field_name: str = "slug",) -> str:"""Create unique slug for model instance.@@ -157,9 +159,7 @@ def generate_unique_slug(search_field = f"{slug_field_name}__iregex"pattern = rf"{slug}-\d+$|{slug}$"slug_values = (- ModelClass._default_manager.filter( # type: ignore- **{search_field: pattern}- )+ ModelClass._default_manager.filter(**{search_field: pattern}) # type: ignore.exclude(pk=instance.pk).values_list(slug_field_name, flat=True))diff --git a/saleor/core/utils/json_serializer.py b/saleor/core/utils/json_serializer.pyindex 5de21b529e..a558f32573 100644--- a/saleor/core/utils/json_serializer.py+++ b/saleor/core/utils/json_serializer.py@@ -1,4 +1,5 @@-from django.core.serializers.json import DjangoJSONEncoder, Serializer as JsonSerializer+from django.core.serializers.json import DjangoJSONEncoder+from django.core.serializers.json import Serializer as JsonSerializerfrom draftjs_sanitizer import SafeJSONEncoderfrom prices import Moneydiff --git a/saleor/core/utils/random_data.py b/saleor/core/utils/random_data.pyindex 0c11bf1816..8f1c65f4a1 100644--- a/saleor/core/utils/random_data.py+++ b/saleor/core/utils/random_data.py@@ -328,7 +328,8 @@ def assign_attributes_to_product_types(def assign_attributes_to_page_types(- association_model: AttributePage, attributes: list,+ association_model: AttributePage,+ attributes: list,):for value in attributes:pk = value["pk"]@@ -700,7 +701,8 @@ def create_fake_order(discounts, max_order_lines=5):def create_fake_sale():sale = Sale.objects.create(- name="Happy %s day!" % fake.word(), type=DiscountValueType.PERCENTAGE,+ name="Happy %s day!" % fake.word(),+ type=DiscountValueType.PERCENTAGE,)for channel in Channel.objects.all():SaleChannelListing.objects.create(@@ -806,7 +808,8 @@ def create_channels():slug=settings.DEFAULT_CHANNEL_SLUG,)yield create_channel(- channel_name="Channel-PLN", currency_code="PLN",+ channel_name="Channel-PLN",+ currency_code="PLN",)diff --git a/saleor/csv/tests/export/test_export.py b/saleor/csv/tests/export/test_export.pyindex a273cdde0e..adfc324344 100644--- a/saleor/csv/tests/export/test_export.py+++ b/saleor/csv/tests/export/test_export.py@@ -25,7 +25,8 @@ from ...utils.export import (@pytest.mark.parametrize(- "file_type", [FileTypes.CSV, FileTypes.XLSX],+ "file_type",+ [FileTypes.CSV, FileTypes.XLSX],)@patch("saleor.csv.utils.export.create_file_with_headers")@patch("saleor.csv.utils.export.export_products_in_batches")@@ -111,7 +112,14 @@ def test_export_products_ids(assert set(args[0].values_list("pk", flat=True)) == set(Product.objects.filter(pk__in=pks).values_list("pk", flat=True))- assert args[1:] == (export_info, {"id"}, ["id"], ";", mock_file, file_type,)+ assert args[1:] == (+ export_info,+ {"id"},+ ["id"],+ ";",+ mock_file,+ file_type,+ )send_email_mock.assert_called_once_with(user_export_file, user_export_file.user.email, "export_products_success")@@ -163,7 +171,14 @@ def test_export_products_filter_is_published(channel_listings__is_published=True, channel_listings__channel=channel_USD).values_list("pk", flat=True))- assert args[1:] == (export_info, {"id"}, ["id"], ";", mock_file, file_type,)+ assert args[1:] == (+ export_info,+ {"id"},+ ["id"],+ ";",+ mock_file,+ file_type,+ )send_email_mock.assert_called_once_with(user_export_file, user_export_file.user.email, "export_products_success")@@ -444,7 +459,10 @@ def test_append_to_file_for_xlsx(user_export_file, tmpdir, media_root):@patch("saleor.csv.utils.export.BATCH_SIZE", 1)def test_export_products_in_batches_for_csv(- product_list, user_export_file, tmpdir, media_root,+ product_list,+ user_export_file,+ tmpdir,+ media_root,):# givenqs = Product.objects.all()@@ -498,7 +516,10 @@ def test_export_products_in_batches_for_csv(@patch("saleor.csv.utils.export.BATCH_SIZE", 1)def test_export_products_in_batches_for_xlsx(- product_list, user_export_file, tmpdir, media_root,+ product_list,+ user_export_file,+ tmpdir,+ media_root,):# givenqs = Product.objects.all()diff --git a/saleor/csv/utils/products_data.py b/saleor/csv/utils/products_data.pyindex d4ed69e9ee..83dd7356b5 100644--- a/saleor/csv/utils/products_data.py+++ b/saleor/csv/utils/products_data.py@@ -3,7 +3,9 @@ from typing import TYPE_CHECKING, Dict, List, Optional, Set, Unionfrom urllib.parse import urljoinfrom django.conf import settings-from django.db.models import Case, CharField, Value as V, When+from django.db.models import Case, CharField+from django.db.models import Value as V+from django.db.models import Whenfrom django.db.models.functions import Concatfrom ...attribute import AttributeInputTypediff --git a/saleor/discount/__init__.py b/saleor/discount/__init__.pyindex 4d428c9dc1..ed8d3243a9 100644--- a/saleor/discount/__init__.py+++ b/saleor/discount/__init__.py@@ -5,7 +5,7 @@ from django.conf import settingsif TYPE_CHECKING:# flake8: noqa- from .models import Sale, Voucher, SaleChannelListing+ from .models import Sale, SaleChannelListing, Voucherclass DiscountValueType:diff --git a/saleor/discount/migrations/0019_auto_20200217_0350.py b/saleor/discount/migrations/0019_auto_20200217_0350.pyindex 3c4d3c0ade..0b4ce2c7cf 100644--- a/saleor/discount/migrations/0019_auto_20200217_0350.py+++ b/saleor/discount/migrations/0019_auto_20200217_0350.py@@ -21,9 +21,13 @@ class Migration(migrations.Migration):name="saletranslation",options={"ordering": ("language_code", "name", "pk")},),- migrations.AlterModelOptions(name="voucher", options={"ordering": ("code",)},),migrations.AlterModelOptions(- name="vouchercustomer", options={"ordering": ("voucher", "customer_email")},+ name="voucher",+ options={"ordering": ("code",)},+ ),+ migrations.AlterModelOptions(+ name="vouchercustomer",+ options={"ordering": ("voucher", "customer_email")},),migrations.AlterModelOptions(name="vouchertranslation",diff --git a/saleor/discount/migrations/0022_sale_channel_listing.py b/saleor/discount/migrations/0022_sale_channel_listing.pyindex 8084fed42a..82efdc70ff 100644--- a/saleor/discount/migrations/0022_sale_channel_listing.py+++ b/saleor/discount/migrations/0022_sale_channel_listing.py@@ -70,7 +70,10 @@ class Migration(migrations.Migration):options={"ordering": ("pk",), "unique_together": {("sale", "channel")}},),migrations.RunPython(migrate_sale_data, migrations.RunPython.noop),- migrations.RemoveField(model_name="sale", name="value",),+ migrations.RemoveField(+ model_name="sale",+ name="value",+ ),migrations.AlterField(model_name="sale",name="type",diff --git a/saleor/discount/migrations/0023_voucher_channel_listing.py b/saleor/discount/migrations/0023_voucher_channel_listing.pyindex 2441d48c53..772fd064ef 100644--- a/saleor/discount/migrations/0023_voucher_channel_listing.py+++ b/saleor/discount/migrations/0023_voucher_channel_listing.py@@ -82,9 +82,18 @@ class Migration(migrations.Migration):options={"ordering": ("pk",), "unique_together": {("voucher", "channel")}},),migrations.RunPython(migrate_voucher_data, migrations.RunPython.noop),- migrations.RemoveField(model_name="voucher", name="currency",),- migrations.RemoveField(model_name="voucher", name="discount_value",),- migrations.RemoveField(model_name="voucher", name="min_spent_amount",),+ migrations.RemoveField(+ model_name="voucher",+ name="currency",+ ),+ migrations.RemoveField(+ model_name="voucher",+ name="discount_value",+ ),+ migrations.RemoveField(+ model_name="voucher",+ name="min_spent_amount",+ ),migrations.AlterField(model_name="voucher",name="discount_value_type",diff --git a/saleor/discount/models.py b/saleor/discount/models.pyindex 895929479c..e603e9f097 100644--- a/saleor/discount/models.py+++ b/saleor/discount/models.py@@ -131,7 +131,8 @@ class Voucher(models.Model):f"{min_checkout_items_quantity} quantity.")raise NotApplicable(- msg, min_checkout_items_quantity=min_checkout_items_quantity,+ msg,+ min_checkout_items_quantity=min_checkout_items_quantity,)def validate_once_per_customer(self, customer_email):@@ -163,7 +164,9 @@ class VoucherChannelListing(models.Model):decimal_places=settings.DEFAULT_DECIMAL_PLACES,)discount = MoneyField(amount_field="discount_value", currency_field="currency")- currency = models.CharField(max_length=settings.DEFAULT_CURRENCY_CODE_LENGTH,)+ currency = models.CharField(+ max_length=settings.DEFAULT_CURRENCY_CODE_LENGTH,+ )min_spent_amount = models.DecimalField(max_digits=settings.DEFAULT_MAX_DIGITS,decimal_places=settings.DEFAULT_DECIMAL_PLACES,@@ -241,7 +244,10 @@ class Sale(models.Model):)def __repr__(self):- return "Sale(name=%r, type=%s)" % (str(self.name), self.get_type_display(),)+ return "Sale(name=%r, type=%s)" % (+ str(self.name),+ self.get_type_display(),+ )def __str__(self):return self.name@@ -256,7 +262,8 @@ class Sale(models.Model):return partial(fixed_discount, discount=discount_amount)if self.type == DiscountValueType.PERCENTAGE:return partial(- percentage_discount, percentage=sale_channel_listing.discount_value,+ percentage_discount,+ percentage=sale_channel_listing.discount_value,)raise NotImplementedError("Unknown discount type")@@ -281,7 +288,9 @@ class SaleChannelListing(models.Model):decimal_places=settings.DEFAULT_DECIMAL_PLACES,default=0,)- currency = models.CharField(max_length=settings.DEFAULT_CURRENCY_CODE_LENGTH,)+ currency = models.CharField(+ max_length=settings.DEFAULT_CURRENCY_CODE_LENGTH,+ )class Meta:unique_together = [["sale", "channel"]]diff --git a/saleor/discount/utils.py b/saleor/discount/utils.pyindex 4c10b85f4c..1f2264a0fe 100644--- a/saleor/discount/utils.py+++ b/saleor/discount/utils.py@@ -14,7 +14,6 @@ from .models import NotApplicable, Sale, SaleChannelListing, VoucherCustomerif TYPE_CHECKING:# flake8: noqa- from .models import Voucherfrom ..checkout import CheckoutLineInfofrom ..checkout.models import Checkoutfrom ..order.models import Order@@ -129,7 +128,11 @@ def validate_voucher_for_checkout(customer_email = checkout.get_customer_email()validate_voucher(- voucher, subtotal.gross, checkout.quantity, customer_email, checkout.channel,+ voucher,+ subtotal.gross,+ checkout.quantity,+ customer_email,+ checkout.channel,)@@ -213,7 +216,9 @@ def fetch_products(sale_pks: Iterable[str]) -> Dict[int, Set[int]]:return product_map-def fetch_sale_channel_listings(sale_pks: Iterable[str],):+def fetch_sale_channel_listings(+ sale_pks: Iterable[str],+):channel_listings = SaleChannelListing.objects.filter(sale_id__in=sale_pks).annotate(channel_slug=F("channel__slug"))diff --git a/saleor/graphql/account/mutations/account.py b/saleor/graphql/account/mutations/account.pyindex 1ab7b09598..9fc3a3932b 100644--- a/saleor/graphql/account/mutations/account.py+++ b/saleor/graphql/account/mutations/account.py@@ -5,7 +5,9 @@ from django.contrib.auth import password_validationfrom django.contrib.auth.tokens import default_token_generatorfrom django.core.exceptions import ValidationError-from ....account import emails, events as account_events, models, utils+from ....account import emails+from ....account import events as account_events+from ....account import models, utilsfrom ....account.error_codes import AccountErrorCodefrom ....checkout import AddressTypefrom ....core.jwt import create_token, jwt_decodediff --git a/saleor/graphql/account/mutations/base.py b/saleor/graphql/account/mutations/base.pyindex 87aa328e30..35f5fa259e 100644--- a/saleor/graphql/account/mutations/base.py+++ b/saleor/graphql/account/mutations/base.py@@ -4,7 +4,8 @@ from django.contrib.auth.tokens import default_token_generatorfrom django.core.exceptions import ObjectDoesNotExist, ValidationErrorfrom django.db import transaction-from ....account import events as account_events, models+from ....account import events as account_events+from ....account import modelsfrom ....account.emails import (send_set_password_email_with_url,send_user_password_reset_email_with_url,diff --git a/saleor/graphql/account/mutations/permission_group.py b/saleor/graphql/account/mutations/permission_group.pyindex f3cfb0a13a..ce7635ba17 100644--- a/saleor/graphql/account/mutations/permission_group.py+++ b/saleor/graphql/account/mutations/permission_group.py@@ -68,7 +68,10 @@ class PermissionGroupCreate(ModelMutation):@classmethoddef clean_input(- cls, info, instance, data,+ cls,+ info,+ instance,+ data,):cleaned_input = super().clean_input(info, instance, data)@@ -204,7 +207,10 @@ class PermissionGroupUpdate(PermissionGroupCreate):@classmethoddef clean_input(- cls, info, instance, data,+ cls,+ info,+ instance,+ data,):requestor = info.context.usercls.ensure_requestor_can_manage_group(requestor, instance)@@ -257,7 +263,10 @@ class PermissionGroupUpdate(PermissionGroupCreate):@classmethoddef ensure_permissions_can_be_removed(- cls, errors: dict, group: auth_models.Group, permissions: List["str"],+ cls,+ errors: dict,+ group: auth_models.Group,+ permissions: List["str"],):missing_perms = get_not_manageable_permissions_after_removing_perms_from_group(group, permissions@@ -379,7 +388,10 @@ class PermissionGroupUpdate(PermissionGroupCreate):@classmethoddef check_for_duplicates(- cls, errors: dict, input_data: dict, fields: Tuple[str, str, str],+ cls,+ errors: dict,+ input_data: dict,+ fields: Tuple[str, str, str],):"""Check if any items are on both input field.diff --git a/saleor/graphql/account/mutations/staff.py b/saleor/graphql/account/mutations/staff.pyindex 68d5166ae7..7e68fd3655 100644--- a/saleor/graphql/account/mutations/staff.py+++ b/saleor/graphql/account/mutations/staff.py@@ -5,7 +5,8 @@ import graphenefrom django.core.exceptions import ValidationErrorfrom django.db import transaction-from ....account import events as account_events, models, utils+from ....account import events as account_events+from ....account import models, utilsfrom ....account.emails import send_set_password_email_with_urlfrom ....account.error_codes import AccountErrorCodefrom ....account.thumbnails import create_user_avatar_thumbnailsdiff --git a/saleor/graphql/account/tests/test_account.py b/saleor/graphql/account/tests/test_account.pyindex 072f0663b8..59d6b3ed78 100644--- a/saleor/graphql/account/tests/test_account.py+++ b/saleor/graphql/account/tests/test_account.py@@ -2166,7 +2166,10 @@ def test_staff_update_duplicated_input_items(def test_staff_update_doesnt_change_existing_avatar(- staff_api_client, permission_manage_staff, media_root, staff_users,+ staff_api_client,+ permission_manage_staff,+ media_root,+ staff_users,):query = STAFF_UPDATE_MUTATIONS@@ -3839,7 +3842,9 @@ def test_query_staff_members_with_filter_status(def test_query_staff_members_app_no_permission(- query_staff_users_with_filter, app_api_client, permission_manage_staff,+ query_staff_users_with_filter,+ app_api_client,+ permission_manage_staff,):User.objects.bulk_create(@@ -4117,7 +4122,9 @@ def test_address_query_as_not_owner(def test_address_query_as_app_with_permission(- app_api_client, address_other_country, permission_manage_users,+ app_api_client,+ address_other_country,+ permission_manage_users,):variables = {"id": graphene.Node.to_global_id("Address", address_other_country.pk)}response = app_api_client.post_graphql(diff --git a/saleor/graphql/account/tests/test_account_permission_group.py b/saleor/graphql/account/tests/test_account_permission_group.pyindex b56465cbaf..6f2babbc13 100644--- a/saleor/graphql/account/tests/test_account_permission_group.py+++ b/saleor/graphql/account/tests/test_account_permission_group.py@@ -1096,7 +1096,9 @@ def test_permission_group_update_mutation_permissions_in_list_to_add_and_remove(the problem."""staff_user.user_permissions.add(- permission_manage_users, permission_manage_apps, permission_manage_orders,+ permission_manage_users,+ permission_manage_apps,+ permission_manage_orders,)group = permission_group_manage_usersquery = PERMISSION_GROUP_UPDATE_MUTATION@@ -1142,7 +1144,9 @@ def test_permission_group_update_mutation_permissions_and_users_duplicated("""staff_user = staff_users[0]staff_user.user_permissions.add(- permission_manage_users, permission_manage_apps, permission_manage_orders,+ permission_manage_users,+ permission_manage_apps,+ permission_manage_orders,)group = permission_group_manage_usersquery = PERMISSION_GROUP_UPDATE_MUTATION@@ -1467,7 +1471,7 @@ def test_permission_group_update_mutation_remove_all_users_manageable_perms(staff_api_client,):"""Ensure that user can remove group users if there is other source of all group- permissions. """+ permissions."""staff_user, staff_user1, staff_user2 = staff_usersgroups = Group.objects.bulk_create(@@ -1787,7 +1791,10 @@ def test_permission_group_update_mutation_remove_user_with_manage_staff_add_user},}- response = staff_api_client.post_graphql(query, variables,)+ response = staff_api_client.post_graphql(+ query,+ variables,+ )content = get_graphql_content(response)data = content["data"]["permissionGroupUpdate"]errors = data["permissionGroupErrors"]@@ -2164,7 +2171,10 @@ def test_permission_groups_query(def test_permission_groups_app_no_permission(- permission_group_manage_users, permission_manage_staff, app_api_client, app,+ permission_group_manage_users,+ permission_manage_staff,+ app_api_client,+ app,):app.permissions.add(permission_manage_staff)query = QUERY_PERMISSION_GROUP_WITH_FILTER@@ -2179,7 +2189,9 @@ def test_permission_groups_app_no_permission(def test_permission_groups_no_permission_to_perform(- permission_group_manage_users, permission_manage_staff, staff_api_client,+ permission_group_manage_users,+ permission_manage_staff,+ staff_api_client,):query = QUERY_PERMISSION_GROUP_WITH_FILTER@@ -2344,7 +2356,9 @@ def test_permission_group_query_user_cannot_manage(def test_permission_group_no_permission_to_perform(- permission_group_manage_users, permission_manage_staff, staff_api_client,+ permission_group_manage_users,+ permission_manage_staff,+ staff_api_client,):group = permission_group_manage_usersquery = QUERY_PERMISSION_GROUPdiff --git a/saleor/graphql/account/tests/test_account_utils.py b/saleor/graphql/account/tests/test_account_utils.pyindex ab1509a3e1..2ec71c8645 100644--- a/saleor/graphql/account/tests/test_account_utils.py+++ b/saleor/graphql/account/tests/test_account_utils.py@@ -95,7 +95,8 @@ def test_get_out_of_scope_permissions_app_has_all_permissions():app.permissions.add(permission_manage_orders, permission_manage_users)missing_perms = get_out_of_scope_permissions(- app, [AccountPermissions.MANAGE_USERS, OrderPermissions.MANAGE_ORDERS],+ app,+ [AccountPermissions.MANAGE_USERS, OrderPermissions.MANAGE_ORDERS],)assert missing_perms == []@@ -105,7 +106,8 @@ def test_get_out_of_scope_permissions_app_does_not_have_all_permissions():app.permissions.add(permission_manage_orders)missing_perms = get_out_of_scope_permissions(- app, [AccountPermissions.MANAGE_USERS, OrderPermissions.MANAGE_ORDERS],+ app,+ [AccountPermissions.MANAGE_USERS, OrderPermissions.MANAGE_ORDERS],)assert missing_perms == [AccountPermissions.MANAGE_USERS]@@ -231,7 +233,8 @@ def test_get_groups_which_user_can_manage_admin_user(def test_get_groups_which_user_can_manage_customer_user(- customer_user, permission_group_manage_users,+ customer_user,+ permission_group_manage_users,):Group.objects.create(name="empty group")@@ -801,7 +804,10 @@ def test_get_not_manageable_permissions_after_removing_perms_from_group_some_candef test_can_manage_app_no_permission(- app, staff_user, permission_manage_products, permission_manage_apps,+ app,+ staff_user,+ permission_manage_products,+ permission_manage_apps,):app.permissions.add(permission_manage_products)staff_user.user_permissions.add(permission_manage_apps)@@ -811,7 +817,10 @@ def test_can_manage_app_no_permission(def test_can_manage_app_account(- app, staff_user, permission_manage_products, permission_manage_apps,+ app,+ staff_user,+ permission_manage_products,+ permission_manage_apps,):app.permissions.add(permission_manage_products)staff_user.user_permissions.add(permission_manage_apps, permission_manage_products)@@ -821,7 +830,8 @@ def test_can_manage_app_account(def test_can_manage_app_for_app_no_permission(- permission_manage_products, permission_manage_apps,+ permission_manage_products,+ permission_manage_apps,):apps = App.objects.bulk_create([App(name="sa1"), App(name="sa2")])apps[1].permissions.add(permission_manage_products)@@ -832,7 +842,8 @@ def test_can_manage_app_for_app_no_permission(def test_can_manage_app_for_app(- permission_manage_products, permission_manage_apps,+ permission_manage_products,+ permission_manage_apps,):apps = App.objects.bulk_create([App(name="sa1"), App(name="sa2")])apps[1].permissions.add(permission_manage_products)diff --git a/saleor/graphql/account/tests/test_bulk_delete.py b/saleor/graphql/account/tests/test_bulk_delete.pyindex b2cc3dd9e9..65620a68d5 100644--- a/saleor/graphql/account/tests/test_bulk_delete.py+++ b/saleor/graphql/account/tests/test_bulk_delete.py@@ -337,8 +337,8 @@ def test_delete_staff_members_superuser_can_delete__out_of_scope_users(permission_manage_users,permission_manage_orders,):- """Ensure superuser can delete users when some users has wider scope of permissions.- """+ """Ensure superuser can delete users when+ some users has wider scope of permissions."""query = STAFF_BULK_DELETE_MUTATIONgroups = Group.objects.bulk_create(diff --git a/saleor/graphql/account/tests/test_pagination.py b/saleor/graphql/account/tests/test_pagination.pyindex b5150a1c62..f0eb15e6c3 100644--- a/saleor/graphql/account/tests/test_pagination.py+++ b/saleor/graphql/account/tests/test_pagination.py@@ -231,7 +231,8 @@ def test_query_customers_pagination_with_sort(variables = {"first": page_size, "after": None, "sortBy": customer_sort}staff_api_client.user.user_permissions.add(permission_manage_users)response = staff_api_client.post_graphql(- QUERY_CUSTOMERS_WITH_PAGINATION, variables,+ QUERY_CUSTOMERS_WITH_PAGINATION,+ variables,)content = get_graphql_content(response)nodes = content["data"]["customers"]["edges"]@@ -274,7 +275,8 @@ def test_query_customer_members_pagination_with_filter_search(variables = {"first": page_size, "after": None, "filter": customer_filter}staff_api_client.user.user_permissions.add(permission_manage_users)response = staff_api_client.post_graphql(- QUERY_CUSTOMERS_WITH_PAGINATION, variables,+ QUERY_CUSTOMERS_WITH_PAGINATION,+ variables,)content = get_graphql_content(response)diff --git a/saleor/graphql/account/types.py b/saleor/graphql/account/types.pyindex 18eea8c639..a24bbdeb8c 100644--- a/saleor/graphql/account/types.py+++ b/saleor/graphql/account/types.py@@ -1,5 +1,6 @@import graphene-from django.contrib.auth import get_user_model, models as auth_models+from django.contrib.auth import get_user_model+from django.contrib.auth import models as auth_modelsfrom graphene import relayfrom graphene_federation import keydiff --git a/saleor/graphql/account/utils.py b/saleor/graphql/account/utils.pyindex 65c5cc0d52..0e7c616f93 100644--- a/saleor/graphql/account/utils.py+++ b/saleor/graphql/account/utils.py@@ -338,7 +338,8 @@ def get_not_manageable_permissions_after_group_deleting(group):def get_not_manageable_permissions(- groups_data: dict, not_manageable_permissions: Set[str],+ groups_data: dict,+ not_manageable_permissions: Set[str],):# get users from groups with manage staff and look for not_manageable_permissions# if any of not_manageable_permissions is found it is removed from set@@ -403,7 +404,8 @@ def get_group_to_permissions_and_users_mapping():def get_users_and_look_for_permissions_in_groups_with_manage_staff(- groups_data: dict, permissions_to_find: Set[str],+ groups_data: dict,+ permissions_to_find: Set[str],):"""Search for permissions in groups with manage staff and return their users.@@ -430,7 +432,9 @@ def get_users_and_look_for_permissions_in_groups_with_manage_staff(def look_for_permission_in_users_with_manage_staff(- groups_data: dict, users_to_check: Set[int], permissions_to_find: Set[str],+ groups_data: dict,+ users_to_check: Set[int],+ permissions_to_find: Set[str],):"""Search for permissions in user with manage staff groups.diff --git a/saleor/graphql/app/mutations.py b/saleor/graphql/app/mutations.pyindex d7b3e3f6eb..7d002552ee 100644--- a/saleor/graphql/app/mutations.py+++ b/saleor/graphql/app/mutations.py@@ -146,7 +146,8 @@ class AppCreate(ModelMutation):class Arguments:input = AppInput(- required=True, description="Fields required to create a new app.",+ required=True,+ description="Fields required to create a new app.",)class Meta:@@ -187,7 +188,8 @@ class AppUpdate(ModelMutation):class Arguments:id = graphene.ID(description="ID of an app to update.", required=True)input = AppInput(- required=True, description="Fields required to update an existing app.",+ required=True,+ description="Fields required to update an existing app.",)class Meta:@@ -361,7 +363,8 @@ class AppInstallInput(graphene.InputObjectType):class AppInstall(ModelMutation):class Arguments:input = AppInstallInput(- required=True, description="Fields required to install a new app.",+ required=True,+ description="Fields required to install a new app.",)class Meta:diff --git a/saleor/graphql/app/tests/mutations/test_app_create.py b/saleor/graphql/app/tests/mutations/test_app_create.pyindex 7ec40791e5..a5b73a70e0 100644--- a/saleor/graphql/app/tests/mutations/test_app_create.py+++ b/saleor/graphql/app/tests/mutations/test_app_create.py@@ -34,7 +34,10 @@ APP_CREATE_MUTATION = """def test_app_create_mutation(- permission_manage_apps, permission_manage_products, staff_api_client, staff_user,+ permission_manage_apps,+ permission_manage_products,+ staff_api_client,+ staff_user,):query = APP_CREATE_MUTATIONstaff_user.user_permissions.add(permission_manage_products)@@ -59,7 +62,10 @@ def test_app_create_mutation(def test_app_create_mutation_for_app(- permission_manage_apps, permission_manage_products, app_api_client, staff_user,+ permission_manage_apps,+ permission_manage_products,+ app_api_client,+ staff_user,):query = APP_CREATE_MUTATIONrequestor = app_api_client.app@@ -82,7 +88,10 @@ def test_app_create_mutation_for_app(def test_app_create_mutation_out_of_scope_permissions(- permission_manage_apps, permission_manage_products, staff_api_client, staff_user,+ permission_manage_apps,+ permission_manage_products,+ staff_api_client,+ staff_user,):"""Ensure user can't create app with permissions out of user's scope.@@ -111,7 +120,9 @@ def test_app_create_mutation_out_of_scope_permissions(def test_app_create_mutation_superuser_can_create_app_with_any_perms(- permission_manage_apps, permission_manage_products, superuser_api_client,+ permission_manage_apps,+ permission_manage_products,+ superuser_api_client,):"""Ensure superuser can create app with any permissions."""query = APP_CREATE_MUTATION@@ -134,7 +145,10 @@ def test_app_create_mutation_superuser_can_create_app_with_any_perms(def test_app_create_mutation_for_app_out_of_scope_permissions(- permission_manage_apps, permission_manage_products, app_api_client, staff_user,+ permission_manage_apps,+ permission_manage_products,+ app_api_client,+ staff_user,):query = APP_CREATE_MUTATION@@ -159,7 +173,10 @@ def test_app_create_mutation_for_app_out_of_scope_permissions(def test_app_create_mutation_no_permissions(- permission_manage_apps, permission_manage_products, staff_api_client, staff_user,+ permission_manage_apps,+ permission_manage_products,+ staff_api_client,+ staff_user,):query = APP_CREATE_MUTATIONvariables = {diff --git a/saleor/graphql/app/tests/mutations/test_app_delete.py b/saleor/graphql/app/tests/mutations/test_app_delete.pyindex e84f969e86..d76e1e916e 100644--- a/saleor/graphql/app/tests/mutations/test_app_delete.py+++ b/saleor/graphql/app/tests/mutations/test_app_delete.py@@ -21,7 +21,11 @@ APP_DELETE_MUTATION = """def test_app_delete(- staff_api_client, staff_user, app, permission_manage_orders, permission_manage_apps,+ staff_api_client,+ staff_user,+ app,+ permission_manage_orders,+ permission_manage_apps,):query = APP_DELETE_MUTATIONapp.permissions.add(permission_manage_orders)@@ -41,7 +45,9 @@ def test_app_delete(def test_app_delete_for_app(- app_api_client, permission_manage_orders, permission_manage_apps,+ app_api_client,+ permission_manage_orders,+ permission_manage_apps,):requestor = app_api_client.appapp = App.objects.create(name="New_app")@@ -63,7 +69,11 @@ def test_app_delete_for_app(def test_app_delete_out_of_scope_app(- staff_api_client, staff_user, app, permission_manage_apps, permission_manage_orders,+ staff_api_client,+ staff_user,+ app,+ permission_manage_apps,+ permission_manage_orders,):"""Ensure user can't delete app with wider scope of permissions."""query = APP_DELETE_MUTATION@@ -87,7 +97,10 @@ def test_app_delete_out_of_scope_app(def test_app_delete_superuser_can_delete_any_app(- superuser_api_client, app, permission_manage_apps, permission_manage_orders,+ superuser_api_client,+ app,+ permission_manage_apps,+ permission_manage_orders,):"""Ensure superuser can delete app with any scope of permissions."""query = APP_DELETE_MUTATION@@ -106,7 +119,9 @@ def test_app_delete_superuser_can_delete_any_app(def test_app_delete_for_app_out_of_scope_app(- app_api_client, permission_manage_orders, permission_manage_apps,+ app_api_client,+ permission_manage_orders,+ permission_manage_apps,):app = App.objects.create(name="New_app")query = APP_DELETE_MUTATIONdiff --git a/saleor/graphql/app/tests/mutations/test_app_delete_failed_installation.py b/saleor/graphql/app/tests/mutations/test_app_delete_failed_installation.pyindex 23890a5109..d4e001a07a 100644--- a/saleor/graphql/app/tests/mutations/test_app_delete_failed_installation.py+++ b/saleor/graphql/app/tests/mutations/test_app_delete_failed_installation.py@@ -38,7 +38,10 @@ def test_drop_failed_installation_mutation(}# when- response = staff_api_client.post_graphql(query, variables=variables,)+ response = staff_api_client.post_graphql(+ query,+ variables=variables,+ )# thenget_graphql_content(response)@@ -47,7 +50,10 @@ def test_drop_failed_installation_mutation(def test_drop_failed_installation_mutation_by_app(- permission_manage_apps, permission_manage_orders, app_api_client, app_installation,+ permission_manage_apps,+ permission_manage_orders,+ app_api_client,+ app_installation,):# givenapp_installation.status = JobStatus.FAILED@@ -64,7 +70,10 @@ def test_drop_failed_installation_mutation_by_app(}# when- response = app_api_client.post_graphql(query, variables=variables,)+ response = app_api_client.post_graphql(+ query,+ variables=variables,+ )# thenget_graphql_content(response)@@ -93,7 +102,10 @@ def test_drop_failed_installation_mutation_app_has_more_permission_than_user_req}# when- response = staff_api_client.post_graphql(query, variables=variables,)+ response = staff_api_client.post_graphql(+ query,+ variables=variables,+ )# thenget_graphql_content(response)@@ -116,7 +128,10 @@ def test_drop_failed_installation_mutation_app_has_more_permission_than_app_requ}# when- response = app_api_client.post_graphql(query, variables=variables,)+ response = app_api_client.post_graphql(+ query,+ variables=variables,+ )# thenget_graphql_content(response)@@ -142,7 +157,10 @@ def test_cannot_drop_installation_if_status_is_different_than_failed(}# when- response = staff_api_client.post_graphql(query, variables=variables,)+ response = staff_api_client.post_graphql(+ query,+ variables=variables,+ )# thencontent = get_graphql_content(response)diff --git a/saleor/graphql/app/tests/mutations/test_app_fetch_manifest.py b/saleor/graphql/app/tests/mutations/test_app_fetch_manifest.pyindex c888a13186..876f1bd6c1 100644--- a/saleor/graphql/app/tests/mutations/test_app_fetch_manifest.py+++ b/saleor/graphql/app/tests/mutations/test_app_fetch_manifest.py@@ -42,7 +42,10 @@ def test_app_fetch_manifest(staff_api_client, staff_user, permission_manage_apps"manifest_url": manifest_url,}staff_user.user_permissions.set([permission_manage_apps])- response = staff_api_client.post_graphql(query, variables=variables,)+ response = staff_api_client.post_graphql(+ query,+ variables=variables,+ )content = get_graphql_content(response)errors = content["data"]["appFetchManifest"]["appErrors"]manifest = content["data"]["appFetchManifest"]["manifest"]@@ -70,7 +73,10 @@ def test_app_fetch_manifest_missing_permission(staff_api_client, staff_user):variables = {"manifest_url": manifest_url,}- response = staff_api_client.post_graphql(query, variables=variables,)+ response = staff_api_client.post_graphql(+ query,+ variables=variables,+ )assert_no_permission(response)@@ -84,7 +90,10 @@ def test_app_fetch_manifest_incorrect_permission_in_manifest("manifest_url": manifest_url,}staff_user.user_permissions.set([permission_manage_apps])- response = staff_api_client.post_graphql(query, variables=variables,)+ response = staff_api_client.post_graphql(+ query,+ variables=variables,+ )content = get_graphql_content(response)errors = content["data"]["appFetchManifest"]["appErrors"]manifest = content["data"]["appFetchManifest"]["manifest"]@@ -107,7 +116,10 @@ def test_app_fetch_manifest_unable_to_connect("manifest_url": manifest_url,}staff_user.user_permissions.set([permission_manage_apps])- response = staff_api_client.post_graphql(query, variables=variables,)+ response = staff_api_client.post_graphql(+ query,+ variables=variables,+ )content = get_graphql_content(response)errors = content["data"]["appFetchManifest"]["appErrors"]@@ -129,7 +141,10 @@ def test_app_fetch_manifest_wrong_format_of_response("manifest_url": manifest_url,}staff_user.user_permissions.set([permission_manage_apps])- response = staff_api_client.post_graphql(query, variables=variables,)+ response = staff_api_client.post_graphql(+ query,+ variables=variables,+ )content = get_graphql_content(response)errors = content["data"]["appFetchManifest"]["appErrors"]@@ -154,7 +169,10 @@ def test_app_fetch_manifest_handle_exception("manifest_url": manifest_url,}staff_user.user_permissions.set([permission_manage_apps])- response = staff_api_client.post_graphql(query, variables=variables,)+ response = staff_api_client.post_graphql(+ query,+ variables=variables,+ )content = get_graphql_content(response)errors = content["data"]["appFetchManifest"]["appErrors"]diff --git a/saleor/graphql/app/tests/mutations/test_app_install.py b/saleor/graphql/app/tests/mutations/test_app_install.pyindex 6a4a731f1f..b38221f7df 100644--- a/saleor/graphql/app/tests/mutations/test_app_install.py+++ b/saleor/graphql/app/tests/mutations/test_app_install.py@@ -48,7 +48,10 @@ def test_install_app_mutation("manifest_url": "http://localhost:3000/manifest","permissions": [PermissionEnum.MANAGE_ORDERS.name],}- response = staff_api_client.post_graphql(query, variables=variables,)+ response = staff_api_client.post_graphql(+ query,+ variables=variables,+ )content = get_graphql_content(response)app_installation = AppInstallation.objects.get()app_installation_data = content["data"]["appInstall"]["appInstallation"]@@ -75,7 +78,10 @@ def test_install_app_mutation_by_app("manifest_url": "http://localhost:3000/manifest","permissions": [PermissionEnum.MANAGE_ORDERS.name],}- response = app_api_client.post_graphql(query, variables=variables,)+ response = app_api_client.post_graphql(+ query,+ variables=variables,+ )content = get_graphql_content(response)app_installation = AppInstallation.objects.get()app_installation_data = content["data"]["appInstall"]["appInstallation"]@@ -96,7 +102,10 @@ def test_app_install_mutation_out_of_scope_permissions("manifest_url": "http://localhost:3000/manifest","permissions": [PermissionEnum.MANAGE_ORDERS.name],}- response = staff_api_client.post_graphql(query, variables=variables,)+ response = staff_api_client.post_graphql(+ query,+ variables=variables,+ )content = get_graphql_content(response)data = content["data"]["appInstall"]@@ -119,7 +128,10 @@ def test_install_app_mutation_by_app_out_of_scope_permissions("manifest_url": "http://localhost:3000/manifest","permissions": [PermissionEnum.MANAGE_ORDERS.name],}- response = app_api_client.post_graphql(query, variables=variables,)+ response = app_api_client.post_graphql(+ query,+ variables=variables,+ )content = get_graphql_content(response)data = content["data"]["appInstall"]diff --git a/saleor/graphql/app/tests/mutations/test_app_retry_install.py b/saleor/graphql/app/tests/mutations/test_app_retry_install.pyindex b8b160b011..5ee1bae2a9 100644--- a/saleor/graphql/app/tests/mutations/test_app_retry_install.py+++ b/saleor/graphql/app/tests/mutations/test_app_retry_install.py@@ -49,7 +49,10 @@ def test_retry_install_app_mutation("id": id,"activate_after_installation": True,}- response = staff_api_client.post_graphql(query, variables=variables,)+ response = staff_api_client.post_graphql(+ query,+ variables=variables,+ )content = get_graphql_content(response)app_installation = AppInstallation.objects.get()app_installation_data = content["data"]["appRetryInstall"]["appInstallation"]@@ -82,7 +85,10 @@ def test_retry_install_app_mutation_by_app("id": id,"activate_after_installation": False,}- response = app_api_client.post_graphql(query, variables=variables,)+ response = app_api_client.post_graphql(+ query,+ variables=variables,+ )content = get_graphql_content(response)app_installation = AppInstallation.objects.get()app_installation_data = content["data"]["appRetryInstall"]["appInstallation"]@@ -118,7 +124,10 @@ def test_retry_install_app_mutation_app_has_more_permission_than_user_requestor(variables = {"id": id,}- response = staff_api_client.post_graphql(query, variables=variables,)+ response = staff_api_client.post_graphql(+ query,+ variables=variables,+ )content = get_graphql_content(response)data = content["data"]["appRetryInstall"]@@ -156,7 +165,10 @@ def test_retry_install_app_mutation_app_has_more_permission_than_app_requestor(variables = {"id": id,}- response = app_api_client.post_graphql(query, variables=variables,)+ response = app_api_client.post_graphql(+ query,+ variables=variables,+ )content = get_graphql_content(response)data = content["data"]["appRetryInstall"]@@ -195,7 +207,10 @@ def test_cannot_retry_installation_if_status_is_different_than_failed("id": id,"activate_after_installation": True,}- response = staff_api_client.post_graphql(query, variables=variables,)+ response = staff_api_client.post_graphql(+ query,+ variables=variables,+ )content = get_graphql_content(response)AppInstallation.objects.get()diff --git a/saleor/graphql/app/tests/mutations/test_app_token_create.py b/saleor/graphql/app/tests/mutations/test_app_token_create.pyindex 65c8d96f1e..4cefafe3df 100644--- a/saleor/graphql/app/tests/mutations/test_app_token_create.py+++ b/saleor/graphql/app/tests/mutations/test_app_token_create.py@@ -48,7 +48,9 @@ def test_app_token_create(def test_app_token_create_for_app(- permission_manage_apps, app_api_client, permission_manage_orders,+ permission_manage_apps,+ app_api_client,+ permission_manage_orders,):app = App.objects.create(name="New_app")@@ -60,7 +62,9 @@ def test_app_token_create_for_app(id = graphene.Node.to_global_id("App", app.id)variables = {"name": "Default token", "app": id}response = app_api_client.post_graphql(- query, variables={"input": variables}, permissions=(permission_manage_apps,),+ query,+ variables={"input": variables},+ permissions=(permission_manage_apps,),)content = get_graphql_content(response)token_data = content["data"]["appTokenCreate"]["appToken"]@@ -73,7 +77,10 @@ def test_app_token_create_for_app(def test_app_token_create_out_of_scope_app(- permission_manage_apps, staff_api_client, staff_user, permission_manage_orders,+ permission_manage_apps,+ staff_api_client,+ staff_user,+ permission_manage_orders,):"""Ensure user can't create token for app with wider scope of permissions."""app = App.objects.create(name="New_app")@@ -84,7 +91,9 @@ def test_app_token_create_out_of_scope_app(variables = {"name": "Default token", "app": id}response = staff_api_client.post_graphql(- query, variables={"input": variables}, permissions=(permission_manage_apps,),+ query,+ variables={"input": variables},+ permissions=(permission_manage_apps,),)content = get_graphql_content(response)@@ -98,7 +107,9 @@ def test_app_token_create_out_of_scope_app(def test_app_token_create_superuser_can_create_token_for_any_app(- permission_manage_apps, superuser_api_client, permission_manage_orders,+ permission_manage_apps,+ superuser_api_client,+ permission_manage_orders,):"""Ensure superuser can create token for app with any scope of permissions."""app = App.objects.create(name="New_app")@@ -120,7 +131,10 @@ def test_app_token_create_superuser_can_create_token_for_any_app(def test_app_token_create_as_app_out_of_scope_app(- permission_manage_apps, app_api_client, app, permission_manage_orders,+ permission_manage_apps,+ app_api_client,+ app,+ permission_manage_orders,):app = App.objects.create(name="New_app")query = APP_TOKEN_CREATE_MUTATION@@ -129,7 +143,9 @@ def test_app_token_create_as_app_out_of_scope_app(id = graphene.Node.to_global_id("App", app.id)variables = {"name": "Default token", "app": id}response = app_api_client.post_graphql(- query, variables={"input": variables}, permissions=(permission_manage_apps,),+ query,+ variables={"input": variables},+ permissions=(permission_manage_apps,),)content = get_graphql_content(response)data = content["data"]["appTokenCreate"]diff --git a/saleor/graphql/app/tests/mutations/test_app_token_delete.py b/saleor/graphql/app/tests/mutations/test_app_token_delete.pyindex 8f983a5981..418f8151ef 100644--- a/saleor/graphql/app/tests/mutations/test_app_token_delete.py+++ b/saleor/graphql/app/tests/mutations/test_app_token_delete.py@@ -43,7 +43,9 @@ def test_app_token_delete(def test_app_token_delete_for_app(- permission_manage_apps, app_api_client, permission_manage_products,+ permission_manage_apps,+ app_api_client,+ permission_manage_products,):app = App.objects.create(name="New_app", is_active=True)token = AppToken.objects.create(app=app)@@ -107,7 +109,10 @@ def test_app_token_delete_out_of_scope_app(def test_app_token_delete_superuser_can_delete_token_for_any_app(- permission_manage_apps, superuser_api_client, app, permission_manage_products,+ permission_manage_apps,+ superuser_api_client,+ app,+ permission_manage_products,):"""Ensure superuser can delete app token for app with any scope of permissions."""query = APP_TOKEN_DELETE_MUTATION@@ -129,7 +134,9 @@ def test_app_token_delete_superuser_can_delete_token_for_any_app(def test_app_token_delete_for_app_out_of_scope_app(- permission_manage_apps, app_api_client, permission_manage_products,+ permission_manage_apps,+ app_api_client,+ permission_manage_products,):app = App.objects.create(name="New_app", is_active=True)token = AppToken.objects.create(app=app)diff --git a/saleor/graphql/app/tests/mutations/test_app_update.py b/saleor/graphql/app/tests/mutations/test_app_update.pyindex 27e979c163..b79ea06150 100644--- a/saleor/graphql/app/tests/mutations/test_app_update.py+++ b/saleor/graphql/app/tests/mutations/test_app_update.py@@ -206,7 +206,9 @@ def test_app_update_mutation_for_app_out_of_scope_permissions(query = APP_UPDATE_MUTATIONrequestor = app_api_client.apprequestor.permissions.add(- permission_manage_apps, permission_manage_products, permission_manage_orders,+ permission_manage_apps,+ permission_manage_products,+ permission_manage_orders,)app.permissions.add(permission_manage_orders)id = graphene.Node.to_global_id("App", app.id)@@ -244,7 +246,9 @@ def test_app_update_mutation_out_of_scope_app("""Ensure user cannot manage app with wider permission scope."""query = APP_UPDATE_MUTATIONstaff_user.user_permissions.add(- permission_manage_apps, permission_manage_products, permission_manage_users,+ permission_manage_apps,+ permission_manage_products,+ permission_manage_users,)app.permissions.add(permission_manage_orders)id = graphene.Node.to_global_id("App", app.id)@@ -322,7 +326,9 @@ def test_app_update_mutation_for_app_out_of_scope_app(query = APP_UPDATE_MUTATIONrequestor = app_api_client.apprequestor.permissions.add(- permission_manage_apps, permission_manage_products, permission_manage_users,+ permission_manage_apps,+ permission_manage_products,+ permission_manage_users,)app.permissions.add(permission_manage_orders)id = graphene.Node.to_global_id("App", app.id)diff --git a/saleor/graphql/app/tests/queries/test_app.py b/saleor/graphql/app/tests/queries/test_app.pyindex 31c52a985a..afc38331e0 100644--- a/saleor/graphql/app/tests/queries/test_app.py+++ b/saleor/graphql/app/tests/queries/test_app.py@@ -58,7 +58,9 @@ def test_app_query(id = graphene.Node.to_global_id("App", app.id)variables = {"id": id}response = staff_api_client.post_graphql(- QUERY_APP, variables, permissions=[permission_manage_apps],+ QUERY_APP,+ variables,+ permissions=[permission_manage_apps],)content = get_graphql_content(response)@@ -107,7 +109,10 @@ def test_app_query_no_permission(def test_app_with_access_to_resources(- app_api_client, app, permission_manage_orders, order_with_lines,+ app_api_client,+ app,+ permission_manage_orders,+ order_with_lines,):query = """query {diff --git a/saleor/graphql/app/tests/queries/test_apps.py b/saleor/graphql/app/tests/queries/test_apps.pyindex eec75ddd13..ccbab61c36 100644--- a/saleor/graphql/app/tests/queries/test_apps.py+++ b/saleor/graphql/app/tests/queries/test_apps.py@@ -110,7 +110,10 @@ QUERY_APPS_WITH_SORT = """],)def test_query_apps_with_sort(- apps_sort, result_order, staff_api_client, permission_manage_apps,+ apps_sort,+ result_order,+ staff_api_client,+ permission_manage_apps,):with freeze_time("2018-05-31 12:00:01"):App.objects.create(name="google", is_active=True)diff --git a/saleor/graphql/app/tests/queries/test_apps_pagination.py b/saleor/graphql/app/tests/queries/test_apps_pagination.pyindex d0d6d538b6..8b6db77ed6 100644--- a/saleor/graphql/app/tests/queries/test_apps_pagination.py+++ b/saleor/graphql/app/tests/queries/test_apps_pagination.py@@ -54,12 +54,19 @@ QUERY_APP_PAGINATION = """],)def test_apps_pagination_with_sorting(- sort_by, apps_order, staff_api_client, apps_for_pagination, permission_manage_apps,+ sort_by,+ apps_order,+ staff_api_client,+ apps_for_pagination,+ permission_manage_apps,):staff_api_client.user.user_permissions.add(permission_manage_apps)page_size = 3variables = {"first": page_size, "after": None, "sortBy": sort_by}- response = staff_api_client.post_graphql(QUERY_APP_PAGINATION, variables,)+ response = staff_api_client.post_graphql(+ QUERY_APP_PAGINATION,+ variables,+ )content = get_graphql_content(response)nodes = content["data"]["apps"]["edges"]assert apps_order[0] == nodes[0]["node"]["name"]@@ -87,7 +94,10 @@ def test_apps_pagination_with_filtering(staff_api_client.user.user_permissions.add(permission_manage_apps)page_size = 2variables = {"first": page_size, "after": None, "filter": filter_by}- response = staff_api_client.post_graphql(QUERY_APP_PAGINATION, variables,)+ response = staff_api_client.post_graphql(+ QUERY_APP_PAGINATION,+ variables,+ )content = get_graphql_content(response)nodes = content["data"]["apps"]["edges"]diff --git a/saleor/graphql/attribute/mutations.py b/saleor/graphql/attribute/mutations.pyindex b61f635a5d..7c4647fafc 100644--- a/saleor/graphql/attribute/mutations.py+++ b/saleor/graphql/attribute/mutations.py@@ -5,7 +5,8 @@ from django.core.exceptions import ObjectDoesNotExist, ValidationErrorfrom django.db import transactionfrom django.utils.text import slugify-from ...attribute import AttributeInputType, models as models+from ...attribute import AttributeInputType+from ...attribute import models as modelsfrom ...attribute.error_codes import AttributeErrorCodefrom ...core.exceptions import PermissionDeniedfrom ...core.permissions import (diff --git a/saleor/graphql/attribute/tests/benchmark/test_attribute.py b/saleor/graphql/attribute/tests/benchmark/test_attribute.pyindex f44b76e526..06e11f5c1b 100644--- a/saleor/graphql/attribute/tests/benchmark/test_attribute.py+++ b/saleor/graphql/attribute/tests/benchmark/test_attribute.py@@ -7,7 +7,10 @@ from ....tests.utils import get_graphql_content@pytest.mark.django_db@pytest.mark.count_queries(autouse=False)def test_query_attribute(- staff_api_client, color_attribute, permission_manage_products, count_queries,+ staff_api_client,+ color_attribute,+ permission_manage_products,+ count_queries,):query = """query($id: ID!) {diff --git a/saleor/graphql/attribute/tests/mutations/test_attribute_update.py b/saleor/graphql/attribute/tests/mutations/test_attribute_update.pyindex 8c9ee0209f..c670fa1f54 100644--- a/saleor/graphql/attribute/tests/mutations/test_attribute_update.py+++ b/saleor/graphql/attribute/tests/mutations/test_attribute_update.py@@ -313,7 +313,9 @@ def test_update_attribute_slug(def test_update_attribute_slug_exists(- staff_api_client, color_attribute, permission_manage_product_types_and_attributes,+ staff_api_client,+ color_attribute,+ permission_manage_product_types_and_attributes,):# givenquery = UPDATE_ATTRIBUTE_SLUG_MUTATIONdiff --git a/saleor/graphql/attribute/tests/queries/test_attribute_filtering_with_channels.py b/saleor/graphql/attribute/tests/queries/test_attribute_filtering_with_channels.pyindex 52247471e3..cadb8455fd 100644--- a/saleor/graphql/attribute/tests/queries/test_attribute_filtering_with_channels.py+++ b/saleor/graphql/attribute/tests/queries/test_attribute_filtering_with_channels.py@@ -56,7 +56,9 @@ def attributes_for_filtering_with_channels(product_type = ProductType.objects.create(name="My Product Type")product = Product.objects.create(- name="Test product", product_type=product_type, category=category,+ name="Test product",+ product_type=product_type,+ category=category,)ProductChannelListing.objects.bulk_create([@@ -155,10 +157,15 @@ QUERY_ATTRIBUTES_FILTERING = """@pytest.mark.parametrize(- "tested_field", ["inCategory", "inCollection"],+ "tested_field",+ ["inCategory", "inCollection"],)def test_attributes_with_filtering_without_channel(- tested_field, staff_api_client, permission_manage_products, category, collection,+ tested_field,+ staff_api_client,+ permission_manage_products,+ category,+ collection,):# givenif "Collection" in tested_field:@@ -183,7 +190,8 @@ def test_attributes_with_filtering_without_channel(@pytest.mark.parametrize(- "tested_field, attribute_count", [("inCategory", 5), ("inCollection", 5)],+ "tested_field, attribute_count",+ [("inCategory", 5), ("inCollection", 5)],)def test_products_with_filtering_with_as_staff_user(tested_field,@@ -221,7 +229,8 @@ def test_products_with_filtering_with_as_staff_user(@pytest.mark.parametrize(- "tested_field, attribute_count", [("inCategory", 5), ("inCollection", 5)],+ "tested_field, attribute_count",+ [("inCategory", 5), ("inCollection", 5)],)def test_products_with_filtering_as_anonymous_client(tested_field,@@ -253,7 +262,8 @@ def test_products_with_filtering_as_anonymous_client(@pytest.mark.parametrize(- "tested_field, attribute_count", [("inCategory", 5), ("inCollection", 5)],+ "tested_field, attribute_count",+ [("inCategory", 5), ("inCollection", 5)],)def test_products_with_filtering_with_not_visible_in_listings_as_staff_user(tested_field,@@ -328,7 +338,8 @@ def test_products_with_filtering_with_not_visible_in_listings_as_anonymous_clien@pytest.mark.parametrize(- "tested_field, attribute_count", [("inCategory", 5), ("inCollection", 5)],+ "tested_field, attribute_count",+ [("inCategory", 5), ("inCollection", 5)],)def test_products_with_filtering_with_not_published_as_staff_user(tested_field,@@ -366,7 +377,8 @@ def test_products_with_filtering_with_not_published_as_staff_user(@pytest.mark.parametrize(- "tested_field, attribute_count", [("inCategory", 0), ("inCollection", 0)],+ "tested_field, attribute_count",+ [("inCategory", 0), ("inCollection", 0)],)def test_products_with_filtering_with_not_published_as_anonymous_client(tested_field,@@ -398,7 +410,8 @@ def test_products_with_filtering_with_not_published_as_anonymous_client(@pytest.mark.parametrize(- "tested_field", ["inCategory", "inCollection"],+ "tested_field",+ ["inCategory", "inCollection"],)def test_products_with_filtering_not_existing_channel(tested_field,diff --git a/saleor/graphql/attribute/tests/queries/test_attribute_pagination.py b/saleor/graphql/attribute/tests/queries/test_attribute_pagination.pyindex 38f68e2d7b..0683683b04 100644--- a/saleor/graphql/attribute/tests/queries/test_attribute_pagination.py+++ b/saleor/graphql/attribute/tests/queries/test_attribute_pagination.py@@ -59,7 +59,9 @@ def attributes_for_pagination(collection, category, channel_USD):product_type = ProductType.objects.create(name="My Product Type")product = Product.objects.create(- name="Test product", product_type=product_type, category=category,+ name="Test product",+ product_type=product_type,+ category=category,)ProductChannelListing.objects.create(channel=channel_USD,@@ -154,7 +156,10 @@ QUERY_ATTRIBUTES_PAGINATION = """({"field": "NAME", "direction": "ASC"}, ["Attr1", "Attr2", "Attr3"]),({"field": "NAME", "direction": "DESC"}, ["AttrAttr2", "AttrAttr1", "Attr3"]),({"field": "SLUG", "direction": "ASC"}, ["Attr1", "Attr2", "Attr3"]),- ({"field": "VALUE_REQUIRED", "direction": "ASC"}, ["Attr2", "Attr3", "Attr1"],),+ (+ {"field": "VALUE_REQUIRED", "direction": "ASC"},+ ["Attr2", "Attr3", "Attr1"],+ ),({"field": "STOREFRONT_SEARCH_POSITION", "direction": "ASC"},["Attr3", "AttrAttr2", "AttrAttr1"],@@ -162,12 +167,18 @@ QUERY_ATTRIBUTES_PAGINATION = """],)def test_attributes_pagination_with_sorting(- sort_by, attributes_order, staff_api_client, attributes_for_pagination,+ sort_by,+ attributes_order,+ staff_api_client,+ attributes_for_pagination,):page_size = 3variables = {"first": page_size, "after": None, "sortBy": sort_by}- response = staff_api_client.post_graphql(QUERY_ATTRIBUTES_PAGINATION, variables,)+ response = staff_api_client.post_graphql(+ QUERY_ATTRIBUTES_PAGINATION,+ variables,+ )content = get_graphql_content(response)attributes_nodes = content["data"]["attributes"]["edges"]assert attributes_order[0] == attributes_nodes[0]["node"]["name"]@@ -186,7 +197,10 @@ def test_attributes_pagination_with_sorting(],)def test_attributes_pagination_with_filtering(- filter_by, attributes_order, staff_api_client, attributes_for_pagination,+ filter_by,+ attributes_order,+ staff_api_client,+ attributes_for_pagination,):page_size = 2diff --git a/saleor/graphql/attribute/tests/queries/test_attribute_query.py b/saleor/graphql/attribute/tests/queries/test_attribute_query.pyindex 3ded69852a..2b485a29eb 100644--- a/saleor/graphql/attribute/tests/queries/test_attribute_query.py+++ b/saleor/graphql/attribute/tests/queries/test_attribute_query.py@@ -451,7 +451,9 @@ def test_attributes_in_collection_query(# Create another collection with products but shouldn't get matched# as we don't look for this other collectionother_collection = Collection.objects.create(- name="Other Collection", slug="other-collection", description="Description",+ name="Other Collection",+ slug="other-collection",+ description="Description",)other_collection.products.add(other_product)diff --git a/saleor/graphql/attribute/utils.py b/saleor/graphql/attribute/utils.pyindex b56d5967d0..08de5ee374 100644--- a/saleor/graphql/attribute/utils.py+++ b/saleor/graphql/attribute/utils.py@@ -7,7 +7,8 @@ from django.db.models import Qfrom django.utils.text import slugifyfrom graphql_relay import from_global_id-from ...attribute import AttributeInputType, AttributeType, models as attribute_models+from ...attribute import AttributeInputType, AttributeType+from ...attribute import models as attribute_modelsfrom ...attribute.utils import associate_attribute_values_to_instancefrom ...core.utils import generate_unique_slugfrom ...page import models as page_models@@ -17,6 +18,7 @@ from ...product.error_codes import ProductErrorCodeif TYPE_CHECKING:from django.db.models import QuerySet+from ...attribute.models import Attribute@@ -308,15 +310,18 @@ class ProductAttributeInputErrors:code=PageErrorCode.REQUIRED.value,)ERROR_DROPDOWN_GET_MORE_THAN_ONE_VALUE = ValidationError(- "Attribute must take only one value", code=PageErrorCode.INVALID.value,+ "Attribute must take only one value",+ code=PageErrorCode.INVALID.value,)ERROR_BLANK_VALUE = ValidationError(- "Attribute values cannot be blank", code=PageErrorCode.REQUIRED.value,+ "Attribute values cannot be blank",+ code=PageErrorCode.REQUIRED.value,)# file errorsERROR_NO_FILE_GIVEN = ValidationError(- "Attribute file url cannot be blank", code=PageErrorCode.REQUIRED.value,+ "Attribute file url cannot be blank",+ code=PageErrorCode.REQUIRED.value,)ERROR_BLANK_FILE_VALUE = ValidationError("Attribute expects a file url but none were given",@@ -330,15 +335,18 @@ class PageAttributeInputErrors:code=ProductErrorCode.REQUIRED.value,)ERROR_DROPDOWN_GET_MORE_THAN_ONE_VALUE = ValidationError(- "Attribute must take only one value", code=ProductErrorCode.INVALID.value,+ "Attribute must take only one value",+ code=ProductErrorCode.INVALID.value,)ERROR_BLANK_VALUE = ValidationError(- "Attribute values cannot be blank", code=ProductErrorCode.REQUIRED.value,+ "Attribute values cannot be blank",+ code=ProductErrorCode.REQUIRED.value,)# file errorsERROR_NO_FILE_GIVEN = ValidationError(- "Attribute file url cannot be blank", code=ProductErrorCode.REQUIRED.value,+ "Attribute file url cannot be blank",+ code=ProductErrorCode.REQUIRED.value,)ERROR_BLANK_FILE_VALUE = ValidationError("Attribute expects a file url but none were given",diff --git a/saleor/graphql/channel/tests/test_channel_create_mutations.py b/saleor/graphql/channel/tests/test_channel_create_mutations.pyindex 82cc50309d..8ab1d48e95 100644--- a/saleor/graphql/channel/tests/test_channel_create_mutations.py+++ b/saleor/graphql/channel/tests/test_channel_create_mutations.py@@ -24,7 +24,8 @@ CHANNEL_CREATE_MUTATION = """def test_channel_create_mutation_as_staff_user(- permission_manage_channels, staff_api_client,+ permission_manage_channels,+ staff_api_client,):# givenname = "testName"@@ -51,7 +52,8 @@ def test_channel_create_mutation_as_staff_user(def test_channel_create_mutation_as_app(- permission_manage_channels, app_api_client,+ permission_manage_channels,+ app_api_client,):# givenname = "testName"@@ -86,7 +88,9 @@ def test_channel_create_mutation_as_customer(user_api_client):# whenresponse = user_api_client.post_graphql(- CHANNEL_CREATE_MUTATION, variables=variables, permissions=(),+ CHANNEL_CREATE_MUTATION,+ variables=variables,+ permissions=(),)# then@@ -102,7 +106,9 @@ def test_channel_create_mutation_as_anonymous(api_client):# whenresponse = api_client.post_graphql(- CHANNEL_CREATE_MUTATION, variables=variables, permissions=(),+ CHANNEL_CREATE_MUTATION,+ variables=variables,+ permissions=(),)# then@@ -110,7 +116,8 @@ def test_channel_create_mutation_as_anonymous(api_client):def test_channel_create_mutation_slugify_slug_field(- permission_manage_channels, staff_api_client,+ permission_manage_channels,+ staff_api_client,):# givenname = "testName"diff --git a/saleor/graphql/channel/tests/test_channel_delete_mutations.py b/saleor/graphql/channel/tests/test_channel_delete_mutations.pyindex 71c35cd3db..e5013a58f7 100644--- a/saleor/graphql/channel/tests/test_channel_delete_mutations.py+++ b/saleor/graphql/channel/tests/test_channel_delete_mutations.py@@ -78,7 +78,11 @@ def test_channel_delete_mutation_with_the_same_channel_and_target_channel_id(def test_channel_delete_mutation_without_migration_channel_with_orders(- permission_manage_channels, staff_api_client, channel_USD, checkout, order_list,+ permission_manage_channels,+ staff_api_client,+ channel_USD,+ checkout,+ order_list,):# givenchannel_id = graphene.Node.to_global_id("Channel", channel_USD.id)@@ -103,7 +107,10 @@ def test_channel_delete_mutation_without_migration_channel_with_orders(def test_channel_delete_mutation_without_orders_in_channel(- permission_manage_channels, staff_api_client, channel_USD, checkout,+ permission_manage_channels,+ staff_api_client,+ channel_USD,+ checkout,):# givenchannel_id = graphene.Node.to_global_id("Channel", channel_USD.id)@@ -190,7 +197,9 @@ def test_channel_delete_mutation_as_customer(# whenresponse = user_api_client.post_graphql(- CHANNEL_DELETE_MUTATION, variables=variables, permissions=(),+ CHANNEL_DELETE_MUTATION,+ variables=variables,+ permissions=(),)# then@@ -208,7 +217,9 @@ def test_channel_delete_mutation_as_anonymous(# whenresponse = api_client.post_graphql(- CHANNEL_DELETE_MUTATION, variables=variables, permissions=(),+ CHANNEL_DELETE_MUTATION,+ variables=variables,+ permissions=(),)# thendiff --git a/saleor/graphql/channel/tests/test_channel_queries.py b/saleor/graphql/channel/tests/test_channel_queries.pyindex 0b03d8ba5b..fe4146950e 100644--- a/saleor/graphql/channel/tests/test_channel_queries.py+++ b/saleor/graphql/channel/tests/test_channel_queries.py@@ -96,7 +96,9 @@ def test_query_channels_with_has_orders_order(# whenresponse = staff_api_client.post_graphql(- QUERY_CHANNELS_WITH_HAS_ORDERS, {}, permissions=(permission_manage_channels,),+ QUERY_CHANNELS_WITH_HAS_ORDERS,+ {},+ permissions=(permission_manage_channels,),)content = get_graphql_content(response)diff --git a/saleor/graphql/channel/tests/test_channel_update_mutations.py b/saleor/graphql/channel/tests/test_channel_update_mutations.pyindex 5463781a79..4d207aa44d 100644--- a/saleor/graphql/channel/tests/test_channel_update_mutations.py+++ b/saleor/graphql/channel/tests/test_channel_update_mutations.py@@ -86,7 +86,9 @@ def test_channel_update_mutation_as_customer(user_api_client, channel_USD):# whenresponse = user_api_client.post_graphql(- CHANNEL_UPDATE_MUTATION, variables=variables, permissions=(),+ CHANNEL_UPDATE_MUTATION,+ variables=variables,+ permissions=(),)# then@@ -102,7 +104,9 @@ def test_channel_update_mutation_as_anonymous(api_client, channel_USD):# whenresponse = api_client.post_graphql(- CHANNEL_UPDATE_MUTATION, variables=variables, permissions=(),+ CHANNEL_UPDATE_MUTATION,+ variables=variables,+ permissions=(),)# thendiff --git a/saleor/graphql/checkout/mutations.py b/saleor/graphql/checkout/mutations.pyindex a22898deea..3710e02c24 100644--- a/saleor/graphql/checkout/mutations.py+++ b/saleor/graphql/checkout/mutations.py@@ -340,7 +340,8 @@ class CheckoutCreate(ModelMutation, I18nMixin):)except ProductNotPublished as exc:raise ValidationError(- "Can't create checkout with unpublished product.", code=exc.code,+ "Can't create checkout with unpublished product.",+ code=exc.code,)# Save addresses@@ -430,7 +431,8 @@ class CheckoutLinesAdd(BaseMutation):)except ProductNotPublished as exc:raise ValidationError(- "Can't add unpublished product.", code=exc.code,+ "Can't add unpublished product.",+ code=exc.code,)info.context.plugins.checkout_quantity_changed(checkout)@@ -832,7 +834,10 @@ class CheckoutComplete(BaseMutation):with transaction_with_commit_on_errors():try:checkout = cls.get_node_or_error(- info, checkout_id, only_type=Checkout, field="checkout_id",+ info,+ checkout_id,+ only_type=Checkout,+ field="checkout_id",)except ValidationError as e:checkout_token = from_global_id_strict_type(diff --git a/saleor/graphql/checkout/tests/benchmark/test_checkout_mutations.py b/saleor/graphql/checkout/tests/benchmark/test_checkout_mutations.pyindex 15ef81cfbc..74baf3df36 100644--- a/saleor/graphql/checkout/tests/benchmark/test_checkout_mutations.py+++ b/saleor/graphql/checkout/tests/benchmark/test_checkout_mutations.py@@ -212,13 +212,15 @@ def test_create_checkout({"quantity": 3,"variantId": Node.to_global_id(- "ProductVariant", product_with_two_variants.variants.first().pk,+ "ProductVariant",+ product_with_two_variants.variants.first().pk,),},{"quantity": 2,"variantId": Node.to_global_id(- "ProductVariant", product_with_two_variants.variants.last().pk,+ "ProductVariant",+ product_with_two_variants.variants.last().pk,),},],@@ -231,7 +233,10 @@ def test_create_checkout(@pytest.mark.django_db@pytest.mark.count_queries(autouse=False)def test_add_shipping_to_checkout(- api_client, checkout_with_shipping_address, shipping_method, count_queries,+ api_client,+ checkout_with_shipping_address,+ shipping_method,+ count_queries,):query = (FRAGMENT_CHECKOUT@@ -343,25 +348,29 @@ def test_update_checkout_lines({"quantity": 2,"variantId": Node.to_global_id(- "ProductVariant", product_with_default_variant.variants.first().pk,+ "ProductVariant",+ product_with_default_variant.variants.first().pk,),},{"quantity": 10,"variantId": Node.to_global_id(- "ProductVariant", product_with_single_variant.variants.first().pk,+ "ProductVariant",+ product_with_single_variant.variants.first().pk,),},{"quantity": 3,"variantId": Node.to_global_id(- "ProductVariant", product_with_two_variants.variants.first().pk,+ "ProductVariant",+ product_with_two_variants.variants.first().pk,),},{"quantity": 2,"variantId": Node.to_global_id(- "ProductVariant", product_with_two_variants.variants.last().pk,+ "ProductVariant",+ product_with_two_variants.variants.last().pk,),},],diff --git a/saleor/graphql/checkout/tests/test_checkout.py b/saleor/graphql/checkout/tests/test_checkout.pyindex 30404fcd0b..55c6c85dc7 100644--- a/saleor/graphql/checkout/tests/test_checkout.py+++ b/saleor/graphql/checkout/tests/test_checkout.py@@ -1111,7 +1111,9 @@ query getCheckoutPayments($token: UUID!) {def test_checkout_available_payment_gateways(- api_client, checkout_with_item, expected_dummy_gateway,+ api_client,+ checkout_with_item,+ expected_dummy_gateway,):query = GET_CHECKOUT_PAYMENTS_QUERYvariables = {"token": str(checkout_with_item.token)}@@ -1125,7 +1127,10 @@ def test_checkout_available_payment_gateways(def test_checkout_available_payment_gateways_currency_specified_USD(- api_client, checkout_with_item, expected_dummy_gateway, sample_gateway,+ api_client,+ checkout_with_item,+ expected_dummy_gateway,+ sample_gateway,):checkout_with_item.currency = "USD"checkout_with_item.save(update_fields=["currency"])@@ -2244,7 +2249,9 @@ def test_anonymous_client_cant_fetch_checkout_user(api_client, checkout):def test_authorized_access_to_checkout_user_as_customer(- user_api_client, checkout, customer_user,+ user_api_client,+ checkout,+ customer_user,):query = QUERY_CHECKOUT_USER_IDcheckout.user = customer_user@@ -2283,7 +2290,10 @@ def test_authorized_access_to_checkout_user_as_staff(def test_authorized_access_to_checkout_user_as_staff_no_permission(- staff_api_client, checkout, customer_user, permission_manage_checkouts,+ staff_api_client,+ checkout,+ customer_user,+ permission_manage_checkouts,):query = QUERY_CHECKOUT_USER_IDdiff --git a/saleor/graphql/checkout/tests/test_checkout_complete.py b/saleor/graphql/checkout/tests/test_checkout_complete.pyindex 7568638dff..eb659a11ed 100644--- a/saleor/graphql/checkout/tests/test_checkout_complete.py+++ b/saleor/graphql/checkout/tests/test_checkout_complete.py@@ -63,7 +63,9 @@ ACTION_REQUIRED_GATEWAY_RESPONSE = GatewayResponse(def test_checkout_complete_order_already_exists(- user_api_client, order_with_lines, checkout_with_gift_card,+ user_api_client,+ order_with_lines,+ checkout_with_gift_card,):checkout = checkout_with_gift_cardorders_count = Order.objects.count()@@ -84,7 +86,9 @@ def test_checkout_complete_order_already_exists(def test_checkout_complete_with_inactive_channel_order_already_exists(- user_api_client, order_with_lines, checkout_with_gift_card,+ user_api_client,+ order_with_lines,+ checkout_with_gift_card,):checkout = checkout_with_gift_cardorder_with_lines.checkout_token = checkout.pkdiff --git a/saleor/graphql/checkout/types.py b/saleor/graphql/checkout/types.pyindex ea2d0219f5..dde7762369 100644--- a/saleor/graphql/checkout/types.py+++ b/saleor/graphql/checkout/types.py@@ -202,7 +202,8 @@ class Checkout(CountableDjangoObjectType):description="The price of the shipping, with all the taxes included.",)shipping_method = graphene.Field(- ShippingMethod, description="The shipping method related with checkout.",+ ShippingMethod,+ description="The shipping method related with checkout.",)subtotal_price = graphene.Field(TaxedMoney,diff --git a/saleor/graphql/core/connection.py b/saleor/graphql/core/connection.pyindex 5fb11a4bc9..9e2498138c 100644--- a/saleor/graphql/core/connection.py+++ b/saleor/graphql/core/connection.py@@ -2,7 +2,8 @@ import jsonfrom typing import Any, Dict, Iterable, List, Tuple, Unionimport graphene-from django.db.models import Model as DjangoModel, Q, QuerySet+from django.db.models import Model as DjangoModel+from django.db.models import Q, QuerySetfrom graphene.relay.connection import Connectionfrom graphene_django.types import DjangoObjectTypefrom graphql.error import GraphQLError@@ -218,7 +219,10 @@ def connection_from_queryset_slice(qs = qs[:end_margin]edges, page_info = _get_edges_for_connection(edge_type, qs, args, sorting_fields)- return connection_type(edges=edges, page_info=pageinfo_type(**page_info),)+ return connection_type(+ edges=edges,+ page_info=pageinfo_type(**page_info),+ )class NonNullConnection(Connection):diff --git a/saleor/graphql/core/enums.py b/saleor/graphql/core/enums.pyindex fcbf242878..2723970b22 100644--- a/saleor/graphql/core/enums.py+++ b/saleor/graphql/core/enums.py@@ -5,7 +5,8 @@ from ...app import error_codes as app_error_codesfrom ...attribute import error_codes as attribute_error_codesfrom ...channel import error_codes as channel_error_codesfrom ...checkout import error_codes as checkout_error_codes-from ...core import JobStatus, error_codes as core_error_codes+from ...core import JobStatus+from ...core import error_codes as core_error_codesfrom ...core.permissions import get_permissions_enum_listfrom ...core.weight import WeightUnitsfrom ...csv import error_codes as csv_error_codesdiff --git a/saleor/graphql/core/types/common.py b/saleor/graphql/core/types/common.pyindex 365ee5ddb6..04c95ac9c2 100644--- a/saleor/graphql/core/types/common.py+++ b/saleor/graphql/core/types/common.py@@ -160,10 +160,12 @@ class MetadataError(Error):class OrderError(Error):code = OrderErrorCode(description="The error code.", required=True)warehouse = graphene.ID(- description="Warehouse ID which causes the error.", required=False,+ description="Warehouse ID which causes the error.",+ required=False,)order_line = graphene.ID(- description="Order line ID which causes the error.", required=False,+ description="Order line ID which causes the error.",+ required=False,)variants = graphene.List(graphene.NonNull(graphene.ID),diff --git a/saleor/graphql/core/types/filter_input.py b/saleor/graphql/core/types/filter_input.pyindex e3d678a2c8..f9e2dd56a1 100644--- a/saleor/graphql/core/types/filter_input.py+++ b/saleor/graphql/core/types/filter_input.py@@ -66,7 +66,8 @@ class FilterInputObjectType(InputObjectType):class ChannelFilterInputObjectType(FilterInputObjectType):channel = Argument(- String, description="Specifies the channel by which the data should be sorted.",+ String,+ description="Specifies the channel by which the data should be sorted.",)class Meta:diff --git a/saleor/graphql/core/types/sort_input.py b/saleor/graphql/core/types/sort_input.pyindex fe9199582a..7ebd9f341e 100644--- a/saleor/graphql/core/types/sort_input.py+++ b/saleor/graphql/core/types/sort_input.py@@ -39,7 +39,8 @@ class SortInputObjectType(graphene.InputObjectType):class ChannelSortInputObjectType(SortInputObjectType):channel = graphene.Argument(- graphene.String, description="Specifies the channel in which to sort the data.",+ graphene.String,+ description="Specifies the channel in which to sort the data.",)class Meta:diff --git a/saleor/graphql/csv/tests/mutations/test_export_products.py b/saleor/graphql/csv/tests/mutations/test_export_products.pyindex dd34727f70..f3b9e8a4fd 100644--- a/saleor/graphql/csv/tests/mutations/test_export_products.py+++ b/saleor/graphql/csv/tests/mutations/test_export_products.py@@ -184,7 +184,10 @@ def test_export_products_mutation_ids_scope(export_file_data = data["exportFile"]export_products_mock.assert_called_once()- (call_args, call_kwargs,) = export_products_mock.call_args+ (+ call_args,+ call_kwargs,+ ) = export_products_mock.call_argsassert set(call_args[1]["ids"]) == pksassert call_args[2] == {"fields": [ProductFieldEnum.NAME.value]}@@ -257,7 +260,10 @@ def test_export_products_mutation_with_warehouse_and_attribute_ids(export_file_data = data["exportFile"]export_products_mock.assert_called_once()- (call_args, call_kwargs,) = export_products_mock.call_args+ (+ call_args,+ call_kwargs,+ ) = export_products_mock.call_argsassert set(call_args[1]["ids"]) == pksassert call_args[2] == {diff --git a/saleor/graphql/csv/types.py b/saleor/graphql/csv/types.pyindex c72a20f276..c4fd680641 100644--- a/saleor/graphql/csv/types.py+++ b/saleor/graphql/csv/types.py@@ -14,7 +14,8 @@ from .enums import ExportEventEnumclass ExportEvent(CountableDjangoObjectType):date = graphene.types.datetime.DateTime(- description="Date when event happened at in ISO 8601 format.", required=True,+ description="Date when event happened at in ISO 8601 format.",+ required=True,)type = ExportEventEnum(description="Export event type.", required=True)user = graphene.Field(@@ -23,7 +24,10 @@ class ExportEvent(CountableDjangoObjectType):app = graphene.Field(App, description="App which performed the action.", required=False)- message = graphene.String(description="Content of the event.", required=True,)+ message = graphene.String(+ description="Content of the event.",+ required=True,+ )class Meta:description = "History log of export file."diff --git a/saleor/graphql/discount/mutations.py b/saleor/graphql/discount/mutations.pyindex d8dce59543..a215095811 100644--- a/saleor/graphql/discount/mutations.py+++ b/saleor/graphql/discount/mutations.py@@ -397,7 +397,9 @@ class VoucherChannelListingUpdate(BaseChannelListingMutation):if "min_amount_spent" in add_channel.keys():defaults["min_spent_amount"] = add_channel.get("min_amount_spent", None)models.VoucherChannelListing.objects.update_or_create(- voucher=voucher, channel=channel, defaults=defaults,+ voucher=voucher,+ channel=channel,+ defaults=defaults,)@classmethod@@ -598,7 +600,9 @@ class SaleChannelListingUpdate(BaseChannelListingMutation):if "discount_value" in add_channel.keys():defaults["discount_value"] = add_channel.get("discount_value")SaleChannelListing.objects.update_or_create(- sale=sale, channel=channel, defaults=defaults,+ sale=sale,+ channel=channel,+ defaults=defaults,)@classmethoddiff --git a/saleor/graphql/discount/tests/benchmark/test_sales.py b/saleor/graphql/discount/tests/benchmark/test_sales.pyindex 40d93309b2..a773a7c4bf 100644--- a/saleor/graphql/discount/tests/benchmark/test_sales.py+++ b/saleor/graphql/discount/tests/benchmark/test_sales.py@@ -107,7 +107,10 @@ def test_sales_query_with_channel_slug(@pytest.mark.django_db@pytest.mark.count_queries(autouse=False)def test_sales_query_withot_channel_slug(- staff_api_client, sales_list, permission_manage_discounts, count_queries,+ staff_api_client,+ sales_list,+ permission_manage_discounts,+ count_queries,):get_graphql_content(staff_api_client.post_graphql(diff --git a/saleor/graphql/discount/tests/benchmark/test_vouchers.py b/saleor/graphql/discount/tests/benchmark/test_vouchers.pyindex 608c5faeec..84b603d5fb 100644--- a/saleor/graphql/discount/tests/benchmark/test_vouchers.py+++ b/saleor/graphql/discount/tests/benchmark/test_vouchers.py@@ -129,7 +129,10 @@ def test_vouchers_query_with_channel_slug(@pytest.mark.django_db@pytest.mark.count_queries(autouse=False)def test_vouchers_query_withot_channel_slug(- staff_api_client, vouchers_list, permission_manage_discounts, count_queries,+ staff_api_client,+ vouchers_list,+ permission_manage_discounts,+ count_queries,):get_graphql_content(staff_api_client.post_graphql(diff --git a/saleor/graphql/discount/tests/test_discount.py b/saleor/graphql/discount/tests/test_discount.pyindex f90c453163..9875b0a2fa 100644--- a/saleor/graphql/discount/tests/test_discount.py+++ b/saleor/graphql/discount/tests/test_discount.py@@ -1191,9 +1191,16 @@ def test_query_vouchers_with_filter_status():Voucher.objects.bulk_create([- Voucher(name="Voucher1", code="abc", start_date=timezone.now(),),Voucher(- name="Voucher2", code="123", start_date=start_date, end_date=end_date,+ name="Voucher1",+ code="abc",+ start_date=timezone.now(),+ ),+ Voucher(+ name="Voucher2",+ code="123",+ start_date=start_date,+ end_date=end_date,),])@@ -1302,7 +1309,9 @@ def test_query_vouchers_with_filter_discount_type(discount_value_type=DiscountValueType.FIXED,),Voucher(- name="Voucher2", code="123", discount_value_type=discount_value_type,+ name="Voucher2",+ code="123",+ discount_value_type=discount_value_type,),])diff --git a/saleor/graphql/discount/tests/test_pagination.py b/saleor/graphql/discount/tests/test_pagination.pyindex 455553fd4a..96169d16f7 100644--- a/saleor/graphql/discount/tests/test_pagination.py+++ b/saleor/graphql/discount/tests/test_pagination.py@@ -21,13 +21,19 @@ def sales_for_pagination(channel_USD):end_date=now + timezone.timedelta(hours=14),type=DiscountValueType.PERCENTAGE,),- Sale(name="Sale2", end_date=now + timezone.timedelta(hours=1),),+ Sale(+ name="Sale2",+ end_date=now + timezone.timedelta(hours=1),+ ),Sale(name="Sale3",end_date=now + timezone.timedelta(hours=2),type=DiscountValueType.PERCENTAGE,),- Sale(name="Sale4", end_date=now + timezone.timedelta(hours=1),),+ Sale(+ name="Sale4",+ end_date=now + timezone.timedelta(hours=1),+ ),Sale(name="Sale15",start_date=now + timezone.timedelta(hours=1),@@ -110,7 +116,10 @@ def test_sales_pagination_with_sorting(def test_sales_pagination_with_sorting_and_channel(- staff_api_client, permission_manage_discounts, sales_for_pagination, channel_USD,+ staff_api_client,+ permission_manage_discounts,+ sales_for_pagination,+ channel_USD,):page_size = 3sales_order = ["Sale1", "Sale3", "Sale4"]diff --git a/saleor/graphql/discount/tests/test_sale_channel_listing.py b/saleor/graphql/discount/tests/test_sale_channel_listing.pyindex 28f4dbf2ea..3d9605f1d2 100644--- a/saleor/graphql/discount/tests/test_sale_channel_listing.py+++ b/saleor/graphql/discount/tests/test_sale_channel_listing.py@@ -128,7 +128,10 @@ def test_sale_channel_listing_update_as_staff_user(def test_sale_channel_listing_update_with_negative_discounted_value(- staff_api_client, sale, permission_manage_discounts, channel_USD,+ staff_api_client,+ sale,+ permission_manage_discounts,+ channel_USD,):# givensale_id = graphene.Node.to_global_id("Sale", sale.pk)@@ -152,7 +155,8 @@ def test_sale_channel_listing_update_with_negative_discounted_value(staff_api_client.user.user_permissions.add(permission_manage_discounts)response = staff_api_client.post_graphql(- SALE_CHANNEL_LISTING_UPDATE_MUTATION, variables=variables,+ SALE_CHANNEL_LISTING_UPDATE_MUTATION,+ variables=variables,)assert_negative_positive_decimal_value(response)diff --git a/saleor/graphql/discount/tests/test_sale_sorting_with_channels.py b/saleor/graphql/discount/tests/test_sale_sorting_with_channels.pyindex 87fdaea515..35e5709685 100644--- a/saleor/graphql/discount/tests/test_sale_sorting_with_channels.py+++ b/saleor/graphql/discount/tests/test_sale_sorting_with_channels.py@@ -10,9 +10,15 @@ from ...tests.utils import assert_graphql_error_with_message, get_graphql_contendef sales_for_sorting_with_channels(db, channel_USD, channel_PLN):sales = Sale.objects.bulk_create([- Sale(name="Sale1", type=DiscountValueType.PERCENTAGE,),+ Sale(+ name="Sale1",+ type=DiscountValueType.PERCENTAGE,+ ),Sale(name="Sale2"),- Sale(name="Sale3", type=DiscountValueType.PERCENTAGE,),+ Sale(+ name="Sale3",+ type=DiscountValueType.PERCENTAGE,+ ),Sale(name="Sale4"),Sale(name="Sale15"),]@@ -91,7 +97,8 @@ QUERY_SALES_WITH_SORTING_AND_FILTERING = """def test_sales_with_sorting_and_without_channel(- staff_api_client, permission_manage_discounts,+ staff_api_client,+ permission_manage_discounts,):# givenvariables = {"sortBy": {"field": "VALUE", "direction": "ASC"}}diff --git a/saleor/graphql/discount/tests/test_voucher_channel_listing.py b/saleor/graphql/discount/tests/test_voucher_channel_listing.pyindex 3b3935532b..f02f24f939 100644--- a/saleor/graphql/discount/tests/test_voucher_channel_listing.py+++ b/saleor/graphql/discount/tests/test_voucher_channel_listing.py@@ -109,7 +109,8 @@ def test_voucher_channel_listing_update_as_customer(# whenresponse = user_api_client.post_graphql(- VOUCHER_CHANNEL_LISTING_UPDATE_MUTATION, variables=variables,+ VOUCHER_CHANNEL_LISTING_UPDATE_MUTATION,+ variables=variables,)# then@@ -130,7 +131,8 @@ def test_voucher_channel_listing_update_as_anonymous(# whenresponse = api_client.post_graphql(- VOUCHER_CHANNEL_LISTING_UPDATE_MUTATION, variables=variables,+ VOUCHER_CHANNEL_LISTING_UPDATE_MUTATION,+ variables=variables,)# then@@ -194,7 +196,11 @@ def test_voucher_channel_listing_create_many_channel(def test_voucher_channel_listing_create_and_remove(- staff_api_client, voucher, permission_manage_discounts, channel_USD, channel_PLN,+ staff_api_client,+ voucher,+ permission_manage_discounts,+ channel_USD,+ channel_PLN,):# givenvoucher_id = graphene.Node.to_global_id("Voucher", voucher.pk)@@ -236,7 +242,10 @@ def test_voucher_channel_listing_create_and_remove(def test_voucher_channel_listing_update(- staff_api_client, voucher, permission_manage_discounts, channel_USD,+ staff_api_client,+ voucher,+ permission_manage_discounts,+ channel_USD,):# givenvoucher_id = graphene.Node.to_global_id("Voucher", voucher.pk)@@ -277,7 +286,10 @@ def test_voucher_channel_listing_update(def test_voucher_channel_listing_update_without_discount_value(- staff_api_client, voucher, permission_manage_discounts, channel_USD,+ staff_api_client,+ voucher,+ permission_manage_discounts,+ channel_USD,):# givenvoucher_id = graphene.Node.to_global_id("Voucher", voucher.pk)@@ -312,7 +324,10 @@ def test_voucher_channel_listing_update_without_discount_value(def test_voucher_channel_listing_remove_channel(- staff_api_client, voucher, permission_manage_discounts, channel_USD,+ staff_api_client,+ voucher,+ permission_manage_discounts,+ channel_USD,):# givenvoucher_id = graphene.Node.to_global_id("Voucher", voucher.pk)@@ -338,7 +353,10 @@ def test_voucher_channel_listing_remove_channel(def test_voucher_channel_listing_update_with_null_as_discount_value(- staff_api_client, voucher, permission_manage_discounts, channel_USD,+ staff_api_client,+ voucher,+ permission_manage_discounts,+ channel_USD,):# givenvoucher_id = graphene.Node.to_global_id("Voucher", voucher.pk)@@ -373,7 +391,10 @@ def test_voucher_channel_listing_update_with_null_as_discount_value(def test_voucher_channel_listing_create_with_null_as_discount_value(- staff_api_client, voucher_without_channel, permission_manage_discounts, channel_USD,+ staff_api_client,+ voucher_without_channel,+ permission_manage_discounts,+ channel_USD,):# givenvoucher = voucher_without_channel@@ -409,7 +430,10 @@ def test_voucher_channel_listing_create_with_null_as_discount_value(def test_voucher_channel_listing_create_without_discount_value(- staff_api_client, voucher_without_channel, permission_manage_discounts, channel_USD,+ staff_api_client,+ voucher_without_channel,+ permission_manage_discounts,+ channel_USD,):# givenvoucher = voucher_without_channel@@ -437,7 +461,10 @@ def test_voucher_channel_listing_create_without_discount_value(def test_voucher_channel_listing_update_duplicates_in_add(- staff_api_client, voucher, permission_manage_discounts, channel_USD,+ staff_api_client,+ voucher,+ permission_manage_discounts,+ channel_USD,):# givenvoucher_id = graphene.Node.to_global_id("Voucher", voucher.pk)@@ -469,7 +496,10 @@ def test_voucher_channel_listing_update_duplicates_in_add(def test_voucher_channel_listing_update_duplicates_in_remove(- staff_api_client, voucher, permission_manage_discounts, channel_USD,+ staff_api_client,+ voucher,+ permission_manage_discounts,+ channel_USD,):# givenvoucher_id = graphene.Node.to_global_id("Voucher", voucher.pk)@@ -496,7 +526,10 @@ def test_voucher_channel_listing_update_duplicates_in_remove(def test_voucher_channel_listing_update_duplicates_in_add_and_remove(- staff_api_client, voucher, permission_manage_discounts, channel_USD,+ staff_api_client,+ voucher,+ permission_manage_discounts,+ channel_USD,):# givenvoucher_id = graphene.Node.to_global_id("Voucher", voucher.pk)@@ -526,7 +559,10 @@ def test_voucher_channel_listing_update_duplicates_in_add_and_remove(def test_voucher_channel_listing_update_invalid_precision_discount_value(- staff_api_client, voucher, permission_manage_discounts, channel_USD,+ staff_api_client,+ voucher,+ permission_manage_discounts,+ channel_USD,):# givenvoucher_id = graphene.Node.to_global_id("Voucher", voucher.pk)@@ -561,7 +597,10 @@ def test_voucher_channel_listing_update_invalid_precision_discount_value(def test_voucher_channel_listing_update_invalid_precision_min_amount_spent(- staff_api_client, voucher, permission_manage_discounts, channel_USD,+ staff_api_client,+ voucher,+ permission_manage_discounts,+ channel_USD,):# givenvoucher_id = graphene.Node.to_global_id("Voucher", voucher.pk)diff --git a/saleor/graphql/discount/tests/test_voucher_sorting_with_channels.py b/saleor/graphql/discount/tests/test_voucher_sorting_with_channels.pyindex f589da8321..7c24cf24fd 100644--- a/saleor/graphql/discount/tests/test_voucher_sorting_with_channels.py+++ b/saleor/graphql/discount/tests/test_voucher_sorting_with_channels.py@@ -133,7 +133,9 @@ QUERY_VOUCHERS_WITH_SORTING_AND_FILTERING = """],)def test_voucher_with_sorting_and_without_channel(- sort_by, staff_api_client, permission_manage_discounts,+ sort_by,+ staff_api_client,+ permission_manage_discounts,):# givenvariables = {"sortBy": sort_by}diff --git a/saleor/graphql/invoice/mutations.py b/saleor/graphql/invoice/mutations.pyindex 3961305e5c..95ba6930e4 100644--- a/saleor/graphql/invoice/mutations.py+++ b/saleor/graphql/invoice/mutations.py@@ -6,7 +6,8 @@ from ...core.permissions import OrderPermissionsfrom ...invoice import events, modelsfrom ...invoice.emails import send_invoicefrom ...invoice.error_codes import InvoiceErrorCode-from ...order import OrderStatus, events as order_events+from ...order import OrderStatus+from ...order import events as order_eventsfrom ..core.mutations import ModelDeleteMutation, ModelMutationfrom ..core.types.common import InvoiceErrorfrom ..invoice.types import Invoice@@ -62,7 +63,8 @@ class InvoiceRequest(ModelMutation):cls.clean_order(order)shallow_invoice = models.Invoice.objects.create(- order=order, number=data.get("number"),+ order=order,+ number=data.get("number"),)invoice = info.context.plugins.invoice_request(order=order, invoice=shallow_invoice, number=data.get("number")@@ -70,7 +72,9 @@ class InvoiceRequest(ModelMutation):if invoice.status == JobStatus.SUCCESS:order_events.invoice_generated_event(- order=order, user=info.context.user, invoice_number=invoice.number,+ order=order,+ user=info.context.user,+ invoice_number=invoice.number,)else:order_events.invoice_requested_event(user=info.context.user, order=order)@@ -108,7 +112,8 @@ class InvoiceCreate(ModelMutation):for field in ["url", "number"]:if data["input"][field] == "":validation_errors[field] = ValidationError(- f"{field} cannot be empty.", code=InvoiceErrorCode.REQUIRED,+ f"{field} cannot be empty.",+ code=InvoiceErrorCode.REQUIRED,)if validation_errors:raise ValidationError(validation_errors)@@ -154,7 +159,9 @@ class InvoiceCreate(ModelMutation):url=cleaned_input["url"],)order_events.invoice_generated_event(- order=order, user=info.context.user, invoice_number=cleaned_input["number"],+ order=order,+ user=info.context.user,+ invoice_number=cleaned_input["number"],)return InvoiceCreate(invoice=invoice)diff --git a/saleor/graphql/menu/tests/test_menu.py b/saleor/graphql/menu/tests/test_menu.pyindex 9fec1b007b..b13999441e 100644--- a/saleor/graphql/menu/tests/test_menu.py+++ b/saleor/graphql/menu/tests/test_menu.py@@ -37,7 +37,8 @@ QUERY_MENU = """def test_menu_query_by_id(- user_api_client, menu,+ user_api_client,+ menu,):variables = {"id": graphene.Node.to_global_id("Menu", menu.pk)}@@ -49,7 +50,8 @@ def test_menu_query_by_id(def test_menu_query_by_name(- user_api_client, menu,+ user_api_client,+ menu,):variables = {"name": menu.name}response = user_api_client.post_graphql(QUERY_MENU, variables=variables)@@ -71,7 +73,9 @@ def test_menu_query_by_slug(user_api_client):def test_menu_query_error_when_id_and_name_provided(- user_api_client, menu, graphql_log_handler,+ user_api_client,+ menu,+ graphql_log_handler,):variables = {"id": graphene.Node.to_global_id("Menu", menu.pk),@@ -86,7 +90,9 @@ def test_menu_query_error_when_id_and_name_provided(def test_menu_query_error_when_no_param(- user_api_client, menu, graphql_log_handler,+ user_api_client,+ menu,+ graphql_log_handler,):variables = {}response = user_api_client.post_graphql(QUERY_MENU, variables=variables)diff --git a/saleor/graphql/menu/tests/test_pagination.py b/saleor/graphql/menu/tests/test_pagination.pyindex 20d487d8ec..02678b8d7d 100644--- a/saleor/graphql/menu/tests/test_pagination.py+++ b/saleor/graphql/menu/tests/test_pagination.py@@ -51,12 +51,18 @@ QUERY_MENUS_PAGINATION = """],)def test_menus_pagination_with_sorting(- sort_by, menus_order, staff_api_client, menus_for_pagination,+ sort_by,+ menus_order,+ staff_api_client,+ menus_for_pagination,):page_size = 3variables = {"first": page_size, "after": None, "sortBy": sort_by}- response = staff_api_client.post_graphql(QUERY_MENUS_PAGINATION, variables,)+ response = staff_api_client.post_graphql(+ QUERY_MENUS_PAGINATION,+ variables,+ )content = get_graphql_content(response)menus_nodes = content["data"]["menus"]["edges"]assert menus_order[0] == menus_nodes[0]["node"]["name"]@@ -73,12 +79,18 @@ def test_menus_pagination_with_sorting(],)def test_menus_pagination_with_filtering(- filter_by, menus_order, staff_api_client, menus_for_pagination,+ filter_by,+ menus_order,+ staff_api_client,+ menus_for_pagination,):page_size = 2variables = {"first": page_size, "after": None, "filter": filter_by}- response = staff_api_client.post_graphql(QUERY_MENUS_PAGINATION, variables,)+ response = staff_api_client.post_graphql(+ QUERY_MENUS_PAGINATION,+ variables,+ )content = get_graphql_content(response)menus_nodes = content["data"]["menus"]["edges"]assert menus_order[0] == menus_nodes[0]["node"]["name"]@@ -137,12 +149,18 @@ QUERY_MENU_ITEMS_PAGINATION = """],)def test_menu_items_pagination_with_sorting(- sort_by, menu_items_order, staff_api_client, menu_items_for_pagination,+ sort_by,+ menu_items_order,+ staff_api_client,+ menu_items_for_pagination,):page_size = 3variables = {"first": page_size, "after": None, "sortBy": sort_by}- response = staff_api_client.post_graphql(QUERY_MENU_ITEMS_PAGINATION, variables,)+ response = staff_api_client.post_graphql(+ QUERY_MENU_ITEMS_PAGINATION,+ variables,+ )content = get_graphql_content(response)menu_items_nodes = content["data"]["menuItems"]["edges"]assert menu_items_order[0] == menu_items_nodes[0]["node"]["name"]@@ -159,12 +177,18 @@ def test_menu_items_pagination_with_sorting(],)def test_menu_items_pagination_with_filtering(- filter_by, menu_items_order, staff_api_client, menu_items_for_pagination,+ filter_by,+ menu_items_order,+ staff_api_client,+ menu_items_for_pagination,):page_size = 2variables = {"first": page_size, "after": None, "filter": filter_by}- response = staff_api_client.post_graphql(QUERY_MENU_ITEMS_PAGINATION, variables,)+ response = staff_api_client.post_graphql(+ QUERY_MENU_ITEMS_PAGINATION,+ variables,+ )content = get_graphql_content(response)menu_items_nodes = content["data"]["menuItems"]["edges"]assert menu_items_order[0] == menu_items_nodes[0]["node"]["name"]diff --git a/saleor/graphql/meta/mutations.py b/saleor/graphql/meta/mutations.pyindex f0f3a74733..9f2d39e6cb 100644--- a/saleor/graphql/meta/mutations.py+++ b/saleor/graphql/meta/mutations.py@@ -27,7 +27,11 @@ class BaseMetadataMutation(BaseMutation):@classmethoddef __init_subclass_with_meta__(- cls, arguments=None, permission_map=[], _meta=None, **kwargs,+ cls,+ arguments=None,+ permission_map=[],+ _meta=None,+ **kwargs,):if not _meta:_meta = MetadataPermissionOptions(cls)diff --git a/saleor/graphql/meta/permissions.py b/saleor/graphql/meta/permissions.pyindex 6036e07adf..03df816689 100644--- a/saleor/graphql/meta/permissions.py+++ b/saleor/graphql/meta/permissions.py@@ -1,7 +1,8 @@from typing import Any, Listfrom ...account import models as account_models-from ...attribute import AttributeType, models as attribute_models+from ...attribute import AttributeType+from ...attribute import models as attribute_modelsfrom ...core.exceptions import PermissionDeniedfrom ...core.permissions import (AccountPermissions,diff --git a/saleor/graphql/meta/resolvers.py b/saleor/graphql/meta/resolvers.pyindex d461ea81d2..7fc0f4f516 100644--- a/saleor/graphql/meta/resolvers.py+++ b/saleor/graphql/meta/resolvers.py@@ -19,8 +19,8 @@ def resolve_object_with_metadata_type(instance: ModelWithMetadata):from ...invoice import models as invoice_modelsfrom ...menu import models as menu_modelsfrom ..account import types as account_types- from ..attribute import types as attribute_typesfrom ..app import types as app_types+ from ..attribute import types as attribute_typesfrom ..checkout import types as checkout_typesfrom ..invoice import types as invoice_typesfrom ..menu import types as menu_types@@ -55,7 +55,8 @@ def resolve_object_with_metadata_type(instance: ModelWithMetadata):def resolve_metadata(metadata: dict):return sorted(- [{"key": k, "value": v} for k, v in metadata.items()], key=itemgetter("key"),+ [{"key": k, "value": v} for k, v in metadata.items()],+ key=itemgetter("key"),)diff --git a/saleor/graphql/meta/tests/test_meta_mutations.py b/saleor/graphql/meta/tests/test_meta_mutations.pyindex 959d6cd683..c05835ad1e 100644--- a/saleor/graphql/meta/tests/test_meta_mutations.py+++ b/saleor/graphql/meta/tests/test_meta_mutations.py@@ -45,7 +45,12 @@ mutation UpdatePublicMetadata($id: ID!, $input: [MetadataInput!]!) {def execute_update_public_metadata_for_item(- client, permissions, item_id, item_type, key=PUBLIC_KEY, value=PUBLIC_VALUE,+ client,+ permissions,+ item_id,+ item_type,+ key=PUBLIC_KEY,+ value=PUBLIC_VALUE,):variables = {"id": item_id,@@ -86,7 +91,11 @@ def execute_update_public_metadata_for_multiple_items(def item_contains_proper_public_metadata(- item_from_response, item, item_id, key=PUBLIC_KEY, value=PUBLIC_VALUE,+ item_from_response,+ item,+ item_id,+ key=PUBLIC_KEY,+ value=PUBLIC_VALUE,):if item_from_response["id"] != item_id:return False@@ -206,7 +215,8 @@ def test_add_public_metadata_for_staff_as_app_no_permission(@pytest.mark.parametrize(- "input", [{"key": " ", "value": "test"}, {"key": " ", "value": ""}],+ "input",+ [{"key": " ", "value": "test"}, {"key": " ", "value": ""}],)def test_staff_update_metadata_empty_key(input, staff_api_client, permission_manage_staff, admin_user@@ -503,7 +513,10 @@ def test_add_public_metadata_for_product_variant(# whenresponse = execute_update_public_metadata_for_item(- staff_api_client, permission_manage_products, variant_id, "ProductVariant",+ staff_api_client,+ permission_manage_products,+ variant_id,+ "ProductVariant",)# then@@ -518,7 +531,10 @@ def test_add_public_metadata_for_app(staff_api_client, permission_manage_apps, a# whenresponse = execute_update_public_metadata_for_item(- staff_api_client, permission_manage_apps, app_id, "App",+ staff_api_client,+ permission_manage_apps,+ app_id,+ "App",)# then@@ -533,7 +549,10 @@ def test_add_public_metadata_for_page(staff_api_client, permission_manage_pages,# whenresponse = execute_update_public_metadata_for_item(- staff_api_client, permission_manage_pages, page_id, "Page",+ staff_api_client,+ permission_manage_pages,+ page_id,+ "Page",)# then@@ -560,7 +579,9 @@ def test_add_public_metadata_for_shipping_method(# thenassert item_contains_proper_public_metadata(- response["data"]["updateMetadata"]["item"], shipping_method, shipping_method_id,+ response["data"]["updateMetadata"]["item"],+ shipping_method,+ shipping_method_id,)@@ -572,12 +593,17 @@ def test_add_public_metadata_for_shipping_zone(# whenresponse = execute_update_public_metadata_for_item(- staff_api_client, permission_manage_shipping, shipping_zone_id, "ShippingZone",+ staff_api_client,+ permission_manage_shipping,+ shipping_zone_id,+ "ShippingZone",)# thenassert item_contains_proper_public_metadata(- response["data"]["updateMetadata"]["item"], shipping_zone, shipping_zone_id,+ response["data"]["updateMetadata"]["item"],+ shipping_zone,+ shipping_zone_id,)@@ -587,12 +613,17 @@ def test_add_public_metadata_for_menu(staff_api_client, permission_manage_menus,# whenresponse = execute_update_public_metadata_for_item(- staff_api_client, permission_manage_menus, menu_id, "Menu",+ staff_api_client,+ permission_manage_menus,+ menu_id,+ "Menu",)# thenassert item_contains_proper_public_metadata(- response["data"]["updateMetadata"]["item"], menu, menu_id,+ response["data"]["updateMetadata"]["item"],+ menu,+ menu_id,)@@ -604,12 +635,17 @@ def test_add_public_metadata_for_menu_item(# whenresponse = execute_update_public_metadata_for_item(- staff_api_client, permission_manage_menus, menu_item_id, "MenuItem",+ staff_api_client,+ permission_manage_menus,+ menu_item_id,+ "MenuItem",)# thenassert item_contains_proper_public_metadata(- response["data"]["updateMetadata"]["item"], menu_item, menu_item_id,+ response["data"]["updateMetadata"]["item"],+ menu_item,+ menu_item_id,)@@ -692,7 +728,11 @@ mutation DeletePublicMetadata($id: ID!, $keys: [String!]!) {def execute_clear_public_metadata_for_item(- client, permissions, item_id, item_type, key=PUBLIC_KEY,+ client,+ permissions,+ item_id,+ item_type,+ key=PUBLIC_KEY,):variables = {"id": item_id,@@ -726,7 +766,11 @@ def execute_clear_public_metadata_for_multiple_items(def item_without_public_metadata(- item_from_response, item, item_id, key=PUBLIC_KEY, value=PUBLIC_VALUE,+ item_from_response,+ item,+ item_id,+ key=PUBLIC_KEY,+ value=PUBLIC_VALUE,):if item_from_response["id"] != item_id:return False@@ -1139,7 +1183,10 @@ def test_delete_public_metadata_for_app(staff_api_client, permission_manage_apps# whenresponse = execute_clear_public_metadata_for_item(- staff_api_client, permission_manage_apps, app_id, "App",+ staff_api_client,+ permission_manage_apps,+ app_id,+ "App",)# then@@ -1158,7 +1205,10 @@ def test_delete_public_metadata_for_page(# whenresponse = execute_clear_public_metadata_for_item(- staff_api_client, permission_manage_pages, page_id, "Page",+ staff_api_client,+ permission_manage_pages,+ page_id,+ "Page",)# then@@ -1187,7 +1237,9 @@ def test_delete_public_metadata_for_shipping_method(# thenassert item_without_public_metadata(- response["data"]["deleteMetadata"]["item"], shipping_method, shipping_method_id,+ response["data"]["deleteMetadata"]["item"],+ shipping_method,+ shipping_method_id,)@@ -1201,12 +1253,17 @@ def test_delete_public_metadata_for_shipping_zone(# whenresponse = execute_clear_public_metadata_for_item(- staff_api_client, permission_manage_shipping, shipping_zone_id, "ShippingZone",+ staff_api_client,+ permission_manage_shipping,+ shipping_zone_id,+ "ShippingZone",)# thenassert item_without_public_metadata(- response["data"]["deleteMetadata"]["item"], shipping_zone, shipping_zone_id,+ response["data"]["deleteMetadata"]["item"],+ shipping_zone,+ shipping_zone_id,)@@ -1220,12 +1277,17 @@ def test_delete_public_metadata_for_menu(# whenresponse = execute_clear_public_metadata_for_item(- staff_api_client, permission_manage_menus, menu_id, "Menu",+ staff_api_client,+ permission_manage_menus,+ menu_id,+ "Menu",)# thenassert item_without_public_metadata(- response["data"]["deleteMetadata"]["item"], menu, menu_id,+ response["data"]["deleteMetadata"]["item"],+ menu,+ menu_id,)@@ -1239,12 +1301,17 @@ def test_delete_public_metadata_for_menu_item(# whenresponse = execute_clear_public_metadata_for_item(- staff_api_client, permission_manage_menus, menu_item_id, "MenuItem",+ staff_api_client,+ permission_manage_menus,+ menu_item_id,+ "MenuItem",)# thenassert item_without_public_metadata(- response["data"]["deleteMetadata"]["item"], menu_item, menu_item_id,+ response["data"]["deleteMetadata"]["item"],+ menu_item,+ menu_item_id,)@@ -1349,7 +1416,12 @@ mutation UpdatePrivateMetadata($id: ID!, $input: [MetadataInput!]!) {def execute_update_private_metadata_for_item(- client, permissions, item_id, item_type, key=PRIVATE_KEY, value=PRIVATE_VALUE,+ client,+ permissions,+ item_id,+ item_type,+ key=PRIVATE_KEY,+ value=PRIVATE_VALUE,):variables = {"id": item_id,@@ -1390,7 +1462,11 @@ def execute_update_private_metadata_for_multiple_items(def item_contains_proper_private_metadata(- item_from_response, item, item_id, key=PRIVATE_KEY, value=PRIVATE_VALUE,+ item_from_response,+ item,+ item_id,+ key=PRIVATE_KEY,+ value=PRIVATE_VALUE,):if item_from_response["id"] != item_id:return False@@ -1518,7 +1594,9 @@ def test_add_private_metadata_for_myself_as_customer_no_permission(user_api_clie# whenresponse = user_api_client.post_graphql(- UPDATE_PRIVATE_METADATA_MUTATION % "User", variables, permissions=[],+ UPDATE_PRIVATE_METADATA_MUTATION % "User",+ variables,+ permissions=[],)# then@@ -1526,7 +1604,8 @@ def test_add_private_metadata_for_myself_as_customer_no_permission(user_api_clie@pytest.mark.parametrize(- "input", [{"key": " ", "value": "test"}, {"key": " ", "value": ""}],+ "input",+ [{"key": " ", "value": "test"}, {"key": " ", "value": ""}],)def test_staff_update_private_metadata_empty_key(input, staff_api_client, permission_manage_staff, admin_user@@ -1564,7 +1643,9 @@ def test_add_private_metadata_for_myself_as_staff(staff_api_client):# whenresponse = staff_api_client.post_graphql(- UPDATE_PRIVATE_METADATA_MUTATION % "User", variables, permissions=[],+ UPDATE_PRIVATE_METADATA_MUTATION % "User",+ variables,+ permissions=[],)# then@@ -1787,7 +1868,10 @@ def test_add_private_metadata_for_product_variant(# whenresponse = execute_update_private_metadata_for_item(- staff_api_client, permission_manage_products, variant_id, "ProductVariant",+ staff_api_client,+ permission_manage_products,+ variant_id,+ "ProductVariant",)# then@@ -1802,12 +1886,17 @@ def test_add_private_metadata_for_app(staff_api_client, permission_manage_apps,# whenresponse = execute_update_private_metadata_for_item(- staff_api_client, permission_manage_apps, app_id, "App",+ staff_api_client,+ permission_manage_apps,+ app_id,+ "App",)# thenassert item_contains_proper_private_metadata(- response["data"]["updatePrivateMetadata"]["item"], app, app_id,+ response["data"]["updatePrivateMetadata"]["item"],+ app,+ app_id,)@@ -1817,12 +1906,17 @@ def test_add_private_metadata_for_page(staff_api_client, permission_manage_pages# whenresponse = execute_update_private_metadata_for_item(- staff_api_client, permission_manage_pages, page_id, "Page",+ staff_api_client,+ permission_manage_pages,+ page_id,+ "Page",)# thenassert item_contains_proper_private_metadata(- response["data"]["updatePrivateMetadata"]["item"], page, page_id,+ response["data"]["updatePrivateMetadata"]["item"],+ page,+ page_id,)@@ -1858,7 +1952,10 @@ def test_add_private_metadata_for_shipping_zone(# whenresponse = execute_update_private_metadata_for_item(- staff_api_client, permission_manage_shipping, shipping_zone_id, "ShippingZone",+ staff_api_client,+ permission_manage_shipping,+ shipping_zone_id,+ "ShippingZone",)# then@@ -1875,12 +1972,17 @@ def test_add_private_metadata_for_menu(staff_api_client, permission_manage_menus# whenresponse = execute_update_private_metadata_for_item(- staff_api_client, permission_manage_menus, menu_id, "Menu",+ staff_api_client,+ permission_manage_menus,+ menu_id,+ "Menu",)# thenassert item_contains_proper_private_metadata(- response["data"]["updatePrivateMetadata"]["item"], menu, menu_id,+ response["data"]["updatePrivateMetadata"]["item"],+ menu,+ menu_id,)@@ -1892,12 +1994,17 @@ def test_add_private_metadata_for_menu_item(# whenresponse = execute_update_private_metadata_for_item(- staff_api_client, permission_manage_menus, menu_item_id, "MenuItem",+ staff_api_client,+ permission_manage_menus,+ menu_item_id,+ "MenuItem",)# thenassert item_contains_proper_private_metadata(- response["data"]["updatePrivateMetadata"]["item"], menu_item, menu_item_id,+ response["data"]["updatePrivateMetadata"]["item"],+ menu_item,+ menu_item_id,)@@ -1988,7 +2095,11 @@ mutation DeletePrivateMetadata($id: ID!, $keys: [String!]!) {def execute_clear_private_metadata_for_item(- client, permissions, item_id, item_type, key=PRIVATE_KEY,+ client,+ permissions,+ item_id,+ item_type,+ key=PRIVATE_KEY,):variables = {"id": item_id,@@ -2022,7 +2133,11 @@ def execute_clear_private_metadata_for_multiple_items(def item_without_private_metadata(- item_from_response, item, item_id, key=PRIVATE_KEY, value=PRIVATE_VALUE,+ item_from_response,+ item,+ item_id,+ key=PRIVATE_KEY,+ value=PRIVATE_VALUE,):if item_from_response["id"] != item_id:return False@@ -2451,12 +2566,17 @@ def test_delete_private_metadata_for_app(staff_api_client, permission_manage_app# whenresponse = execute_clear_private_metadata_for_item(- staff_api_client, permission_manage_apps, app_id, "App",+ staff_api_client,+ permission_manage_apps,+ app_id,+ "App",)# thenassert item_without_private_metadata(- response["data"]["deletePrivateMetadata"]["item"], app, app_id,+ response["data"]["deletePrivateMetadata"]["item"],+ app,+ app_id,)@@ -2470,12 +2590,17 @@ def test_delete_private_metadata_for_page(# whenresponse = execute_clear_private_metadata_for_item(- staff_api_client, permission_manage_pages, page_id, "Page",+ staff_api_client,+ permission_manage_pages,+ page_id,+ "Page",)# thenassert item_without_private_metadata(- response["data"]["deletePrivateMetadata"]["item"], page, page_id,+ response["data"]["deletePrivateMetadata"]["item"],+ page,+ page_id,)@@ -2515,7 +2640,10 @@ def test_delete_private_metadata_for_shipping_zone(# whenresponse = execute_clear_private_metadata_for_item(- staff_api_client, permission_manage_shipping, shipping_zone_id, "ShippingZone",+ staff_api_client,+ permission_manage_shipping,+ shipping_zone_id,+ "ShippingZone",)# then@@ -2536,12 +2664,17 @@ def test_delete_private_metadata_for_menu(# whenresponse = execute_clear_private_metadata_for_item(- staff_api_client, permission_manage_menus, menu_id, "Menu",+ staff_api_client,+ permission_manage_menus,+ menu_id,+ "Menu",)# thenassert item_without_private_metadata(- response["data"]["deletePrivateMetadata"]["item"], menu, menu_id,+ response["data"]["deletePrivateMetadata"]["item"],+ menu,+ menu_id,)@@ -2555,12 +2688,17 @@ def test_delete_private_metadata_for_menu_item(# whenresponse = execute_clear_private_metadata_for_item(- staff_api_client, permission_manage_menus, menu_item_id, "MenuItem",+ staff_api_client,+ permission_manage_menus,+ menu_item_id,+ "MenuItem",)# thenassert item_without_private_metadata(- response["data"]["deletePrivateMetadata"]["item"], menu_item, menu_item_id,+ response["data"]["deletePrivateMetadata"]["item"],+ menu_item,+ menu_item_id,)diff --git a/saleor/graphql/order/mutations/fulfillments.py b/saleor/graphql/order/mutations/fulfillments.pyindex 2b8483b070..f4b085014c 100644--- a/saleor/graphql/order/mutations/fulfillments.py+++ b/saleor/graphql/order/mutations/fulfillments.py@@ -6,7 +6,8 @@ from django.template.defaultfilters import pluralizefrom ....core.exceptions import InsufficientStockfrom ....core.permissions import OrderPermissions-from ....order import FulfillmentStatus, models as order_models+from ....order import FulfillmentStatus+from ....order import models as order_modelsfrom ....order.actions import (cancel_fulfillment,create_fulfillments,@@ -321,7 +322,8 @@ class OrderRefundLineInput(graphene.InputObjectType):required=True,)quantity = graphene.Int(- description="The number of items to be refunded.", required=True,+ description="The number of items to be refunded.",+ required=True,)@@ -332,7 +334,8 @@ class OrderRefundFulfillmentLineInput(graphene.InputObjectType):required=True,)quantity = graphene.Int(- description="The number of items to be refunded.", required=True,+ description="The number of items to be refunded.",+ required=True,)@@ -441,7 +444,9 @@ class FulfillmentRefundProducts(BaseMutation):raise ValidationError({field_name: ValidationError(- msg, code=code, params={field_name: line_global_id},+ msg,+ code=code,+ params={field_name: line_global_id},)})diff --git a/saleor/graphql/order/mutations/orders.py b/saleor/graphql/order/mutations/orders.pyindex 550e97923b..45ea347bde 100644--- a/saleor/graphql/order/mutations/orders.py+++ b/saleor/graphql/order/mutations/orders.py@@ -315,7 +315,8 @@ class OrderAddNote(BaseMutation):raise ValidationError({"message": ValidationError(- "Message can't be empty.", code=OrderErrorCode.REQUIRED,+ "Message can't be empty.",+ code=OrderErrorCode.REQUIRED,)})@@ -326,7 +327,9 @@ class OrderAddNote(BaseMutation):order = cls.get_node_or_error(info, data.get("id"), only_type=Order)cleaned_input = cls.clean_input(info, order, data)event = events.order_note_added_event(- order=order, user=info.context.user, message=cleaned_input["message"],+ order=order,+ user=info.context.user,+ message=cleaned_input["message"],)return OrderAddNote(order=order, event=event)diff --git a/saleor/graphql/order/tests/test_bulk_delete.py b/saleor/graphql/order/tests/test_bulk_delete.pyindex a96345b06c..f83f448a5f 100644--- a/saleor/graphql/order/tests/test_bulk_delete.py+++ b/saleor/graphql/order/tests/test_bulk_delete.py@@ -1,6 +1,7 @@import graphene-from ....order import OrderStatus, models as order_models+from ....order import OrderStatus+from ....order import models as order_modelsfrom ...tests.utils import get_graphql_contentMUTATION_DELETE_ORDER_LINES = """diff --git a/saleor/graphql/order/tests/test_fulfillment.py b/saleor/graphql/order/tests/test_fulfillment.pyindex f9d38b3eee..28777a7e17 100644--- a/saleor/graphql/order/tests/test_fulfillment.py+++ b/saleor/graphql/order/tests/test_fulfillment.py@@ -755,7 +755,10 @@ query fulfillment($id: ID!){def test_fulfillment_query(- staff_api_client, fulfilled_order, warehouse, permission_manage_orders,+ staff_api_client,+ fulfilled_order,+ warehouse,+ permission_manage_orders,):order = fulfilled_orderorder_line_1, order_line_2 = order.lines.all()diff --git a/saleor/graphql/order/tests/test_homepage.py b/saleor/graphql/order/tests/test_homepage.pyindex 42899f338b..6b7a8a1758 100644--- a/saleor/graphql/order/tests/test_homepage.py+++ b/saleor/graphql/order/tests/test_homepage.py@@ -150,7 +150,10 @@ def test_orders_total_as_app(def test_orders_total_as_customer(- user_api_client, order_with_lines, order_with_lines_channel_PLN, channel_USD,+ user_api_client,+ order_with_lines,+ order_with_lines_channel_PLN,+ channel_USD,):# givenvariables = {"period": ReportingPeriod.TODAY.name, "channel": channel_USD.slug}@@ -163,7 +166,10 @@ def test_orders_total_as_customer(def test_orders_total_as_anonymous(- api_client, order_with_lines, order_with_lines_channel_PLN, channel_USD,+ api_client,+ order_with_lines,+ order_with_lines_channel_PLN,+ channel_USD,):# givenvariables = {"period": ReportingPeriod.TODAY.name, "channel": channel_USD.slug}@@ -285,7 +291,10 @@ def test_orders_total_count_as_app(def test_orders_total_count_as_customer(- user_api_client, order_with_lines, order_with_lines_channel_PLN, channel_USD,+ user_api_client,+ order_with_lines,+ order_with_lines_channel_PLN,+ channel_USD,):# givenvariables = {"created": ReportingPeriod.TODAY.name, "channel": channel_USD.slug}@@ -298,7 +307,10 @@ def test_orders_total_count_as_customer(def test_orders_total_count_as_anonymous(- api_client, order_with_lines, order_with_lines_channel_PLN, channel_USD,+ api_client,+ order_with_lines,+ order_with_lines_channel_PLN,+ channel_USD,):# givenvariables = {"created": ReportingPeriod.TODAY.name, "channel": channel_USD.slug}diff --git a/saleor/graphql/order/tests/test_order.py b/saleor/graphql/order/tests/test_order.pyindex 42de451855..1292c8d928 100644--- a/saleor/graphql/order/tests/test_order.py+++ b/saleor/graphql/order/tests/test_order.py@@ -12,7 +12,8 @@ from prices import Money, TaxedMoneyfrom ....account.models import CustomerEventfrom ....core.taxes import TaxError, zero_taxed_money-from ....order import OrderStatus, events as order_events+from ....order import OrderStatus+from ....order import events as order_eventsfrom ....order.error_codes import OrderErrorCodefrom ....order.models import Order, OrderEventfrom ....payment import ChargeStatus, CustomPaymentChoices, PaymentError@@ -189,7 +190,9 @@ def test_orderline_query(staff_api_client, permission_manage_orders, fulfilled_odef test_order_line_with_allocations(- staff_api_client, permission_manage_orders, order_with_lines,+ staff_api_client,+ permission_manage_orders,+ order_with_lines,):# givenorder = order_with_lines@@ -2107,7 +2110,10 @@ DRAFT_ORDER_COMPLETE_MUTATION = """def test_draft_order_complete(- staff_api_client, permission_manage_orders, staff_user, draft_order,+ staff_api_client,+ permission_manage_orders,+ staff_user,+ draft_order,):order = draft_order@@ -2147,7 +2153,10 @@ def test_draft_order_complete(def test_draft_order_complete_with_inactive_channel(- staff_api_client, permission_manage_orders, staff_user, draft_order,+ staff_api_client,+ permission_manage_orders,+ staff_user,+ draft_order,):order = draft_orderchannel = order.channel@@ -2293,7 +2302,11 @@ def test_draft_order_complete_anonymous_user_no_email(def test_draft_order_complete_drops_shipping_address(- staff_api_client, permission_manage_orders, staff_user, draft_order, address,+ staff_api_client,+ permission_manage_orders,+ staff_user,+ draft_order,+ address,):order = draft_orderorder.shipping_address = address.get_copy()@@ -2923,7 +2936,13 @@ def test_order_add_note_as_staff_user(assert not CustomerEvent.objects.exists()[email protected]("message", ("", " ",))+ "message",+ (+ "",+ " ",+ ),+)def test_order_add_note_fail_on_empty_message(staff_api_client, permission_manage_orders, order_with_lines, message):@@ -4169,7 +4188,10 @@ def test_order_query_with_filter_channels_with_one_channel(def test_order_query_with_filter_channels_without_channel(- orders_query_with_filter, staff_api_client, permission_manage_orders, orders,+ orders_query_with_filter,+ staff_api_client,+ permission_manage_orders,+ orders,):# givenvariables = {"filter": {"channels": []}}diff --git a/saleor/graphql/order/tests/test_pagination.py b/saleor/graphql/order/tests/test_pagination.pyindex d6f442f783..7befd0ccb5 100644--- a/saleor/graphql/order/tests/test_pagination.py+++ b/saleor/graphql/order/tests/test_pagination.py@@ -530,7 +530,9 @@ def test_draft_orders_query_pagination_with_filter_search(def test_draft_orders_query_pagination_with_filter_search_by_id(- draft_order, staff_api_client, permission_manage_orders,+ draft_order,+ staff_api_client,+ permission_manage_orders,):page_size = 2variables = {diff --git a/saleor/graphql/order/types.py b/saleor/graphql/order/types.pyindex fcbc52b846..bd1770a6d3 100644--- a/saleor/graphql/order/types.py+++ b/saleor/graphql/order/types.py@@ -255,7 +255,10 @@ class OrderLine(CountableDjangoObjectType):unit_price = graphene.Field(TaxedMoney, description="Price of the single item in the order line.")- total_price = graphene.Field(TaxedMoney, description="Price of the order line.",)+ total_price = graphene.Field(+ TaxedMoney,+ description="Price of the order line.",+ )variant = graphene.Field(ProductVariant,required=False,diff --git a/saleor/graphql/page/tests/benchmark/test_page_type.py b/saleor/graphql/page/tests/benchmark/test_page_type.pyindex f28ed9f12a..1a8719260e 100644--- a/saleor/graphql/page/tests/benchmark/test_page_type.py+++ b/saleor/graphql/page/tests/benchmark/test_page_type.py@@ -124,7 +124,9 @@ def test_query_page_types(}"""response = staff_api_client.post_graphql(- query, {}, permissions=[permission_manage_products, permission_manage_pages],+ query,+ {},+ permissions=[permission_manage_products, permission_manage_pages],)content = get_graphql_content(response)data = content["data"]["pageTypes"]diff --git a/saleor/graphql/page/tests/test_page_types_sorting_and_filtering.py b/saleor/graphql/page/tests/test_page_types_sorting_and_filtering.pyindex 86df77b045..56d6410c22 100644--- a/saleor/graphql/page/tests/test_page_types_sorting_and_filtering.py+++ b/saleor/graphql/page/tests/test_page_types_sorting_and_filtering.py@@ -41,7 +41,8 @@ def test_filter_page_types(@pytest.mark.parametrize(- "direction, order_direction", (("ASC", "name"), ("DESC", "-name")),+ "direction, order_direction",+ (("ASC", "name"), ("DESC", "-name")),)def test_sort_page_types_by_name(direction, order_direction, staff_api_client, page_type_list@@ -63,7 +64,8 @@ def test_sort_page_types_by_name(@pytest.mark.parametrize(- "direction, order_direction", (("ASC", "slug"), ("DESC", "-slug")),+ "direction, order_direction",+ (("ASC", "slug"), ("DESC", "-slug")),)def test_sort_page_types_by_slug(direction, order_direction, staff_api_client, page_type_list@@ -85,7 +87,8 @@ def test_sort_page_types_by_slug(@pytest.mark.parametrize(- "direction, result_items", (("ASC", [1, 2]), ("DESC", [2, 1])),+ "direction, result_items",+ (("ASC", [1, 2]), ("DESC", [2, 1])),)def test_filter_and_sort_by_slug_page_types(direction, result_items, staff_api_client, page_type_listdiff --git a/saleor/graphql/payment/mutations.py b/saleor/graphql/payment/mutations.pyindex a798c4e15c..418998af4b 100644--- a/saleor/graphql/payment/mutations.py+++ b/saleor/graphql/payment/mutations.py@@ -263,7 +263,8 @@ class PaymentInitialize(BaseMutation):class Arguments:gateway = graphene.String(- description="A gateway name used to initialize the payment.", required=True,+ description="A gateway name used to initialize the payment.",+ required=True,)payment_data = graphene.JSONString(required=False,diff --git a/saleor/graphql/payment/resolvers.py b/saleor/graphql/payment/resolvers.pyindex 64998db9b8..4f435abb9d 100644--- a/saleor/graphql/payment/resolvers.py+++ b/saleor/graphql/payment/resolvers.py@@ -1,4 +1,5 @@-from ...payment import gateway as payment_gateway, models+from ...payment import gateway as payment_gateway+from ...payment import modelsfrom ...payment.utils import fetch_customer_idfrom ..utils.filters import filter_by_query_paramdiff --git a/saleor/graphql/product/bulk_mutations/products.py b/saleor/graphql/product/bulk_mutations/products.pyindex eeb665da19..83e094b228 100644--- a/saleor/graphql/product/bulk_mutations/products.py+++ b/saleor/graphql/product/bulk_mutations/products.py@@ -6,7 +6,8 @@ from django.db import transactionfrom graphene.types import InputObjectTypefrom ....core.permissions import ProductPermissions, ProductTypePermissions-from ....order import OrderStatus, models as order_models+from ....order import OrderStatus+from ....order import models as order_modelsfrom ....product import modelsfrom ....product.error_codes import ProductErrorCodefrom ....product.tasks import update_product_discounted_price_task@@ -622,7 +623,9 @@ class ProductVariantStocksDelete(BaseMutation):required=True,description="ID of product variant for which stocks will be deleted.",)- warehouse_ids = graphene.List(graphene.NonNull(graphene.ID),)+ warehouse_ids = graphene.List(+ graphene.NonNull(graphene.ID),+ )class Meta:description = "Delete stocks from product variant."diff --git a/saleor/graphql/product/filters.py b/saleor/graphql/product/filters.pyindex 32f0634c8a..dfbe3d6183 100644--- a/saleor/graphql/product/filters.py+++ b/saleor/graphql/product/filters.py@@ -73,7 +73,8 @@ def filter_products_by_attributes_values(qs, queries: T_PRODUCT_FILTER_QUERIES):| Q(Exists(AssignedVariantAttribute.objects.filter(- variant__product__id=OuterRef("pk"), values__pk__in=values,+ variant__product__id=OuterRef("pk"),+ values__pk__in=values,)))diff --git a/saleor/graphql/product/mutations/attributes.py b/saleor/graphql/product/mutations/attributes.pyindex c21162e7c6..063f754d89 100644--- a/saleor/graphql/product/mutations/attributes.py+++ b/saleor/graphql/product/mutations/attributes.py@@ -6,7 +6,8 @@ from django.core.exceptions import ObjectDoesNotExist, ValidationErrorfrom django.db import transactionfrom django.db.models import Q-from ....attribute import AttributeType, models as attribute_models+from ....attribute import AttributeType+from ....attribute import models as attribute_modelsfrom ....core.permissions import ProductTypePermissionsfrom ....product import modelsfrom ....product.error_codes import ProductErrorCodediff --git a/saleor/graphql/product/mutations/channels.py b/saleor/graphql/product/mutations/channels.pyindex c19cdc7039..aabdd98a7b 100644--- a/saleor/graphql/product/mutations/channels.py+++ b/saleor/graphql/product/mutations/channels.py@@ -28,12 +28,10 @@ from ...core.validators import validate_price_precisionfrom ..types.products import Collection, Product, ProductVariantif TYPE_CHECKING:- from ....product.models import (- Product as ProductModel,- Collection as CollectionModel,- ProductVariant as ProductVariantModel,- )from ....channel.models import Channel as ChannelModel+ from ....product.models import Collection as CollectionModel+ from ....product.models import Product as ProductModel+ from ....product.models import ProductVariant as ProductVariantModelErrorType = DefaultDict[str, List[ValidationError]]@@ -184,7 +182,10 @@ class ProductChannelListingUpdate(BaseChannelListingMutation):errors = defaultdict(list)cleaned_input = cls.clean_channels(- info, input, errors, ProductErrorCode.DUPLICATED_INPUT_ITEM.value,+ info,+ input,+ errors,+ ProductErrorCode.DUPLICATED_INPUT_ITEM.value,)cls.clean_publication_date(cleaned_input)cls.clean_available_for_purchase(cleaned_input, errors)@@ -326,7 +327,9 @@ class ProductVariantChannelListingUpdate(BaseMutation):"cost_price", None)ProductVariantChannelListing.objects.update_or_create(- variant=variant, channel=channel, defaults=defaults,+ variant=variant,+ channel=channel,+ defaults=defaults,)update_product_discounted_price_task.delay(variant.product_id)info.context.plugins.product_updated(variant.product)@@ -414,7 +417,10 @@ class CollectionChannelListingUpdate(BaseChannelListingMutation):errors = defaultdict(list)cleaned_input = cls.clean_channels(- info, input, errors, CollectionErrorCode.DUPLICATED_INPUT_ITEM.value,+ info,+ input,+ errors,+ CollectionErrorCode.DUPLICATED_INPUT_ITEM.value,)cls.clean_publication_date(cleaned_input)if errors:diff --git a/saleor/graphql/product/mutations/products.py b/saleor/graphql/product/mutations/products.pyindex 73dd1ebbeb..2f3642062f 100644--- a/saleor/graphql/product/mutations/products.py+++ b/saleor/graphql/product/mutations/products.py@@ -8,10 +8,12 @@ from django.db import transactionfrom django.utils.text import slugifyfrom graphene.types import InputObjectType-from ....attribute import AttributeInputType, AttributeType, models as attribute_models+from ....attribute import AttributeInputType, AttributeType+from ....attribute import models as attribute_modelsfrom ....core.exceptions import PermissionDeniedfrom ....core.permissions import ProductPermissions, ProductTypePermissions-from ....order import OrderStatus, models as order_models+from ....order import OrderStatus+from ....order import models as order_modelsfrom ....product import modelsfrom ....product.error_codes import CollectionErrorCode, ProductErrorCodefrom ....product.tasks import (@@ -1309,7 +1311,8 @@ class ProductVariantSetDefault(BaseMutation):description="Id of a product that will have the default variant set.",)variant_id = graphene.ID(- required=True, description="Id of a variant that will be set as default.",+ required=True,+ description="Id of a variant that will be set as default.",)class Meta:diff --git a/saleor/graphql/product/schema.py b/saleor/graphql/product/schema.pyindex 469cb517ae..2b7dc8f174 100644--- a/saleor/graphql/product/schema.py+++ b/saleor/graphql/product/schema.py@@ -144,7 +144,10 @@ class ProductQueries(graphene.ObjectType):)collection = graphene.Field(Collection,- id=graphene.Argument(graphene.ID, description="ID of the collection.",),+ id=graphene.Argument(+ graphene.ID,+ description="ID of the collection.",+ ),slug=graphene.Argument(graphene.String, description="Slug of the category"),channel=graphene.String(description="Slug of a channel for which the data should be returned."@@ -162,7 +165,10 @@ class ProductQueries(graphene.ObjectType):)product = graphene.Field(Product,- id=graphene.Argument(graphene.ID, description="ID of the product.",),+ id=graphene.Argument(+ graphene.ID,+ description="ID of the product.",+ ),slug=graphene.Argument(graphene.String, description="Slug of the product."),channel=graphene.String(description="Slug of a channel for which the data should be returned."@@ -202,7 +208,10 @@ class ProductQueries(graphene.ObjectType):)product_variant = graphene.Field(ProductVariant,- id=graphene.Argument(graphene.ID, description="ID of the product variant.",),+ id=graphene.Argument(+ graphene.ID,+ description="ID of the product variant.",+ ),sku=graphene.Argument(graphene.String, description="Sku of the product variant."),@@ -321,7 +330,11 @@ class ProductQueries(graphene.ObjectType):return resolve_product_types(info, **kwargs)def resolve_product_variant(- self, info, id=None, sku=None, channel=None,+ self,+ info,+ id=None,+ sku=None,+ channel=None,):validate_one_of_args_is_in_query("id", id, "sku", sku)requestor = get_user_or_app_from_context(info.context)diff --git a/saleor/graphql/product/tests/benchmark/test_homepage.py b/saleor/graphql/product/tests/benchmark/test_homepage.pyindex ae7ca1ec47..2a7fa4daab 100644--- a/saleor/graphql/product/tests/benchmark/test_homepage.py+++ b/saleor/graphql/product/tests/benchmark/test_homepage.py@@ -7,7 +7,10 @@ from ....tests.utils import get_graphql_content@pytest.mark.django_db@pytest.mark.count_queries(autouse=False)def test_retrieve_product_list(- api_client, category, categories_tree, count_queries,+ api_client,+ category,+ categories_tree,+ count_queries,):query = """query ProductsList {diff --git a/saleor/graphql/product/tests/benchmark/test_product.py b/saleor/graphql/product/tests/benchmark/test_product.pyindex 5ca16645ed..520ded6742 100644--- a/saleor/graphql/product/tests/benchmark/test_product.py+++ b/saleor/graphql/product/tests/benchmark/test_product.py@@ -271,7 +271,10 @@ def test_retrieve_channel_listings(@pytest.mark.django_db@pytest.mark.count_queries(autouse=False)def test_retrive_products_with_product_types_and_attributes(- product_list, api_client, count_queries, channel_USD,+ product_list,+ api_client,+ count_queries,+ channel_USD,):query = """query($channel: String) {diff --git a/saleor/graphql/product/tests/benchmark/test_variant_stocks.py b/saleor/graphql/product/tests/benchmark/test_variant_stocks.pyindex 358eb76cd2..9003b98215 100644--- a/saleor/graphql/product/tests/benchmark/test_variant_stocks.py+++ b/saleor/graphql/product/tests/benchmark/test_variant_stocks.py@@ -52,7 +52,9 @@ def test_product_variants_stocks_create(]variables = {"variantId": variant_id, "stocks": stocks}response = staff_api_client.post_graphql(- query, variables, permissions=[permission_manage_products],+ query,+ variables,+ permissions=[permission_manage_products],)content = get_graphql_content(response)data = content["data"]["productVariantStocksCreate"]@@ -113,7 +115,9 @@ def test_product_variants_stocks_update(]variables = {"variantId": variant_id, "stocks": stocks}response = staff_api_client.post_graphql(- query, variables, permissions=[permission_manage_products],+ query,+ variables,+ permissions=[permission_manage_products],)content = get_graphql_content(response)data = content["data"]["productVariantStocksUpdate"]@@ -169,7 +173,9 @@ def test_product_variants_stocks_delete(variables = {"variantId": variant_id, "warehouseIds": warehouse_ids}response = staff_api_client.post_graphql(- query, variables, permissions=[permission_manage_products],+ query,+ variables,+ permissions=[permission_manage_products],)content = get_graphql_content(response)data = content["data"]["productVariantStocksDelete"]diff --git a/saleor/graphql/product/tests/test_collection.py b/saleor/graphql/product/tests/test_collection.pyindex adaa660868..b9d46b39f8 100644--- a/saleor/graphql/product/tests/test_collection.py+++ b/saleor/graphql/product/tests/test_collection.py@@ -108,7 +108,9 @@ def test_collection_query_unpublished_collection_by_slug_and_anonymous_user(def test_collection_query_error_when_id_and_slug_provided(- user_api_client, collection, graphql_log_handler,+ user_api_client,+ collection,+ graphql_log_handler,):variables = {"id": graphene.Node.to_global_id("Collection", collection.pk),@@ -123,7 +125,9 @@ def test_collection_query_error_when_id_and_slug_provided(def test_collection_query_error_when_no_param(- user_api_client, collection, graphql_log_handler,+ user_api_client,+ collection,+ graphql_log_handler,):variables = {}response = user_api_client.post_graphql(QUERY_COLLECTION, variables=variables)diff --git a/saleor/graphql/product/tests/test_collection_filtering_and_sorting_with_channels.py b/saleor/graphql/product/tests/test_collection_filtering_and_sorting_with_channels.pyindex a7255f0068..c251b5e772 100644--- a/saleor/graphql/product/tests/test_collection_filtering_and_sorting_with_channels.py+++ b/saleor/graphql/product/tests/test_collection_filtering_and_sorting_with_channels.py@@ -98,7 +98,9 @@ QUERY_COLLECTIONS_WITH_SORTING_AND_FILTERING = """],)def test_collections_with_sorting_and_without_channel(- sort_by, staff_api_client, permission_manage_products,+ sort_by,+ staff_api_client,+ permission_manage_products,):# givenvariables = {"sortBy": sort_by}@@ -371,7 +373,8 @@ def test_collections_with_filtering_with_channel_PLN(@pytest.mark.parametrize(- "filter_by", [{"published": "PUBLISHED"}, {"published": "HIDDEN"}],+ "filter_by",+ [{"published": "PUBLISHED"}, {"published": "HIDDEN"}],)def test_collections_with_filtering_and_not_existing_channel(filter_by,diff --git a/saleor/graphql/product/tests/test_product.py b/saleor/graphql/product/tests/test_product.pyindex 7a809b0c2d..459e981c12 100644--- a/saleor/graphql/product/tests/test_product.py+++ b/saleor/graphql/product/tests/test_product.py@@ -339,7 +339,10 @@ QUERY_COLLECTION_FROM_PRODUCT = """def test_get_collections_from_product_as_staff(- staff_api_client, permission_manage_products, product_with_collections, channel_USD,+ staff_api_client,+ permission_manage_products,+ product_with_collections,+ channel_USD,):# givenproduct = product_with_collections@@ -362,7 +365,10 @@ def test_get_collections_from_product_as_staff(def test_get_collections_from_product_as_app(- app_api_client, permission_manage_products, product_with_collections, channel_USD,+ app_api_client,+ permission_manage_products,+ product_with_collections,+ channel_USD,):# givenproduct = product_with_collections@@ -941,7 +947,9 @@ def test_product_query_by_id_without_channel_not_available_as_staff_user(def test_product_query_error_when_id_and_slug_provided(- user_api_client, product, graphql_log_handler,+ user_api_client,+ product,+ graphql_log_handler,):variables = {"id": graphene.Node.to_global_id("Product", product.pk),@@ -956,7 +964,9 @@ def test_product_query_error_when_id_and_slug_provided(def test_product_query_error_when_no_param(- user_api_client, product, graphql_log_handler,+ user_api_client,+ product,+ graphql_log_handler,):variables = {}response = user_api_client.post_graphql(QUERY_PRODUCT, variables=variables)@@ -1139,7 +1149,10 @@ def test_fetch_all_products_not_available_as_customer(is_published=False)- response = user_api_client.post_graphql(QUERY_FETCH_ALL_PRODUCTS, variables,)+ response = user_api_client.post_graphql(+ QUERY_FETCH_ALL_PRODUCTS,+ variables,+ )content = get_graphql_content(response)assert content["data"]["products"]["totalCount"] == 0assert not content["data"]["products"]["edges"]@@ -1174,7 +1187,10 @@ def test_fetch_all_products_not_available_as_anonymous(is_published=False)- response = api_client.post_graphql(QUERY_FETCH_ALL_PRODUCTS, variables,)+ response = api_client.post_graphql(+ QUERY_FETCH_ALL_PRODUCTS,+ variables,+ )content = get_graphql_content(response)assert content["data"]["products"]["totalCount"] == 0assert not content["data"]["products"]["edges"]@@ -1564,7 +1580,10 @@ def test_products_query_with_filter_collection(def test_products_query_with_filter_category_and_search(- query_products_with_filter, staff_api_client, product, permission_manage_products,+ query_products_with_filter,+ staff_api_client,+ product,+ permission_manage_products,):category = Category.objects.create(name="Custom", slug="custom")second_product = product@@ -1641,7 +1660,8 @@ def test_products_query_with_filter(second_product.slug = "apple-juice1"second_product.save()variant_second_product = second_product.variants.create(- product=second_product, sku=second_product.slug,+ product=second_product,+ sku=second_product.slug,)ProductVariantChannelListing.objects.create(variant=variant_second_product,@@ -1651,7 +1671,9 @@ def test_products_query_with_filter(currency=channel_USD.currency_code,)ProductChannelListing.objects.create(- product=second_product, channel=channel_USD, is_published=True,+ product=second_product,+ channel=channel_USD,+ is_published=True,)variables = {"filter": {"search": "Juice1"}, "channel": channel_USD.slug}staff_api_client.user.user_permissions.add(permission_manage_products)@@ -2225,7 +2247,11 @@ def test_create_product(@freeze_time("2020-03-18 12:00:00")def test_create_product_with_rating(- staff_api_client, product_type, category, permission_manage_products, settings,+ staff_api_client,+ product_type,+ category,+ permission_manage_products,+ settings,):query = CREATE_PRODUCT_MUTATION@@ -2493,7 +2519,10 @@ def test_create_product_with_file_attribute_required_no_file_url_given(def test_create_product_no_values_given(- staff_api_client, product_type, category, permission_manage_products,+ staff_api_client,+ product_type,+ category,+ permission_manage_products,):query = CREATE_PRODUCT_MUTATION@@ -2651,7 +2680,9 @@ def test_product_variant_set_default_not_products_variant(def test_reorder_variants(- staff_api_client, product_with_two_variants, permission_manage_products,+ staff_api_client,+ product_with_two_variants,+ permission_manage_products,):default_variants = product_with_two_variants.variants.all()new_variants = [default_variants[1], default_variants[0]]@@ -2679,7 +2710,10 @@ def test_reorder_variants(def test_reorder_variants_invalid_variants(- staff_api_client, product, product_with_two_variants, permission_manage_products,+ staff_api_client,+ product,+ product_with_two_variants,+ permission_manage_products,):default_variants = product_with_two_variants.variants.all()new_variants = [product.variants.first(), default_variants[1]]@@ -3349,7 +3383,9 @@ def test_update_product_with_file_attribute_value_new_value_is_not_created(@freeze_time("2020-03-18 12:00:00")def test_update_product_rating(- staff_api_client, product, permission_manage_products,+ staff_api_client,+ product,+ permission_manage_products,):query = MUTATION_UPDATE_PRODUCT@@ -4616,7 +4652,9 @@ def test_update_product_type_slug_and_name(def test_update_product_type_with_negative_weight(- staff_api_client, product_type, permission_manage_product_types_and_attributes,+ staff_api_client,+ product_type,+ permission_manage_product_types_and_attributes,):query = """mutation($id: ID!, $weight: WeightScalar) {@@ -5190,7 +5228,8 @@ def test_product_variants_no_ids_list(user_api_client, variant, channel_USD):@pytest.mark.parametrize(- "variant_price_amount, api_variant_price", [(200, 200), (0, 0)],+ "variant_price_amount, api_variant_price",+ [(200, 200), (0, 0)],)def test_product_variant_price(variant_price_amount,@@ -5352,7 +5391,8 @@ def test_product_restricted_fields_permissions(@pytest.mark.parametrize(- "field, is_nested", (("digitalContent", True), ("quantityOrdered", False)),+ "field, is_nested",+ (("digitalContent", True), ("quantityOrdered", False)),)def test_variant_restricted_fields_permissions(staff_api_client,@@ -5620,7 +5660,10 @@ def test_categories_query_with_sort(name="Cat1", slug="slug_category1", description="Description cat1")Product.objects.create(- name="Test", slug="test", product_type=product_type, category=cat1,+ name="Test",+ slug="test",+ product_type=product_type,+ category=cat1,)Category.objects.create(name="Cat2", slug="slug_category2", description="Description cat2"@@ -5638,7 +5681,10 @@ def test_categories_query_with_sort(description="Subcategory_description of cat1",)Product.objects.create(- name="Test2", slug="test2", product_type=product_type, category=subsubcat,+ name="Test2",+ slug="test2",+ product_type=product_type,+ category=subsubcat,)variables = {"sort_by": category_sort}staff_api_client.user.user_permissions.add(permission_manage_products)@@ -6110,7 +6156,9 @@ def test_create_stocks(variant, warehouse):def test_update_or_create_variant_stocks(variant, warehouses):Stock.objects.create(- product_variant=variant, warehouse=warehouses[0], quantity=5,+ product_variant=variant,+ warehouse=warehouses[0],+ quantity=5,)stocks_data = [{"quantity": 10, "warehouse": "123"},@@ -6133,7 +6181,9 @@ def test_update_or_create_variant_stocks(variant, warehouses):def test_update_or_create_variant_stocks_empty_stocks_data(variant, warehouses):Stock.objects.create(- product_variant=variant, warehouse=warehouses[0], quantity=5,+ product_variant=variant,+ warehouse=warehouses[0],+ quantity=5,)ProductVariantStocksUpdate.update_or_create_variant_stocks(variant, [], warehouses)@@ -6285,7 +6335,9 @@ def test_create_product_with_weight_input("name": "Test",}response = staff_api_client.post_graphql(- query, variables, permissions=[permission_manage_products],+ query,+ variables,+ permissions=[permission_manage_products],)content = get_graphql_content(response)result_weight = content["data"]["productCreate"]["product"]["weight"]diff --git a/saleor/graphql/product/tests/test_product_filtering_and_sorting_with_channels.py b/saleor/graphql/product/tests/test_product_filtering_and_sorting_with_channels.pyindex 88f5f1d4b2..d1eb0d2eab 100644--- a/saleor/graphql/product/tests/test_product_filtering_and_sorting_with_channels.py+++ b/saleor/graphql/product/tests/test_product_filtering_and_sorting_with_channels.py@@ -228,7 +228,9 @@ QUERY_PRODUCTS_WITH_SORTING_AND_FILTERING = """],)def test_products_with_sorting_and_without_channel(- sort_by, staff_api_client, permission_manage_products,+ sort_by,+ staff_api_client,+ permission_manage_products,):# givenvariables = {"sortBy": sort_by}diff --git a/saleor/graphql/product/tests/test_product_pagination.py b/saleor/graphql/product/tests/test_product_pagination.pyindex 07e6cc397d..81d79e2f03 100644--- a/saleor/graphql/product/tests/test_product_pagination.py+++ b/saleor/graphql/product/tests/test_product_pagination.py@@ -109,12 +109,18 @@ QUERY_CATEGORIES_PAGINATION = """],)def test_categories_pagination_with_sorting(- sort_by, categories_order, staff_api_client, categories_for_pagination,+ sort_by,+ categories_order,+ staff_api_client,+ categories_for_pagination,):page_size = 3variables = {"first": page_size, "after": None, "sortBy": sort_by}- response = staff_api_client.post_graphql(QUERY_CATEGORIES_PAGINATION, variables,)+ response = staff_api_client.post_graphql(+ QUERY_CATEGORIES_PAGINATION,+ variables,+ )content = get_graphql_content(response)categories_nodes = content["data"]["categories"]["edges"]assert categories_order[0] == categories_nodes[0]["node"]["name"]@@ -132,12 +138,18 @@ def test_categories_pagination_with_sorting(],)def test_categories_pagination_with_filtering(- filter_by, categories_order, staff_api_client, categories_for_pagination,+ filter_by,+ categories_order,+ staff_api_client,+ categories_for_pagination,):page_size = 2variables = {"first": page_size, "after": None, "filter": filter_by}- response = staff_api_client.post_graphql(QUERY_CATEGORIES_PAGINATION, variables,)+ response = staff_api_client.post_graphql(+ QUERY_CATEGORIES_PAGINATION,+ variables,+ )content = get_graphql_content(response)categories_nodes = content["data"]["categories"]["edges"]assert categories_order[0] == categories_nodes[0]["node"]["name"]@@ -891,7 +903,10 @@ QUERY_PRODUCT_TYPES_PAGINATION = """],)def test_product_types_pagination_with_sorting(- sort_by, product_types_order, staff_api_client, product_types_for_pagination,+ sort_by,+ product_types_order,+ staff_api_client,+ product_types_for_pagination,):page_size = 3@@ -914,19 +929,28 @@ def test_product_types_pagination_with_sorting(),({"search": "ProductType1"}, ["ProductType1", "ProductTypeProductType1"]),({"search": "pt_pt"}, ["ProductTypeProductType1", "ProductTypeProductType2"]),- ({"productType": "DIGITAL"}, ["ProductType1", "ProductType3"],),+ (+ {"productType": "DIGITAL"},+ ["ProductType1", "ProductType3"],+ ),({"productType": "SHIPPABLE"}, ["ProductType2", "ProductTypeProductType2"]),({"configurable": "CONFIGURABLE"}, ["ProductType1", "ProductTypeProductType1"]),({"configurable": "SIMPLE"}, ["ProductType2", "ProductType3"]),],)def test_product_types_pagination_with_filtering(- filter_by, product_types_order, staff_api_client, product_types_for_pagination,+ filter_by,+ product_types_order,+ staff_api_client,+ product_types_for_pagination,):page_size = 2variables = {"first": page_size, "after": None, "filter": filter_by}- response = staff_api_client.post_graphql(QUERY_PRODUCT_TYPES_PAGINATION, variables,)+ response = staff_api_client.post_graphql(+ QUERY_PRODUCT_TYPES_PAGINATION,+ variables,+ )content = get_graphql_content(response)product_types_nodes = content["data"]["productTypes"]["edges"]assert product_types_order[0] == product_types_nodes[0]["node"]["name"]diff --git a/saleor/graphql/product/tests/test_product_sorting.py b/saleor/graphql/product/tests/test_product_sorting.pyindex 4ac82fc87c..7a1ab330be 100644--- a/saleor/graphql/product/tests/test_product_sorting.py+++ b/saleor/graphql/product/tests/test_product_sorting.py@@ -187,7 +187,8 @@ def test_sort_products_by_publication_date(@pytest.mark.parametrize(- "direction, order_direction", (("ASC", "rating"), ("DESC", "-rating")),+ "direction, order_direction",+ (("ASC", "rating"), ("DESC", "-rating")),)def test_sort_products_by_rating(direction, order_direction, api_client, product_list, channel_USDdiff --git a/saleor/graphql/product/tests/test_product_sorting_attributes.py b/saleor/graphql/product/tests/test_product_sorting_attributes.pyindex a0c34205b7..926886ddeb 100644--- a/saleor/graphql/product/tests/test_product_sorting_attributes.py+++ b/saleor/graphql/product/tests/test_product_sorting_attributes.py@@ -4,7 +4,8 @@ from decimal import Decimalimport grapheneimport pytest-from ....attribute import AttributeType, models as attribute_models+from ....attribute import AttributeType+from ....attribute import models as attribute_modelsfrom ....attribute.utils import associate_attribute_values_to_instancefrom ....product import models as product_modelsfrom ...tests.utils import get_graphql_content@@ -168,7 +169,10 @@ def products_structures(category, channel_USD):category=category,)product_models.ProductChannelListing.objects.create(- product=dummy, channel=channel_USD, is_published=True, visible_in_listings=True,+ product=dummy,+ channel=channel_USD,+ is_published=True,+ visible_in_listings=True,)variant = product_models.ProductVariant.objects.create(product=dummy, sku=dummy.slugdiff --git a/saleor/graphql/product/tests/test_variant.py b/saleor/graphql/product/tests/test_variant.pyindex 3b899092e6..72c0381c33 100644--- a/saleor/graphql/product/tests/test_variant.py+++ b/saleor/graphql/product/tests/test_variant.py@@ -21,7 +21,11 @@ from ...tests.utils import assert_no_permission, get_graphql_contentdef test_fetch_variant(- staff_api_client, product, permission_manage_products, site_settings, channel_USD,+ staff_api_client,+ product,+ permission_manage_products,+ site_settings,+ channel_USD,):query = """query ProductVariantDetails($id: ID!, $countyCode: CountryCode, $channel: String) {@@ -208,7 +212,9 @@ def test_get_product_variant_channel_listing_as_app(def test_get_product_variant_channel_listing_as_customer(- user_api_client, product_available_in_many_channels, channel_USD,+ user_api_client,+ product_available_in_many_channels,+ channel_USD,):# givenvariant = product_available_in_many_channels.variants.get()@@ -217,7 +223,8 @@ def test_get_product_variant_channel_listing_as_customer(# whenresponse = user_api_client.post_graphql(- QUERY_PRODUCT_VARIANT_CHANNEL_LISTING, variables,+ QUERY_PRODUCT_VARIANT_CHANNEL_LISTING,+ variables,)# then@@ -225,7 +232,9 @@ def test_get_product_variant_channel_listing_as_customer(def test_get_product_variant_channel_listing_as_anonymous(- api_client, product_available_in_many_channels, channel_USD,+ api_client,+ product_available_in_many_channels,+ channel_USD,):# givenvariant = product_available_in_many_channels.variants.get()@@ -234,7 +243,8 @@ def test_get_product_variant_channel_listing_as_anonymous(# whenresponse = api_client.post_graphql(- QUERY_PRODUCT_VARIANT_CHANNEL_LISTING, variables,+ QUERY_PRODUCT_VARIANT_CHANNEL_LISTING,+ variables,)# then@@ -1379,7 +1389,11 @@ def test_delete_variant(staff_api_client, product, permission_manage_products):def test_delete_variant_in_draft_order(- staff_api_client, order_line, permission_manage_products, order_list, channel_USD,+ staff_api_client,+ order_line,+ permission_manage_products,+ order_list,+ channel_USD,):query = DELETE_VARIANT_MUTATION@@ -1722,7 +1736,9 @@ def test_fetch_unpublished_variant_staff_user():variant = unavailable_product_with_variant.variants.first()data = _fetch_variant(- staff_api_client, variant, permissions=[permission_manage_products],+ staff_api_client,+ variant,+ permissions=[permission_manage_products],)variant_id = graphene.Node.to_global_id("ProductVariant", variant.pk)diff --git a/saleor/graphql/product/tests/test_variant_channel_listing_update.py b/saleor/graphql/product/tests/test_variant_channel_listing_update.pyindex 588f0122c1..689d128dcd 100644--- a/saleor/graphql/product/tests/test_variant_channel_listing_update.py+++ b/saleor/graphql/product/tests/test_variant_channel_listing_update.py@@ -190,7 +190,9 @@ def test_variant_channel_listing_update_as_staff_user():# givenProductChannelListing.objects.create(- product=product, channel=channel_PLN, is_published=True,+ product=product,+ channel=channel_PLN,+ is_published=True,)variant = product.variants.get()variant_id = graphene.Node.to_global_id("ProductVariant", variant.id)@@ -244,7 +246,9 @@ def test_variant_channel_listing_update_trigger_webhook_product_updated():# givenProductChannelListing.objects.create(- product=product, channel=channel_PLN, is_published=True,+ product=product,+ channel=channel_PLN,+ is_published=True,)variant = product.variants.get()variant_id = graphene.Node.to_global_id("ProductVariant", variant.id)@@ -281,7 +285,9 @@ def test_variant_channel_listing_update_as_app():# givenProductChannelListing.objects.create(- product=product, channel=channel_PLN, is_published=True,+ product=product,+ channel=channel_PLN,+ is_published=True,)variant = product.variants.get()variant_id = graphene.Node.to_global_id("ProductVariant", variant.id)@@ -321,7 +327,9 @@ def test_variant_channel_listing_update_as_customer():# givenProductChannelListing.objects.create(- product=product, channel=channel_PLN, is_published=True,+ product=product,+ channel=channel_PLN,+ is_published=True,)variant = product.variants.get()variant_id = graphene.Node.to_global_id("ProductVariant", variant.id)@@ -337,7 +345,8 @@ def test_variant_channel_listing_update_as_customer(# whenresponse = user_api_client.post_graphql(- PRODUCT_VARIANT_CHANNEL_LISTING_UPDATE_MUTATION, variables=variables,+ PRODUCT_VARIANT_CHANNEL_LISTING_UPDATE_MUTATION,+ variables=variables,)# then@@ -349,7 +358,9 @@ def test_variant_channel_listing_update_as_anonymous():# givenProductChannelListing.objects.create(- product=product, channel=channel_PLN, is_published=True,+ product=product,+ channel=channel_PLN,+ is_published=True,)variant = product.variants.get()variant_id = graphene.Node.to_global_id("ProductVariant", variant.id)@@ -365,7 +376,8 @@ def test_variant_channel_listing_update_as_anonymous(# whenresponse = api_client.post_graphql(- PRODUCT_VARIANT_CHANNEL_LISTING_UPDATE_MUTATION, variables=variables,+ PRODUCT_VARIANT_CHANNEL_LISTING_UPDATE_MUTATION,+ variables=variables,)# then@@ -402,7 +414,10 @@ def test_product_variant_channel_listing_update_updates_discounted_price(def test_product_variant_channel_listing_update_remove_cost_price(- staff_api_client, product, permission_manage_products, channel_USD,+ staff_api_client,+ product,+ permission_manage_products,+ channel_USD,):# givenquery = PRODUCT_VARIANT_CHANNEL_LISTING_UPDATE_MUTATIONdiff --git a/saleor/graphql/product/tests/test_variant_query.py b/saleor/graphql/product/tests/test_variant_query.pyindex 6d33b9927e..fe3013ea1e 100644--- a/saleor/graphql/product/tests/test_variant_query.py+++ b/saleor/graphql/product/tests/test_variant_query.py@@ -109,7 +109,9 @@ def test_get_unpublished_variant_by_id_as_customer(# whenresponse = user_api_client.post_graphql(- VARIANT_QUERY, variables, check_no_permissions=False,+ VARIANT_QUERY,+ variables,+ check_no_permissions=False,)# then@@ -127,7 +129,9 @@ def test_get_unpublished_variant_by_id_as_anonymous_user(# whenresponse = api_client.post_graphql(- VARIANT_QUERY, variables, check_no_permissions=False,+ VARIANT_QUERY,+ variables,+ check_no_permissions=False,)# then@@ -182,7 +186,9 @@ def test_get_variant_by_id_as_customer(user_api_client, variant, channel_USD):# whenresponse = user_api_client.post_graphql(- VARIANT_QUERY, variables, check_no_permissions=False,+ VARIANT_QUERY,+ variables,+ check_no_permissions=False,)# then@@ -198,7 +204,9 @@ def test_get_variant_by_id_as_anonymous_user(api_client, variant, channel_USD):# whenresponse = api_client.post_graphql(- VARIANT_QUERY, variables, check_no_permissions=False,+ VARIANT_QUERY,+ variables,+ check_no_permissions=False,)# then@@ -258,7 +266,9 @@ def test_get_unpublished_variant_by_sku_as_customer(# whenresponse = user_api_client.post_graphql(- VARIANT_QUERY, variables, check_no_permissions=False,+ VARIANT_QUERY,+ variables,+ check_no_permissions=False,)# then@@ -275,7 +285,9 @@ def test_get_unpublished_variant_by_sku_as_anonymous_user(# whenresponse = api_client.post_graphql(- VARIANT_QUERY, variables, check_no_permissions=False,+ VARIANT_QUERY,+ variables,+ check_no_permissions=False,)# then@@ -327,7 +339,9 @@ def test_get_variant_by_sku_as_customer(user_api_client, variant, channel_USD):# whenresponse = user_api_client.post_graphql(- VARIANT_QUERY, variables, check_no_permissions=False,+ VARIANT_QUERY,+ variables,+ check_no_permissions=False,)# then@@ -342,7 +356,9 @@ def test_get_variant_by_sku_as_anonymous_user(api_client, variant, channel_USD):# whenresponse = api_client.post_graphql(- VARIANT_QUERY, variables, check_no_permissions=False,+ VARIANT_QUERY,+ variables,+ check_no_permissions=False,)# thendiff --git a/saleor/graphql/product/tests/test_variant_with_filtering.py b/saleor/graphql/product/tests/test_variant_with_filtering.pyindex c47643f958..d33accbccb 100644--- a/saleor/graphql/product/tests/test_variant_with_filtering.py+++ b/saleor/graphql/product/tests/test_variant_with_filtering.py@@ -55,12 +55,24 @@ def products_for_variant_filtering(product_type, category):)ProductVariant.objects.bulk_create([- ProductVariant(product=products[0], sku="P1-V1",),- ProductVariant(product=products[0], sku="P1-V2",),+ ProductVariant(+ product=products[0],+ sku="P1-V1",+ ),+ ProductVariant(+ product=products[0],+ sku="P1-V2",+ ),ProductVariant(product=products[1], sku="PP1-V1", name="XL"),ProductVariant(product=products[2], sku="PP2-V1", name="XXL"),- ProductVariant(product=products[3], sku="P2-V1",),- ProductVariant(product=products[4], sku="P3-V1",),+ ProductVariant(+ product=products[3],+ sku="P2-V1",+ ),+ ProductVariant(+ product=products[4],+ sku="P3-V1",+ ),])return productsdiff --git a/saleor/graphql/product/types/digital_contents.py b/saleor/graphql/product/types/digital_contents.pyindex c10a1ee9d1..f70c3cfc48 100644--- a/saleor/graphql/product/types/digital_contents.py+++ b/saleor/graphql/product/types/digital_contents.py@@ -25,7 +25,8 @@ class DigitalContentUrl(CountableDjangoObjectType):class DigitalContent(CountableDjangoObjectType):urls = graphene.List(- lambda: DigitalContentUrl, description="List of URLs for the digital variant.",+ lambda: DigitalContentUrl,+ description="List of URLs for the digital variant.",)class Meta:diff --git a/saleor/graphql/product/types/products.py b/saleor/graphql/product/types/products.pyindex 5bdd5a132b..35444d3f1e 100644--- a/saleor/graphql/product/types/products.py+++ b/saleor/graphql/product/types/products.py@@ -162,7 +162,8 @@ class ProductVariant(ChannelContextTypeWithMetadata, CountableDjangoObjectType):required=True,description="List of attributes assigned to this variant.",variant_selection=graphene.Argument(- VariantAttributeScope, description="Define scope of returned attributes.",+ VariantAttributeScope,+ description="Define scope of returned attributes.",),)cost_price = graphene.Field(Money, description="Cost price of the variant.")@@ -785,7 +786,8 @@ class ProductType(CountableDjangoObjectType):Attribute,description="Variant attributes of that product type.",variant_selection=graphene.Argument(- VariantAttributeScope, description="Define scope of returned attributes.",+ VariantAttributeScope,+ description="Define scope of returned attributes.",),)product_attributes = graphene.List(@@ -831,7 +833,9 @@ class ProductType(CountableDjangoObjectType):@staticmethoddef resolve_variant_attributes(- root: models.ProductType, info, variant_selection: Optional[str] = None,+ root: models.ProductType,+ info,+ variant_selection: Optional[str] = None,):def apply_variant_selection_filter(attributes):if not variant_selection or variant_selection == VariantAttributeScope.ALL:@@ -1021,7 +1025,9 @@ class Category(CountableDjangoObjectType):qs = (qs.published(channel).annotate_visible_in_listings(channel)- .exclude(visible_in_listings=False,)+ .exclude(+ visible_in_listings=False,+ ))if channel and requestor_has_access_to_all:qs = qs.filter(channel_listings__channel__slug=channel)diff --git a/saleor/graphql/product/utils.py b/saleor/graphql/product/utils.pyindex dadf5f67ee..03c55845ec 100644--- a/saleor/graphql/product/utils.py+++ b/saleor/graphql/product/utils.py@@ -10,6 +10,7 @@ from ...warehouse.models import Stockif TYPE_CHECKING:from django.db.models import QuerySet+from ...product.models import ProductVariantdiff --git a/saleor/graphql/shipping/mutations/channels.py b/saleor/graphql/shipping/mutations/channels.pyindex 7552161938..9b3102427d 100644--- a/saleor/graphql/shipping/mutations/channels.py+++ b/saleor/graphql/shipping/mutations/channels.py@@ -108,7 +108,9 @@ class ShippingMethodChannelListingUpdate(BaseChannelListingMutation):@classmethoddef get_shipping_method_channel_listing_to_create(- cls, shipping_method_id, input,+ cls,+ shipping_method_id,+ input,):channels = [data.get("channel") for data in input]channel_listings = ShippingMethodChannelListing.objects.filter(diff --git a/saleor/graphql/shipping/mutations/shippings.py b/saleor/graphql/shipping/mutations/shippings.pyindex f6fbefb2b6..4c61dd35a0 100644--- a/saleor/graphql/shipping/mutations/shippings.py+++ b/saleor/graphql/shipping/mutations/shippings.py@@ -57,13 +57,15 @@ class ShippingZoneCreateInput(graphene.InputObjectType):))add_warehouses = graphene.List(- graphene.ID, description="List of warehouses to assign to a shipping zone",+ graphene.ID,+ description="List of warehouses to assign to a shipping zone",)class ShippingZoneUpdateInput(ShippingZoneCreateInput):remove_warehouses = graphene.List(- graphene.ID, description="List of warehouses to unassign from a shipping zone",+ graphene.ID,+ description="List of warehouses to unassign from a shipping zone",)@@ -184,7 +186,8 @@ class ShippingZipCodeRulesCreateInput(graphene.InputObjectType):class ShippingZipCodeRulesCreate(BaseMutation):zip_code_rules = graphene.List(- ShippingMethodZipCodeRule, description="A shipping method zip code range.",+ ShippingMethodZipCodeRule,+ description="A shipping method zip code range.",)shipping_method = graphene.Field(ShippingMethod, description="Related shipping method."@@ -216,7 +219,9 @@ class ShippingZipCodeRulesCreate(BaseMutation):start = zip_range["start"]end = zip_range["end"]instance = models.ShippingMethodZipCodeRule.objects.create(- shipping_method=shipping_method, start=start, end=end,+ shipping_method=shipping_method,+ start=start,+ end=end,)except IntegrityError:raise ValidationError(@@ -302,11 +307,13 @@ class ShippingPriceMixin:if min_weight and min_weight.value < 0:errors["minimum_order_weight"] = ValidationError(- "Shipping can't have negative weight.", code=ShippingErrorCode.INVALID,+ "Shipping can't have negative weight.",+ code=ShippingErrorCode.INVALID,)if max_weight and max_weight.value < 0:errors["maximum_order_weight"] = ValidationError(- "Shipping can't have negative weight.", code=ShippingErrorCode.INVALID,+ "Shipping can't have negative weight.",+ code=ShippingErrorCode.INVALID,)if errors:diff --git a/saleor/graphql/shipping/tests/benchmark/test_shipping_methods.py b/saleor/graphql/shipping/tests/benchmark/test_shipping_methods.pyindex 3dca69c16a..635f5d5192 100644--- a/saleor/graphql/shipping/tests/benchmark/test_shipping_methods.py+++ b/saleor/graphql/shipping/tests/benchmark/test_shipping_methods.py@@ -70,7 +70,10 @@ def test_vouchers_query_with_channel_slug(@pytest.mark.django_db@pytest.mark.count_queries(autouse=False)def test_vouchers_query_without_channel_slug(- staff_api_client, shipping_zones, permission_manage_shipping, count_queries,+ staff_api_client,+ shipping_zones,+ permission_manage_shipping,+ count_queries,):get_graphql_content(staff_api_client.post_graphql(diff --git a/saleor/graphql/shipping/tests/test_shipping_method.py b/saleor/graphql/shipping/tests/test_shipping_method.pyindex 0c95585753..6ee13b9de8 100644--- a/saleor/graphql/shipping/tests/test_shipping_method.py+++ b/saleor/graphql/shipping/tests/test_shipping_method.py@@ -249,7 +249,8 @@ def test_shipping_methods_query("""shipping_zone.shipping_methods.add(shipping_method_channel_PLN)response = staff_api_client.post_graphql(- query, permissions=[permission_manage_shipping, permission_manage_products],+ query,+ permissions=[permission_manage_shipping, permission_manage_products],)content = get_graphql_content(response)assert (@@ -603,7 +604,10 @@ def test_update_shipping_zone_default_exists(def test_update_shipping_zone_add_warehouses(- staff_api_client, shipping_zone, warehouses, permission_manage_shipping,+ staff_api_client,+ shipping_zone,+ warehouses,+ permission_manage_shipping,):shipping_id = graphene.Node.to_global_id("ShippingZone", shipping_zone.pk)warehouse_ids = [@@ -657,7 +661,10 @@ def test_update_shipping_zone_add_second_warehouses(def test_update_shipping_zone_remove_warehouses(- staff_api_client, shipping_zone, warehouse, permission_manage_shipping,+ staff_api_client,+ shipping_zone,+ warehouse,+ permission_manage_shipping,):shipping_id = graphene.Node.to_global_id("ShippingZone", shipping_zone.pk)warehouse_id = graphene.Node.to_global_id("Warehouse", warehouse.pk)@@ -677,7 +684,10 @@ def test_update_shipping_zone_remove_warehouses(def test_update_shipping_zone_remove_one_warehouses(- staff_api_client, shipping_zone, warehouses, permission_manage_shipping,+ staff_api_client,+ shipping_zone,+ warehouses,+ permission_manage_shipping,):for warehouse in warehouses:warehouse.shipping_zones.add(shipping_zone)@@ -731,7 +741,10 @@ def test_update_shipping_zone_replace_warehouse(def test_update_shipping_zone_same_warehouse_id_in_add_and_remove(- staff_api_client, shipping_zone, warehouse, permission_manage_shipping,+ staff_api_client,+ shipping_zone,+ warehouse,+ permission_manage_shipping,):shipping_id = graphene.Node.to_global_id("ShippingZone", shipping_zone.pk)warehouse_id = graphene.Node.to_global_id("Warehouse", warehouse.pk)@@ -865,7 +878,9 @@ def test_create_shipping_method(def test_create_shipping_method_minimum_delivery_days_higher_than_maximum(- staff_api_client, shipping_zone, permission_manage_shipping,+ staff_api_client,+ shipping_zone,+ permission_manage_shipping,):name = "DHL"shipping_zone_id = graphene.Node.to_global_id("ShippingZone", shipping_zone.pk)@@ -891,7 +906,9 @@ def test_create_shipping_method_minimum_delivery_days_higher_than_maximum(def test_create_shipping_method_minimum_delivery_days_below_0(- staff_api_client, shipping_zone, permission_manage_shipping,+ staff_api_client,+ shipping_zone,+ permission_manage_shipping,):name = "DHL"shipping_zone_id = graphene.Node.to_global_id("ShippingZone", shipping_zone.pk)@@ -917,7 +934,9 @@ def test_create_shipping_method_minimum_delivery_days_below_0(def test_create_shipping_method_maximum_delivery_days_below_0(- staff_api_client, shipping_zone, permission_manage_shipping,+ staff_api_client,+ shipping_zone,+ permission_manage_shipping,):name = "DHL"shipping_zone_id = graphene.Node.to_global_id("ShippingZone", shipping_zone.pk)diff --git a/saleor/graphql/shipping/tests/test_shipping_method_channel_listing_update.py b/saleor/graphql/shipping/tests/test_shipping_method_channel_listing_update.pyindex d023435758..9cf741bde8 100644--- a/saleor/graphql/shipping/tests/test_shipping_method_channel_listing_update.py+++ b/saleor/graphql/shipping/tests/test_shipping_method_channel_listing_update.py@@ -39,7 +39,10 @@ mutation UpdateShippingMethodChannelListing(def test_shipping_method_channel_listing_create_as_staff_user(- staff_api_client, shipping_method, permission_manage_shipping, channel_PLN,+ staff_api_client,+ shipping_method,+ permission_manage_shipping,+ channel_PLN,):# givenshipping_method_id = graphene.Node.to_global_id(@@ -95,7 +98,10 @@ def test_shipping_method_channel_listing_create_as_staff_user(def test_shipping_method_channel_listing_update_as_staff_user(- staff_api_client, shipping_method, permission_manage_shipping, channel_USD,+ staff_api_client,+ shipping_method,+ permission_manage_shipping,+ channel_USD,):# givenshipping_method_id = graphene.Node.to_global_id(@@ -160,7 +166,10 @@ def test_shipping_method_channel_listing_update_as_staff_user(def test_shipping_method_channel_listing_update_with_negative_price(- staff_api_client, shipping_method, permission_manage_shipping, channel_PLN,+ staff_api_client,+ shipping_method,+ permission_manage_shipping,+ channel_PLN,):# givenstaff_api_client.user.user_permissions.add(permission_manage_shipping)@@ -188,7 +197,8 @@ def test_shipping_method_channel_listing_update_with_negative_price(# whenresponse = staff_api_client.post_graphql(- SHIPPING_METHOD_CHANNEL_LISTING_UPDATE_MUTATION, variables=variables,+ SHIPPING_METHOD_CHANNEL_LISTING_UPDATE_MUTATION,+ variables=variables,)# then@@ -196,7 +206,10 @@ def test_shipping_method_channel_listing_update_with_negative_price(def test_shipping_method_channel_listing_update_with_negative_min_value(- staff_api_client, shipping_method, permission_manage_shipping, channel_PLN,+ staff_api_client,+ shipping_method,+ permission_manage_shipping,+ channel_PLN,):# givenstaff_api_client.user.user_permissions.add(permission_manage_shipping)@@ -224,7 +237,8 @@ def test_shipping_method_channel_listing_update_with_negative_min_value(# whenresponse = staff_api_client.post_graphql(- SHIPPING_METHOD_CHANNEL_LISTING_UPDATE_MUTATION, variables=variables,+ SHIPPING_METHOD_CHANNEL_LISTING_UPDATE_MUTATION,+ variables=variables,)# then@@ -232,7 +246,10 @@ def test_shipping_method_channel_listing_update_with_negative_min_value(def test_shipping_method_channel_listing_update_with_negative_max_value(- staff_api_client, shipping_method, permission_manage_shipping, channel_PLN,+ staff_api_client,+ shipping_method,+ permission_manage_shipping,+ channel_PLN,):# givenstaff_api_client.user.user_permissions.add(permission_manage_shipping)@@ -258,7 +275,8 @@ def test_shipping_method_channel_listing_update_with_negative_max_value(# whenresponse = staff_api_client.post_graphql(- SHIPPING_METHOD_CHANNEL_LISTING_UPDATE_MUTATION, variables=variables,+ SHIPPING_METHOD_CHANNEL_LISTING_UPDATE_MUTATION,+ variables=variables,)# then@@ -266,7 +284,10 @@ def test_shipping_method_channel_listing_update_with_negative_max_value(def test_shipping_method_channel_listing_update_with_max_less_than_min(- staff_api_client, shipping_method, permission_manage_shipping, channel_PLN,+ staff_api_client,+ shipping_method,+ permission_manage_shipping,+ channel_PLN,):# givenshipping_method_id = graphene.Node.to_global_id(@@ -307,7 +328,10 @@ def test_shipping_method_channel_listing_update_with_max_less_than_min(def test_shipping_method_channel_listing_create_without_price(- staff_api_client, shipping_method, permission_manage_shipping, channel_PLN,+ staff_api_client,+ shipping_method,+ permission_manage_shipping,+ channel_PLN,):# givenshipping_method_id = graphene.Node.to_global_id(@@ -346,7 +370,10 @@ def test_shipping_method_channel_listing_create_without_price(def test_shipping_method_channel_listing_update_with_to_many_decimal_places_in_price(- staff_api_client, shipping_method, permission_manage_shipping, channel_PLN,+ staff_api_client,+ shipping_method,+ permission_manage_shipping,+ channel_PLN,):# givenshipping_method_id = graphene.Node.to_global_id(@@ -387,7 +414,10 @@ def test_shipping_method_channel_listing_update_with_to_many_decimal_places_in_pdef test_shipping_method_channel_listing_update_with_to_many_decimal_places_in_min_val(- staff_api_client, shipping_method, permission_manage_shipping, channel_PLN,+ staff_api_client,+ shipping_method,+ permission_manage_shipping,+ channel_PLN,):# givenshipping_method_id = graphene.Node.to_global_id(@@ -428,7 +458,10 @@ def test_shipping_method_channel_listing_update_with_to_many_decimal_places_in_mdef test_shipping_method_channel_listing_update_with_to_many_decimal_places_in_max_val(- staff_api_client, shipping_method, permission_manage_shipping, channel_PLN,+ staff_api_client,+ shipping_method,+ permission_manage_shipping,+ channel_PLN,):# givenshipping_method_id = graphene.Node.to_global_id(diff --git a/saleor/graphql/shop/schema.py b/saleor/graphql/shop/schema.pyindex 19ffa43c73..6a98d8cec6 100644--- a/saleor/graphql/shop/schema.py+++ b/saleor/graphql/shop/schema.py@@ -18,7 +18,9 @@ from .types import OrderSettings, Shopclass ShopQueries(graphene.ObjectType):shop = graphene.Field(- Shop, description="Return information about the shop.", required=True,+ Shop,+ description="Return information about the shop.",+ required=True,)order_settings = graphene.Field(OrderSettings, description="Order related settings from site settings."diff --git a/saleor/graphql/shop/tests/test_shop.py b/saleor/graphql/shop/tests/test_shop.pyindex bc77abbe39..b0770b282b 100644--- a/saleor/graphql/shop/tests/test_shop.py+++ b/saleor/graphql/shop/tests/test_shop.py@@ -768,7 +768,10 @@ MUTATION_SHOP_ADDRESS_UPDATE = """def test_mutation_update_company_address(- staff_api_client, permission_manage_settings, address, site_settings,+ staff_api_client,+ permission_manage_settings,+ address,+ site_settings,):variables = {"input": {diff --git a/saleor/graphql/tests/test_decorators.py b/saleor/graphql/tests/test_decorators.pyindex b60d5d5820..ffa4a0f677 100644--- a/saleor/graphql/tests/test_decorators.py+++ b/saleor/graphql/tests/test_decorators.py@@ -68,7 +68,11 @@ def test_permission_required_with_limited_permissions(],)def test_permission_required(- permissions_required, user_permissions, access_granted, staff_user, rf,+ permissions_required,+ user_permissions,+ access_granted,+ staff_user,+ rf,):staff_user.user_permissions.set(Permission.objects.filter(codename__in=user_permissions)diff --git a/saleor/graphql/translations/tests/test_translations.py b/saleor/graphql/translations/tests/test_translations.pyindex ca3f98489b..0a73f1a9cb 100644--- a/saleor/graphql/translations/tests/test_translations.py+++ b/saleor/graphql/translations/tests/test_translations.py@@ -1401,7 +1401,10 @@ QUERY_TRANSLATION_PRODUCT = """def test_translation_query_product(- staff_api_client, permission_manage_translations, product, product_translation_fr,+ staff_api_client,+ permission_manage_translations,+ product,+ product_translation_fr,):product_id = graphene.Node.to_global_id("Product", product.id)diff --git a/saleor/graphql/views.py b/saleor/graphql/views.pyindex ff268744bd..8c404dca31 100644--- a/saleor/graphql/views.py+++ b/saleor/graphql/views.py@@ -17,11 +17,8 @@ from django.views.generic import Viewfrom graphene_django.settings import graphene_settingsfrom graphene_django.views import instantiate_middlewarefrom graphql import GraphQLDocument, get_default_backend-from graphql.error import (- GraphQLError,- GraphQLSyntaxError,- format_error as format_graphql_error,-)+from graphql.error import GraphQLError, GraphQLSyntaxError+from graphql.error import format_error as format_graphql_errorfrom graphql.execution import ExecutionResultfrom jwt.exceptions import PyJWTError@@ -209,9 +206,7 @@ class GraphQLView(View):# Attempt to parse the query, if it fails, return the errortry:return (- self.backend.document_from_string( # type: ignore- self.schema, query- ),+ self.backend.document_from_string(self.schema, query), # type: ignoreNone,)except (ValueError, GraphQLSyntaxError) as e:diff --git a/saleor/graphql/warehouse/tests/test_pagination.py b/saleor/graphql/warehouse/tests/test_pagination.pyindex 8a003fc5ba..f2e99b62be 100644--- a/saleor/graphql/warehouse/tests/test_pagination.py+++ b/saleor/graphql/warehouse/tests/test_pagination.py@@ -9,11 +9,31 @@ from ...tests.utils import get_graphql_contentdef warehouses_for_pagination(db, address):return Warehouse.objects.bulk_create([- Warehouse(name="Warehouse1", address=address, slug="w1",),- Warehouse(name="WarehouseWarehouse1", address=address, slug="ww1",),- Warehouse(name="WarehouseWarehouse2", address=address, slug="ww2",),- Warehouse(name="Warehouse2", address=address, slug="w2",),- Warehouse(name="Warehouse3", address=address, slug="w3",),+ Warehouse(+ name="Warehouse1",+ address=address,+ slug="w1",+ ),+ Warehouse(+ name="WarehouseWarehouse1",+ address=address,+ slug="ww1",+ ),+ Warehouse(+ name="WarehouseWarehouse2",+ address=address,+ slug="ww2",+ ),+ Warehouse(+ name="Warehouse2",+ address=address,+ slug="w2",+ ),+ Warehouse(+ name="Warehouse3",+ address=address,+ slug="w3",+ ),])@@ -108,7 +128,9 @@ def test_warehouses_pagination_with_filtering(def test_warehouses_pagination_with_filtering_by_id(- staff_api_client, permission_manage_products, warehouses_for_pagination,+ staff_api_client,+ permission_manage_products,+ warehouses_for_pagination,):page_size = 2warehouses_order = ["WarehouseWarehouse2", "WarehouseWarehouse1"]diff --git a/saleor/graphql/warehouse/tests/test_warehouse.py b/saleor/graphql/warehouse/tests/test_warehouse.pyindex 2cc2eca25f..353087a46f 100644--- a/saleor/graphql/warehouse/tests/test_warehouse.py+++ b/saleor/graphql/warehouse/tests/test_warehouse.py@@ -260,7 +260,8 @@ def test_warehouse_query_as_customer(user_api_client, warehouse):warehouse_id = graphene.Node.to_global_id("Warehouse", warehouse.pk)response = user_api_client.post_graphql(- QUERY_WAREHOUSE, variables={"id": warehouse_id},+ QUERY_WAREHOUSE,+ variables={"id": warehouse_id},)assert_no_permission(response)@@ -535,7 +536,11 @@ def test_create_warehouse_creates_address(@pytest.mark.parametrize("input_slug, expected_slug",- (("test-slug", "test-slug"), (None, "test-warehouse"), ("", "test-warehouse"),),+ (+ ("test-slug", "test-slug"),+ (None, "test-warehouse"),+ ("", "test-warehouse"),+ ),)def test_create_warehouse_with_given_slug(staff_api_client, permission_manage_products, input_slug, expected_slug@@ -689,7 +694,14 @@ def test_update_warehouse_slug_exists("input_slug, expected_slug, input_name, expected_name, error_message, error_field",[("test-slug", "test-slug", "New name", "New name", None, None),- ("test-slug", "test-slug", " stripped ", "stripped", None, None,),+ (+ "test-slug",+ "test-slug",+ " stripped ",+ "stripped",+ None,+ None,+ ),("", "", "New name", "New name", "Slug value cannot be blank.", "slug"),(None, "", "New name", "New name", "Slug value cannot be blank.", "slug"),("test-slug", "", None, None, "This field cannot be blank.", "name"),diff --git a/saleor/graphql/webhook/mutations.py b/saleor/graphql/webhook/mutations.pyindex 5539a468e7..26d0a58e60 100644--- a/saleor/graphql/webhook/mutations.py+++ b/saleor/graphql/webhook/mutations.py@@ -20,7 +20,8 @@ class WebhookCreateInput(graphene.InputObjectType):),)app = graphene.ID(- required=False, description="ID of the app to which webhook belongs.",+ required=False,+ description="ID of the app to which webhook belongs.",)is_active = graphene.Boolean(description="Determine if webhook will be set active or not.", required=False@@ -63,7 +64,8 @@ class WebhookCreate(ModelMutation):if not app or not app.is_active:raise ValidationError(- "App doesn't exist or is disabled", code=WebhookErrorCode.NOT_FOUND,+ "App doesn't exist or is disabled",+ code=WebhookErrorCode.NOT_FOUND,)return cleaned_data@@ -106,7 +108,8 @@ class WebhookUpdateInput(graphene.InputObjectType):required=False,)app = graphene.ID(- required=False, description="ID of the app to which webhook belongs.",+ required=False,+ description="ID of the app to which webhook belongs.",)is_active = graphene.Boolean(description="Determine if webhook will be set active or not.", required=False@@ -146,7 +149,8 @@ class WebhookUpdate(ModelMutation):if not app or not app.is_active:raise ValidationError(- "App doesn't exist or is disabled", code=WebhookErrorCode.NOT_FOUND,+ "App doesn't exist or is disabled",+ code=WebhookErrorCode.NOT_FOUND,)return cleaned_datadiff --git a/saleor/graphql/webhook/tests/test_pagination.py b/saleor/graphql/webhook/tests/test_pagination.pyindex 4f60c8f926..c452184b5a 100644--- a/saleor/graphql/webhook/tests/test_pagination.py+++ b/saleor/graphql/webhook/tests/test_pagination.py@@ -35,7 +35,9 @@ def webhooks_for_pagination(db):is_active=False,),Webhook(- name="Webhook3", app=apps[0], target_url="http://www.example.com/test",+ name="Webhook3",+ app=apps[0],+ target_url="http://www.example.com/test",),])diff --git a/saleor/graphql/webhook/tests/test_webhook.py b/saleor/graphql/webhook/tests/test_webhook.pyindex ad84999480..5ed8c63fd7 100644--- a/saleor/graphql/webhook/tests/test_webhook.py+++ b/saleor/graphql/webhook/tests/test_webhook.py@@ -110,7 +110,10 @@ WEBHOOK_CREATE_BY_STAFF = """def test_webhook_create_by_staff(- staff_api_client, app, permission_manage_apps, permission_manage_orders,+ staff_api_client,+ app,+ permission_manage_apps,+ permission_manage_orders,):query = WEBHOOK_CREATE_BY_STAFFapp.permissions.add(permission_manage_orders)@@ -353,7 +356,9 @@ def test_query_webhook_by_app(app_api_client, webhook):assert events[0].event_type == WebhookEventTypeEnum.ORDER_CREATED.value-def test_query_webhook_by_app_without_permission(app_api_client,):+def test_query_webhook_by_app_without_permission(+ app_api_client,+):second_app = App.objects.create(name="Sample app account", is_active=True)webhook = Webhook.objects.create(app=second_app, target_url="http://www.example.com/test"diff --git a/saleor/invoice/migrations/0001_initial.py b/saleor/invoice/migrations/0001_initial.pyindex 6661c3a502..af97859750 100644--- a/saleor/invoice/migrations/0001_initial.py+++ b/saleor/invoice/migrations/0001_initial.py@@ -78,7 +78,9 @@ class Migration(migrations.Migration):),),],- options={"abstract": False,}, # noqa: E231+ options={+ "abstract": False,+ }, # noqa: E231),migrations.CreateModel(name="InvoiceEvent",@@ -152,6 +154,8 @@ class Migration(migrations.Migration):),),],- options={"ordering": ("date",),}, # noqa: E231+ options={+ "ordering": ("date",),+ }, # noqa: E231),]diff --git a/saleor/invoice/migrations/0003_auto_20200713_1311.py b/saleor/invoice/migrations/0003_auto_20200713_1311.pyindex 997f24713f..83ceb086f9 100644--- a/saleor/invoice/migrations/0003_auto_20200713_1311.py+++ b/saleor/invoice/migrations/0003_auto_20200713_1311.py@@ -11,6 +11,7 @@ class Migration(migrations.Migration):operations = [migrations.AlterModelOptions(- name="invoiceevent", options={"ordering": ("date", "pk")},+ name="invoiceevent",+ options={"ordering": ("date", "pk")},),]diff --git a/saleor/menu/migrations/0017_remove_menu_json_content.py b/saleor/menu/migrations/0017_remove_menu_json_content.pyindex 7ee8b17c3f..811f1c1ff6 100644--- a/saleor/menu/migrations/0017_remove_menu_json_content.py+++ b/saleor/menu/migrations/0017_remove_menu_json_content.py@@ -10,5 +10,8 @@ class Migration(migrations.Migration):]operations = [- migrations.RemoveField(model_name="menu", name="json_content",),+ migrations.RemoveField(+ model_name="menu",+ name="json_content",+ ),]diff --git a/saleor/menu/migrations/0018_auto_20200709_1102.py b/saleor/menu/migrations/0018_auto_20200709_1102.pyindex 4c129adf6e..6a0540bd15 100644--- a/saleor/menu/migrations/0018_auto_20200709_1102.py+++ b/saleor/menu/migrations/0018_auto_20200709_1102.py@@ -11,7 +11,8 @@ class Migration(migrations.Migration):operations = [migrations.AlterModelOptions(- name="menuitem", options={"ordering": ("sort_order", "pk")},+ name="menuitem",+ options={"ordering": ("sort_order", "pk")},),migrations.AlterModelOptions(name="menuitemtranslation",diff --git a/saleor/menu/migrations/0019_menu_slug.py b/saleor/menu/migrations/0019_menu_slug.pyindex 2cc34cbee5..aad52780f0 100644--- a/saleor/menu/migrations/0019_menu_slug.py+++ b/saleor/menu/migrations/0019_menu_slug.py@@ -48,7 +48,9 @@ class Migration(migrations.Migration):operations = [migrations.AlterField(- model_name="menu", name="name", field=models.CharField(max_length=250),+ model_name="menu",+ name="name",+ field=models.CharField(max_length=250),),# Temporary set the slug "null" to True to allow slug generation to run.migrations.AddField(diff --git a/saleor/order/actions.py b/saleor/order/actions.pyindex 1112f94d5a..bd797f7a84 100644--- a/saleor/order/actions.py+++ b/saleor/order/actions.py@@ -268,7 +268,9 @@ def mark_order_as_paid(def clean_mark_order_as_paid(order: "Order"):"""Check if an order can be marked as paid."""if order.payments.exists():- raise PaymentError("Orders with payments can not be manually marked as paid.",)+ raise PaymentError(+ "Orders with payments can not be manually marked as paid.",+ )def fulfill_order_line(order_line, quantity, warehouse_pk):@@ -414,7 +416,10 @@ def create_fulfillments(FulfillmentLine.objects.bulk_create(fulfillment_lines)order_fulfilled(- fulfillments, requester, fulfillment_lines, notify_customer,+ fulfillments,+ requester,+ fulfillment_lines,+ notify_customer,)return fulfillments@@ -454,7 +459,9 @@ def _refund_fulfillment_for_order_lines(# fulfillmentfulfillment_line_existed = Falserefunded_line = FulfillmentLine(- fulfillment=refunded_fulfillment, order_line=line_to_refund, quantity=0,+ fulfillment=refunded_fulfillment,+ order_line=line_to_refund,+ quantity=0,)# calculate the quantity fulfilled/unfulfilled/to refunddiff --git a/saleor/order/events.py b/saleor/order/events.pyindex 8960cd02e1..04c2a315a8 100644--- a/saleor/order/events.py+++ b/saleor/order/events.py@@ -55,14 +55,21 @@ def email_sent_event()-def invoice_requested_event(*, order: Order, user: Optional[UserType],) -> OrderEvent:+def invoice_requested_event(+ *,+ order: Order,+ user: Optional[UserType],+) -> OrderEvent:return OrderEvent.objects.create(order=order, type=OrderEvents.INVOICE_REQUESTED, user=user)def invoice_generated_event(- *, order: Order, user: Optional[UserType], invoice_number: str,+ *,+ order: Order,+ user: Optional[UserType],+ invoice_number: str,) -> OrderEvent:return OrderEvent.objects.create(order=order,@@ -89,7 +96,10 @@ def invoice_updated_event(def invoice_sent_event(- *, order: Order, user: Optional[UserType], email: str,+ *,+ order: Order,+ user: Optional[UserType],+ email: str,) -> OrderEvent:return OrderEvent.objects.create(order=order,diff --git a/saleor/order/migrations/0078_auto_20200221_0257.py b/saleor/order/migrations/0078_auto_20200221_0257.pyindex 745af41308..669d1da875 100644--- a/saleor/order/migrations/0078_auto_20200221_0257.py+++ b/saleor/order/migrations/0078_auto_20200221_0257.py@@ -11,7 +11,9 @@ class Migration(migrations.Migration):operations = [migrations.RenameField(- model_name="fulfillment", old_name="meta", new_name="metadata",+ model_name="fulfillment",+ old_name="meta",+ new_name="metadata",),migrations.RenameField(model_name="fulfillment",@@ -19,9 +21,13 @@ class Migration(migrations.Migration):new_name="private_metadata",),migrations.RenameField(- model_name="order", old_name="meta", new_name="metadata",+ model_name="order",+ old_name="meta",+ new_name="metadata",),migrations.RenameField(- model_name="order", old_name="private_meta", new_name="private_metadata",+ model_name="order",+ old_name="private_meta",+ new_name="private_metadata",),]diff --git a/saleor/order/migrations/0079_auto_20200225_0237.py b/saleor/order/migrations/0079_auto_20200225_0237.pyindex b21bbbcd3f..d8be1f9073 100644--- a/saleor/order/migrations/0079_auto_20200225_0237.py+++ b/saleor/order/migrations/0079_auto_20200225_0237.py@@ -11,6 +11,7 @@ class Migration(migrations.Migration):operations = [migrations.AlterModelOptions(- name="fulfillment", options={"ordering": ("pk",)},+ name="fulfillment",+ options={"ordering": ("pk",)},),]diff --git a/saleor/order/migrations/0085_delete_invoice.py b/saleor/order/migrations/0085_delete_invoice.pyindex 302e1c5cdb..ae0f6d7fb0 100644--- a/saleor/order/migrations/0085_delete_invoice.py+++ b/saleor/order/migrations/0085_delete_invoice.py@@ -10,5 +10,7 @@ class Migration(migrations.Migration):]operations = [- migrations.DeleteModel(name="Invoice",),+ migrations.DeleteModel(+ name="Invoice",+ ),]diff --git a/saleor/order/migrations/0090_order_channel_listing.py b/saleor/order/migrations/0090_order_channel_listing.pyindex 25964daeb2..1c01fa3877 100644--- a/saleor/order/migrations/0090_order_channel_listing.py+++ b/saleor/order/migrations/0090_order_channel_listing.py@@ -18,7 +18,8 @@ def add_channel_slug(apps, schema_editor):if not channel:name = f"Channel {currency}"channel, _ = Channel.objects.get_or_create(- currency_code=currency, defaults={"name": name, "slug": slugify(name)},+ currency_code=currency,+ defaults={"name": name, "slug": slugify(name)},)channels_dict[currency] = channel@@ -56,7 +57,9 @@ class Migration(migrations.Migration):),),migrations.AlterField(- model_name="order", name="currency", field=models.CharField(max_length=3),+ model_name="order",+ name="currency",+ field=models.CharField(max_length=3),),migrations.AlterField(model_name="orderline",diff --git a/saleor/order/migrations/0094_auto_20201221_1128.py b/saleor/order/migrations/0094_auto_20201221_1128.pyindex 9c15666c08..71cafca47d 100644--- a/saleor/order/migrations/0094_auto_20201221_1128.py+++ b/saleor/order/migrations/0094_auto_20201221_1128.py@@ -39,7 +39,10 @@ class Migration(migrations.Migration):blank=True, decimal_places=3, max_digits=12, null=True),),- migrations.RunPython(set_total_prices, migrations.RunPython.noop,),+ migrations.RunPython(+ set_total_prices,+ migrations.RunPython.noop,+ ),migrations.AlterField(model_name="orderline",name="total_price_gross_amount",diff --git a/saleor/order/models.py b/saleor/order/models.pyindex 9b0deb232b..9229cf3d07 100644--- a/saleor/order/models.py+++ b/saleor/order/models.py@@ -97,7 +97,9 @@ class Order(ModelWithMetadata):)user_email = models.EmailField(blank=True, default="")- currency = models.CharField(max_length=settings.DEFAULT_CURRENCY_CODE_LENGTH,)+ currency = models.CharField(+ max_length=settings.DEFAULT_CURRENCY_CODE_LENGTH,+ )shipping_method = models.ForeignKey(ShippingMethod,@@ -110,7 +112,9 @@ class Order(ModelWithMetadata):max_length=255, null=True, default=None, blank=True, editable=False)channel = models.ForeignKey(- Channel, related_name="orders", on_delete=models.PROTECT,+ Channel,+ related_name="orders",+ on_delete=models.PROTECT,)shipping_price_net_amount = models.DecimalField(max_digits=settings.DEFAULT_MAX_DIGITS,@@ -387,7 +391,9 @@ class OrderLine(models.Model):validators=[MinValueValidator(0)], default=0)- currency = models.CharField(max_length=settings.DEFAULT_CURRENCY_CODE_LENGTH,)+ currency = models.CharField(+ max_length=settings.DEFAULT_CURRENCY_CODE_LENGTH,+ )unit_price_net_amount = models.DecimalField(max_digits=settings.DEFAULT_MAX_DIGITS,@@ -416,7 +422,8 @@ class OrderLine(models.Model):decimal_places=settings.DEFAULT_DECIMAL_PLACES,)total_price_net = MoneyField(- amount_field="total_price_net_amount", currency_field="currency",+ amount_field="total_price_net_amount",+ currency_field="currency",)total_price_gross_amount = models.DecimalField(@@ -424,7 +431,8 @@ class OrderLine(models.Model):decimal_places=settings.DEFAULT_DECIMAL_PLACES,)total_price_gross = MoneyField(- amount_field="total_price_gross_amount", currency_field="currency",+ amount_field="total_price_gross_amount",+ currency_field="currency",)total_price = TaxedMoneyField(diff --git a/saleor/order/tests/test_emails.py b/saleor/order/tests/test_emails.pyindex 1ee1eef916..a2f8c8d2f1 100644--- a/saleor/order/tests/test_emails.py+++ b/saleor/order/tests/test_emails.py@@ -5,7 +5,8 @@ from templated_email import get_connectionfrom ...invoice import emails as invoice_emailsfrom ...invoice.models import Invoice-from ...order import OrderEvents, emails as emails+from ...order import OrderEvents+from ...order import emails as emailsfrom ..utils import add_variant_to_draft_orderdiff --git a/saleor/order/tests/test_fulfullments_actions.py b/saleor/order/tests/test_fulfullments_actions.pyindex 68d267ce9a..af9c24b9f8 100644--- a/saleor/order/tests/test_fulfullments_actions.py+++ b/saleor/order/tests/test_fulfullments_actions.py@@ -10,7 +10,10 @@ from ..models import FulfillmentLine, OrderStatus@patch("saleor.order.actions.send_fulfillment_confirmation_to_customer", autospec=True)def test_create_fulfillments(- mock_email_fulfillment, staff_user, order_with_lines, warehouse,+ mock_email_fulfillment,+ staff_user,+ order_with_lines,+ warehouse,):order = order_with_linesorder_line1, order_line2 = order.lines.all()@@ -55,7 +58,10 @@ def test_create_fulfillments(@patch("saleor.order.actions.send_fulfillment_confirmation_to_customer", autospec=True)def test_create_fulfillments_without_notification(- mock_email_fulfillment, staff_user, order_with_lines, warehouse,+ mock_email_fulfillment,+ staff_user,+ order_with_lines,+ warehouse,):order = order_with_linesorder_line1, order_line2 = order.lines.all()@@ -97,7 +103,9 @@ def test_create_fulfillments_without_notification(def test_create_fulfillments_many_warehouses(- staff_user, order_with_lines, warehouses,+ staff_user,+ order_with_lines,+ warehouses,):order = order_with_lineswarehouse1, warehouse2 = warehouses@@ -154,7 +162,10 @@ def test_create_fulfillments_many_warehouses(@patch("saleor.order.actions.send_fulfillment_confirmation_to_customer", autospec=True)def test_create_fulfillments_with_one_line_empty_quantity(- mock_email_fulfillment, staff_user, order_with_lines, warehouse,+ mock_email_fulfillment,+ staff_user,+ order_with_lines,+ warehouse,):order = order_with_linesorder_line1, order_line2 = order.lines.all()@@ -237,7 +248,10 @@ def test_create_fulfillments_with_variant_without_inventory_tracking(@patch("saleor.order.actions.send_fulfillment_confirmation_to_customer", autospec=True)def test_create_fulfillments_without_allocations(- mock_email_fulfillment, staff_user, order_with_lines, warehouse,+ mock_email_fulfillment,+ staff_user,+ order_with_lines,+ warehouse,):order = order_with_linesorder_line1, order_line2 = order.lines.all()@@ -283,7 +297,10 @@ def test_create_fulfillments_without_allocations(@patch("saleor.order.actions.send_fulfillment_confirmation_to_customer", autospec=True)def test_create_fulfillments_warehouse_with_out_of_stock(- mock_email_fulfillment, staff_user, order_with_lines, warehouse,+ mock_email_fulfillment,+ staff_user,+ order_with_lines,+ warehouse,):order = order_with_linesorder_line1, order_line2 = order.lines.all()@@ -329,7 +346,10 @@ def test_create_fulfillments_warehouse_with_out_of_stock(@patch("saleor.order.actions.send_fulfillment_confirmation_to_customer", autospec=True)def test_create_fulfillments_warehouse_without_stock(- mock_email_fulfillment, staff_user, order_with_lines, warehouse_no_shipping_zone,+ mock_email_fulfillment,+ staff_user,+ order_with_lines,+ warehouse_no_shipping_zone,):order = order_with_linesorder_line1, order_line2 = order.lines.all()diff --git a/saleor/order/tests/test_order.py b/saleor/order/tests/test_order.pyindex 4a1139ffc9..fb1a145fdd 100644--- a/saleor/order/tests/test_order.py+++ b/saleor/order/tests/test_order.py@@ -602,7 +602,9 @@ def test_value_voucher_order_discount(channel_USD,):voucher = Voucher.objects.create(- code="unique", type=VoucherType.ENTIRE_ORDER, discount_value_type=discount_type,+ code="unique",+ type=VoucherType.ENTIRE_ORDER,+ discount_value_type=discount_type,)VoucherChannelListing.objects.create(voucher=voucher,@@ -627,7 +629,9 @@ def test_shipping_voucher_order_discount(shipping_cost, discount_value, discount_type, expected_value, channel_USD):voucher = Voucher.objects.create(- code="unique", type=VoucherType.SHIPPING, discount_value_type=discount_type,+ code="unique",+ type=VoucherType.SHIPPING,+ discount_value_type=discount_type,)VoucherChannelListing.objects.create(voucher=voucher,@@ -820,7 +824,9 @@ def test_send_fulfillment_order_lines_mails(line.save()send_fulfillment_confirmation_to_customer(- order=order, fulfillment=fulfillment, user=staff_user,+ order=order,+ fulfillment=fulfillment,+ user=staff_user,)events = OrderEvent.objects.all()diff --git a/saleor/order/tests/test_order_actions.py b/saleor/order/tests/test_order_actions.pyindex f83f6a8cf9..b3e3f9746b 100644--- a/saleor/order/tests/test_order_actions.py+++ b/saleor/order/tests/test_order_actions.py@@ -232,7 +232,9 @@ def test_cancel_order(@patch("saleor.order.actions.send_order_refunded_confirmation")def test_order_refunded(- send_order_refunded_confirmation_mock, order, checkout_with_item,+ send_order_refunded_confirmation_mock,+ order,+ checkout_with_item,):# givenpayment = Payment.objects.create(diff --git a/saleor/order/utils.py b/saleor/order/utils.pyindex 0eed926d30..676216f0da 100644--- a/saleor/order/utils.py+++ b/saleor/order/utils.py@@ -360,7 +360,8 @@ def get_discounted_lines(lines, voucher):def get_prices_of_discounted_specific_product(- lines: Iterable[OrderLine], voucher: Voucher,+ lines: Iterable[OrderLine],+ voucher: Voucher,) -> List[Money]:"""Get prices of variants belonging to the discounted specific products.diff --git a/saleor/page/migrations/0010_auto_20200129_0717.py b/saleor/page/migrations/0010_auto_20200129_0717.pyindex 7063cd63f9..4d873144ea 100644--- a/saleor/page/migrations/0010_auto_20200129_0717.py+++ b/saleor/page/migrations/0010_auto_20200129_0717.py@@ -16,6 +16,8 @@ class Migration(migrations.Migration):field=models.SlugField(max_length=255, unique=True),),migrations.AlterField(- model_name="page", name="title", field=models.CharField(max_length=250),+ model_name="page",+ name="title",+ field=models.CharField(max_length=250),),]diff --git a/saleor/page/migrations/0011_auto_20200217_0350.py b/saleor/page/migrations/0011_auto_20200217_0350.pyindex 5f1fba6402..6586ebb86d 100644--- a/saleor/page/migrations/0011_auto_20200217_0350.py+++ b/saleor/page/migrations/0011_auto_20200217_0350.py@@ -11,6 +11,7 @@ class Migration(migrations.Migration):operations = [migrations.AlterModelOptions(- name="pagetranslation", options={"ordering": ("language_code", "page")},+ name="pagetranslation",+ options={"ordering": ("language_code", "page")},),]diff --git a/saleor/page/migrations/0017_pagetype.py b/saleor/page/migrations/0017_pagetype.pyindex 42e727a3f1..1f0f5ac259 100644--- a/saleor/page/migrations/0017_pagetype.py+++ b/saleor/page/migrations/0017_pagetype.py@@ -14,7 +14,8 @@ def update_groups_with_manage_pages_with_new_permission(apps, schema_editor):Permission = apps.get_model("auth", "Permission")manage_page_types_and_attributes_perm = Permission.objects.filter(- codename="manage_page_types_and_attributes", content_type__app_label="page",+ codename="manage_page_types_and_attributes",+ content_type__app_label="page",).first()groups = Group.objects.filter(diff --git a/saleor/payment/gateways/adyen/plugin.py b/saleor/payment/gateways/adyen/plugin.pyindex f3ab3fed3c..41e077dccd 100644--- a/saleor/payment/gateways/adyen/plugin.py+++ b/saleor/payment/gateways/adyen/plugin.py@@ -227,7 +227,8 @@ class AdyenGatewayPlugin(BasePlugin):return handle_webhook(request, config)elif path.startswith(ADDITIONAL_ACTION_PATH):return handle_additional_actions(- request, self.adyen.checkout.payments_details,+ request,+ self.adyen.checkout.payments_details,)return HttpResponseNotFound()@@ -255,7 +256,9 @@ class AdyenGatewayPlugin(BasePlugin):@require_active_plugindef get_payment_gateway_for_checkout(- self, checkout: "Checkout", previous_value,+ self,+ checkout: "Checkout",+ previous_value,) -> Optional["PaymentGateway"]:config = self._get_gateway_config()@@ -325,7 +328,9 @@ class AdyenGatewayPlugin(BasePlugin):error_message = result.message.get("refusalReason")if action:update_payment_with_action_required_data(- payment, action, result.message.get("details", []),+ payment,+ action,+ result.message.get("details", []),)# If auto capture is enabled, let's make a capture the auth paymentelif (diff --git a/saleor/payment/gateways/adyen/tests/test_plugin.py b/saleor/payment/gateways/adyen/tests/test_plugin.pyindex 8888ea9b7c..252b0902f3 100644--- a/saleor/payment/gateways/adyen/tests/test_plugin.py+++ b/saleor/payment/gateways/adyen/tests/test_plugin.py@@ -255,7 +255,9 @@ def test_process_payment_additional_action_checkout_does_not_exists(def test_confirm_payment(payment_adyen_for_order, adyen_plugin):- payment_info = create_payment_information(payment_adyen_for_order,)+ payment_info = create_payment_information(+ payment_adyen_for_order,+ )gateway_response = GatewayResponse(kind=TransactionKind.ACTION_TO_CONFIRM,action_required=False,@@ -284,7 +286,9 @@ def test_confirm_payment(payment_adyen_for_order, adyen_plugin):def test_confirm_payment_pending_order(payment_adyen_for_checkout, adyen_plugin):- payment_info = create_payment_information(payment_adyen_for_checkout,)+ payment_info = create_payment_information(+ payment_adyen_for_checkout,+ )gateway_response = GatewayResponse(kind=TransactionKind.ACTION_TO_CONFIRM,action_required=False,@@ -312,7 +316,9 @@ def test_confirm_payment_pending_order(payment_adyen_for_checkout, adyen_plugin)def test_confirm_already_processed_payment(payment_adyen_for_order, adyen_plugin):- payment_info = create_payment_information(payment_adyen_for_order,)+ payment_info = create_payment_information(+ payment_adyen_for_order,+ )gateway_response = GatewayResponse(kind=TransactionKind.ACTION_TO_CONFIRM,action_required=False,@@ -349,7 +355,9 @@ def test_confirm_already_processed_payment(payment_adyen_for_order, adyen_plugindef test_confirm_payment_with_adyen_auto_capture(payment_adyen_for_order, adyen_plugin):- payment_info = create_payment_information(payment_adyen_for_order,)+ payment_info = create_payment_information(+ payment_adyen_for_order,+ )gateway_response = GatewayResponse(kind=TransactionKind.ACTION_TO_CONFIRM,action_required=False,@@ -381,7 +389,9 @@ def test_confirm_payment_with_adyen_auto_capture(payment_adyen_for_order, adyen_@pytest.mark.skip(reason="To finish when additional auth data schema will be known")def test_confirm_payment_with_additional_details(payment_adyen_for_order, adyen_plugin):return # test it when we will have additional auth data- payment_info = create_payment_information(payment_adyen_for_order,)+ payment_info = create_payment_information(+ payment_adyen_for_order,+ )adyen_plugin = adyen_plugin()adyen_plugin.confirm_payment(payment_info, None)@@ -420,7 +430,9 @@ def test_refund_payment(payment_adyen_for_order, order_with_lines, adyen_plugin)@pytest.mark.vcrdef test_void_payment(payment_adyen_for_order, order_with_lines, adyen_plugin):- payment_info = create_payment_information(payment_adyen_for_order,)+ payment_info = create_payment_information(+ payment_adyen_for_order,+ )gateway_response = GatewayResponse(kind=TransactionKind.AUTH,action_required=False,diff --git a/saleor/payment/gateways/adyen/tests/utils/test_apple_pay.py b/saleor/payment/gateways/adyen/tests/utils/test_apple_pay.pyindex 3b6275032e..1f0c2ff0cc 100644--- a/saleor/payment/gateways/adyen/tests/utils/test_apple_pay.py+++ b/saleor/payment/gateways/adyen/tests/utils/test_apple_pay.py@@ -96,7 +96,11 @@ def test_initialize_payment_for_apple_pay(mocked_request, mocked_tmp_file):certificate = "certifiate data"initialize_apple_pay_session(- validation_url, merchant_identifier, domain, display_name, certificate,+ validation_url,+ merchant_identifier,+ domain,+ display_name,+ certificate,)expected_data = {@@ -127,5 +131,9 @@ def test_initialize_payment_for_apple_pay_request_failed(mocked_request):with pytest.raises(PaymentError):initialize_apple_pay_session(- validation_url, merchant_identifier, domain, display_name, certificate,+ validation_url,+ merchant_identifier,+ domain,+ display_name,+ certificate,)diff --git a/saleor/payment/gateways/adyen/tests/webhooks/test_handle_additional_actions.py b/saleor/payment/gateways/adyen/tests/webhooks/test_handle_additional_actions.pyindex b5106e058f..dac487192b 100644--- a/saleor/payment/gateways/adyen/tests/webhooks/test_handle_additional_actions.py+++ b/saleor/payment/gateways/adyen/tests/webhooks/test_handle_additional_actions.py@@ -353,7 +353,8 @@ def test_handle_additional_actions_payment_does_not_have_checkout(@mock.patch("saleor.payment.gateways.adyen.webhooks.api_call")def test_handle_additional_actions_api_call_error(- api_call_mock, payment_adyen_for_checkout,+ api_call_mock,+ payment_adyen_for_checkout,):# givenpayment_adyen_for_checkout.extra_data = json.dumps(diff --git a/saleor/payment/gateways/adyen/tests/webhooks/test_handle_notifications.py b/saleor/payment/gateways/adyen/tests/webhooks/test_handle_notifications.pyindex 6dd42083d3..f990a3b68e 100644--- a/saleor/payment/gateways/adyen/tests/webhooks/test_handle_notifications.py+++ b/saleor/payment/gateways/adyen/tests/webhooks/test_handle_notifications.py@@ -141,7 +141,11 @@ def test_handle_authorization_for_pending_order(def test_handle_authorization_for_checkout(- notification, adyen_plugin, payment_adyen_for_checkout, address, shipping_method,+ notification,+ adyen_plugin,+ payment_adyen_for_checkout,+ address,+ shipping_method,):checkout = payment_adyen_for_checkout.checkoutcheckout.shipping_address = address@@ -376,7 +380,11 @@ def test_handle_capture_for_order(notification, adyen_plugin, payment_adyen_for_def test_handle_capture_for_checkout(- notification, adyen_plugin, payment_adyen_for_checkout, address, shipping_method,+ notification,+ adyen_plugin,+ payment_adyen_for_checkout,+ address,+ shipping_method,):checkout = payment_adyen_for_checkout.checkoutcheckout.shipping_address = addressdiff --git a/saleor/payment/gateways/adyen/utils/common.py b/saleor/payment/gateways/adyen/utils/common.pyindex 88528ada4c..0ff83735e6 100644--- a/saleor/payment/gateways/adyen/utils/common.py+++ b/saleor/payment/gateways/adyen/utils/common.py@@ -172,7 +172,9 @@ def get_shipping_data(manager, checkout, lines, address, discounts):def append_klarna_data(payment_information: "PaymentData", payment_data: dict):checkout = (- Checkout.objects.prefetch_related("shipping_method",)+ Checkout.objects.prefetch_related(+ "shipping_method",+ ).filter(payments__id=payment_information.payment_id).first())@@ -362,7 +364,9 @@ def call_capture(def request_for_payment_cancel(- payment_information: "PaymentData", merchant_account: str, token: str,+ payment_information: "PaymentData",+ merchant_account: str,+ token: str,):return {"merchantAccount": merchant_account,@@ -381,6 +385,7 @@ def get_payment_method_info(if additional_data:brand = additional_data.get("paymentMethod")payment_method_info = PaymentMethodInfo(- brand=brand, type="card" if payment_method == "scheme" else payment_method,+ brand=brand,+ type="card" if payment_method == "scheme" else payment_method,)return payment_method_infodiff --git a/saleor/payment/gateways/adyen/webhooks.py b/saleor/payment/gateways/adyen/webhooks.pyindex 7620aaffd2..d3863a7e37 100644--- a/saleor/payment/gateways/adyen/webhooks.py+++ b/saleor/payment/gateways/adyen/webhooks.py@@ -90,7 +90,10 @@ def get_checkout(payment: Payment) -> Optional[Checkout]:# Lock checkout in the same way as in checkoutCompletereturn (Checkout.objects.select_for_update(of=("self",))- .prefetch_related("gift_cards", "lines__variant__product",)+ .prefetch_related(+ "gift_cards",+ "lines__variant__product",+ ).select_related("shipping_method__shipping_zone").filter(pk=payment.checkout.pk).first()@@ -98,7 +101,9 @@ def get_checkout(payment: Payment) -> Optional[Checkout]:def get_transaction(- payment: "Payment", transaction_id: Optional[str], kind: str,+ payment: "Payment",+ transaction_id: Optional[str],+ kind: str,) -> Optional[Transaction]:transaction = payment.transactions.filter(kind=kind, token=transaction_id).last()return transaction@@ -298,7 +303,9 @@ def handle_capture(notification: Dict[str, Any], _gateway_config: GatewayConfig))else:capture_transaction = payment.transactions.filter(- action_required=False, is_success=True, kind=TransactionKind.CAPTURE,+ action_required=False,+ is_success=True,+ kind=TransactionKind.CAPTURE,).last()new_transaction = create_new_transaction(notification, payment, TransactionKind.CAPTURE@@ -640,7 +647,8 @@ def handle_webhook(request: WSGIRequest, gateway_config: "GatewayConfig"):@transaction_with_commit_on_errors()def handle_additional_actions(- request: WSGIRequest, payment_details: Callable,+ request: WSGIRequest,+ payment_details: Callable,):payment_id = request.GET.get("payment")checkout_pk = request.GET.get("checkout")@@ -713,9 +721,7 @@ def prepare_api_request_data(request: WSGIRequest, data: dict):def prepare_redirect_url(payment_id: str, checkout_pk: str, api_response: Adyen.Adyen, return_url: str):- checkout_id = graphene.Node.to_global_id(- "Checkout", checkout_pk # type: ignore- )+ checkout_id = graphene.Node.to_global_id("Checkout", checkout_pk) # type: ignoreparams = {"checkout": checkout_id,@@ -731,11 +737,13 @@ def prepare_redirect_url(def handle_api_response(- payment: Payment, response: Adyen.Adyen,+ payment: Payment,+ response: Adyen.Adyen,):checkout = get_checkout(payment)payment_data = create_payment_information(- payment=payment, payment_token=payment.token,+ payment=payment,+ payment_token=payment.token,)payment_brand = response.message.get("additionalData", {}).get("paymentMethod")if payment_brand:diff --git a/saleor/payment/tests/test_payment.py b/saleor/payment/tests/test_payment.pyindex bcc7a58546..84b3b3fd87 100644--- a/saleor/payment/tests/test_payment.py+++ b/saleor/payment/tests/test_payment.py@@ -472,7 +472,8 @@ def test_validate_gateway_response_not_json_serializable(gateway_response):@pytest.mark.parametrize(- "currency, exp_response", [("EUR", True), ("USD", True), ("PLN", False)],+ "currency, exp_response",+ [("EUR", True), ("USD", True), ("PLN", False)],)def test_is_currency_supported(currency, exp_response, dummy_gateway_config, monkeypatchdiff --git a/saleor/plugins/avatax/__init__.py b/saleor/plugins/avatax/__init__.pyindex 6c016266f6..a01480011d 100644--- a/saleor/plugins/avatax/__init__.py+++ b/saleor/plugins/avatax/__init__.py@@ -100,7 +100,9 @@ def api_post_request(def api_get_request(- url: str, username_or_account: str, password_or_license: str,+ url: str,+ username_or_account: str,+ password_or_license: str,):response = Nonetry:diff --git a/saleor/plugins/avatax/plugin.py b/saleor/plugins/avatax/plugin.pyindex 821b86ce6a..54d2eb46b5 100644--- a/saleor/plugins/avatax/plugin.py+++ b/saleor/plugins/avatax/plugin.py@@ -36,10 +36,10 @@ from .tasks import api_post_request_taskif TYPE_CHECKING:# flake8: noqa- from ...checkout import CheckoutLineInfofrom ...account.models import Address- from ...checkout.models import Checkout, CheckoutLinefrom ...channel.models import Channel+ from ...checkout import CheckoutLineInfo+ from ...checkout.models import Checkout, CheckoutLinefrom ...order.models import Order, OrderLinefrom ...product.models import (Collection,@@ -574,7 +574,10 @@ class AvataxPlugin(BasePlugin):tax_description = obj.get_value_from_metadata(META_DESCRIPTION_KEY, default_tax_description)- return TaxType(code=tax_code, description=tax_description,)+ return TaxType(+ code=tax_code,+ description=tax_description,+ )def show_taxes_on_storefront(self, previous_value: bool) -> bool:if not self.active:diff --git a/saleor/plugins/avatax/tasks.py b/saleor/plugins/avatax/tasks.pyindex 0e58c1e8e0..8fecf5eef0 100644--- a/saleor/plugins/avatax/tasks.py+++ b/saleor/plugins/avatax/tasks.py@@ -10,7 +10,9 @@ logger = logging.getLogger(__name__)@app.task(- autoretry_for=(TaxError,), retry_backoff=60, retry_kwargs={"max_retries": 5},+ autoretry_for=(TaxError,),+ retry_backoff=60,+ retry_kwargs={"max_retries": 5},)def api_post_request_task(transaction_url, data, config, order_id):config = AvataxConfiguration(**config)diff --git a/saleor/plugins/avatax/tests/test_avatax.py b/saleor/plugins/avatax/tests/test_avatax.pyindex d546c2d8d8..a39bfe6c85 100644--- a/saleor/plugins/avatax/tests/test_avatax.py+++ b/saleor/plugins/avatax/tests/test_avatax.py@@ -362,7 +362,11 @@ def test_calculate_order_shipping(@pytest.mark.vcrdef test_calculate_order_line_unit(- order_line, shipping_zone, site_settings, address_usa, plugin_configuration,+ order_line,+ shipping_zone,+ site_settings,+ address_usa,+ plugin_configuration,):plugin_configuration()manager = get_plugins_manager(plugins=["saleor.plugins.avatax.plugin.AvataxPlugin"])@@ -667,7 +671,12 @@ def test_get_order_line_tax_rate(order.save()# when- tax_rate = manager.get_order_line_tax_rate(order, product, None, unit_price,)+ tax_rate = manager.get_order_line_tax_rate(+ order,+ product,+ None,+ unit_price,+ )# thenassert tax_rate == Decimal("0.055")@@ -689,7 +698,12 @@ def test_get_order_line_tax_rate_order_not_valid_default_value_returned(product = Product.objects.get(name=order_line.product_name)# when- tax_rate = manager.get_order_line_tax_rate(order, product, None, unit_price,)+ tax_rate = manager.get_order_line_tax_rate(+ order,+ product,+ None,+ unit_price,+ )# thenassert tax_rate == Decimal("0.25")@@ -718,7 +732,12 @@ def test_get_order_line_tax_rate_error_in_response(order.save()# when- tax_rate = manager.get_order_line_tax_rate(order, product, None, unit_price,)+ tax_rate = manager.get_order_line_tax_rate(+ order,+ product,+ None,+ unit_price,+ )# thenassert tax_rate == Decimal("0.25")@@ -853,7 +872,8 @@ def test_get_checkout_shipping_tax_rate_skip_plugin(lambda *_: {"error": "Example error"},)monkeypatch.setattr(- "saleor.plugins.avatax.plugin.AvataxPlugin._skip_plugin", lambda *_: True,+ "saleor.plugins.avatax.plugin.AvataxPlugin._skip_plugin",+ lambda *_: True,)shipping_price = TaxedMoney(Money(12, "USD"), Money(15, "USD"))@@ -970,7 +990,8 @@ def test_get_order_shipping_tax_rate_skip_plugin(lambda *_: {"error": "Example error"},)monkeypatch.setattr(- "saleor.plugins.avatax.plugin.AvataxPlugin._skip_plugin", lambda *_: True,+ "saleor.plugins.avatax.plugin.AvataxPlugin._skip_plugin",+ lambda *_: True,)shipping_price = TaxedMoney(Money(12, "USD"), Money(15, "USD"))@@ -1210,7 +1231,9 @@ def test_api_get_request_handles_request_errors(product, monkeypatch):monkeypatch.setattr("saleor.plugins.avatax.requests.get", mocked_response)config = AvataxConfiguration(- username_or_account="test", password_or_license="test", use_sandbox=False,+ username_or_account="test",+ password_or_license="test",+ use_sandbox=False,)url = "https://www.avatax.api.com/some-get-path"@@ -1227,7 +1250,9 @@ def test_api_get_request_handles_json_errors(product, monkeypatch):monkeypatch.setattr("saleor.plugins.avatax.requests.get", mocked_response)config = AvataxConfiguration(- username_or_account="test", password_or_license="test", use_sandbox=False,+ username_or_account="test",+ password_or_license="test",+ use_sandbox=False,)url = "https://www.avatax.api.com/some-get-path"@@ -1244,7 +1269,9 @@ def test_api_post_request_handles_request_errors(product, monkeypatch):monkeypatch.setattr("saleor.plugins.avatax.requests.post", mocked_response)config = AvataxConfiguration(- username_or_account="test", password_or_license="test", use_sandbox=False,+ username_or_account="test",+ password_or_license="test",+ use_sandbox=False,)url = "https://www.avatax.api.com/some-get-path"@@ -1259,7 +1286,9 @@ def test_api_post_request_handles_json_errors(product, monkeypatch):monkeypatch.setattr("saleor.plugins.avatax.requests.post", mocked_response)config = AvataxConfiguration(- username_or_account="test", password_or_license="test", use_sandbox=False,+ username_or_account="test",+ password_or_license="test",+ use_sandbox=False,)url = "https://www.avatax.api.com/some-get-path"@@ -1286,7 +1315,9 @@ def test_get_order_request_data_checks_when_taxes_are_included_to_price(order_with_lines.save()config = AvataxConfiguration(- username_or_account="", password_or_license="", use_sandbox=False,+ username_or_account="",+ password_or_license="",+ use_sandbox=False,)request_data = get_order_request_data(order_with_lines, config)lines_data = request_data["createTransactionModel"]["lines"]@@ -1312,7 +1343,9 @@ def test_get_order_request_data_checks_when_taxes_are_not_included_to_price(order_with_lines.save()config = AvataxConfiguration(- username_or_account="", password_or_license="", use_sandbox=False,+ username_or_account="",+ password_or_license="",+ use_sandbox=False,)request_data = get_order_request_data(order_with_lines, config)diff --git a/saleor/plugins/avatax/tests/test_tasks.py b/saleor/plugins/avatax/tests/test_tasks.pyindex 8eea49ea68..eecc08c5bc 100644--- a/saleor/plugins/avatax/tests/test_tasks.py+++ b/saleor/plugins/avatax/tests/test_tasks.py@@ -23,7 +23,9 @@ def test_api_post_request_task_sends_request(site_settings.save()config = AvataxConfiguration(- username_or_account="", password_or_license="", use_sandbox=False,+ username_or_account="",+ password_or_license="",+ use_sandbox=False,)request_data = get_order_request_data(order_with_lines, config)@@ -49,7 +51,9 @@ def test_api_post_request_task_creates_order_event(site_settings.save()config = AvataxConfiguration(- username_or_account="", password_or_license="", use_sandbox=False,+ username_or_account="",+ password_or_license="",+ use_sandbox=False,)request_data = get_order_request_data(order_with_lines, config)@@ -76,7 +80,9 @@ def test_api_post_request_task_missing_response()config = AvataxConfiguration(- username_or_account="test", password_or_license="test", use_sandbox=False,+ username_or_account="test",+ password_or_license="test",+ use_sandbox=False,)request_data = get_order_request_data(order_with_lines, config)@@ -104,7 +110,9 @@ def test_api_post_request_task_order_doesnt_have_any_lines_with_taxes_to_calcula)config = AvataxConfiguration(- username_or_account="test", password_or_license="test", use_sandbox=False,+ username_or_account="test",+ password_or_license="test",+ use_sandbox=False,)request_data = {}diff --git a/saleor/plugins/base_plugin.py b/saleor/plugins/base_plugin.pyindex d0f12cece1..d7adeecd1e 100644--- a/saleor/plugins/base_plugin.py+++ b/saleor/plugins/base_plugin.py@@ -19,10 +19,9 @@ from .models import PluginConfigurationif TYPE_CHECKING:# flake8: noqafrom ..account.models import Address, User- from ..core.taxes import TaxType+ from ..channel.models import Channelfrom ..checkout import CheckoutLineInfofrom ..checkout.models import Checkout, CheckoutLine- from ..channel.models import Channelfrom ..core.taxes import TaxTypefrom ..discount import DiscountInfofrom ..invoice.models import Invoice@@ -506,7 +505,9 @@ class BasePlugin:)def get_payment_gateway_for_checkout(- self, checkout: "Checkout", previous_value,+ self,+ checkout: "Checkout",+ previous_value,) -> Optional["PaymentGateway"]:return self.get_payment_gateway(checkout.currency, previous_value)diff --git a/saleor/plugins/manager.py b/saleor/plugins/manager.pyindex bc04219999..570ee8f7f2 100644--- a/saleor/plugins/manager.py+++ b/saleor/plugins/manager.py@@ -27,9 +27,9 @@ if TYPE_CHECKING:from ..payment.interface import (CustomerSource,GatewayResponse,+ InitializedPaymentResponse,PaymentData,PaymentGateway,- InitializedPaymentResponse,TokenConfig,)from ..product.models import (@@ -467,7 +467,10 @@ class PluginsManager(PaymentInterface):return Nonereturn self.__run_method_on_single_plugin(- gtw, method_name, previous_value=default_value, payment_data=payment_data,+ gtw,+ method_name,+ previous_value=default_value,+ payment_data=payment_data,)def authorize_payment(@@ -512,7 +515,9 @@ class PluginsManager(PaymentInterface):gtw = self.get_plugin(gateway)if gtw is not None:return self.__run_method_on_single_plugin(- gtw, method_name, previous_value=default_value,+ gtw,+ method_name,+ previous_value=default_value,)return default_value@@ -564,7 +569,8 @@ class PluginsManager(PaymentInterface):return gatewaysdef checkout_available_payment_gateways(- self, checkout: "Checkout",+ self,+ checkout: "Checkout",) -> List["PaymentGateway"]:payment_plugins = self.list_payment_plugin(active_only=True)gateways = []diff --git a/saleor/plugins/tests/sample_plugins.py b/saleor/plugins/tests/sample_plugins.pyindex 4b86a1ef17..c674b2bb44 100644--- a/saleor/plugins/tests/sample_plugins.py+++ b/saleor/plugins/tests/sample_plugins.py@@ -13,10 +13,10 @@ if TYPE_CHECKING:# flake8: noqafrom ...account.models import Addressfrom ...checkout import CheckoutLineInfo+ from ...checkout.models import Checkout, CheckoutLinefrom ...discount import DiscountInfo- from ...product.models import Product, ProductTypefrom ...order.models import Order- from ...checkout.models import Checkout, CheckoutLine+ from ...product.models import Product, ProductTypeclass PluginSample(BasePlugin):diff --git a/saleor/plugins/tests/test_manager.py b/saleor/plugins/tests/test_manager.pyindex 1d71b60034..7e29bef0c9 100644--- a/saleor/plugins/tests/test_manager.py+++ b/saleor/plugins/tests/test_manager.py@@ -187,7 +187,10 @@ def test_manager_get_order_line_tax_rate_sample_plugin(order_with_lines):plugins = ["saleor.plugins.tests.sample_plugins.PluginSample"]unit_price = TaxedMoney(Money(12, "USD"), Money(15, "USD"))tax_rate = PluginsManager(plugins=plugins).get_order_line_tax_rate(- order, product, None, unit_price,+ order,+ product,+ None,+ unit_price,)assert tax_rate == Decimal("0.08")@@ -206,7 +209,10 @@ def test_manager_get_order_line_tax_rate_no_plugins(line = order.lines.first()product = Product.objects.get(name=line.product_name)tax_rate = PluginsManager(plugins=[]).get_order_line_tax_rate(- order, product, None, unit_price,+ order,+ product,+ None,+ unit_price,)assert tax_rate == expected_tax_rate@@ -271,7 +277,8 @@ def test_manager_get_order_shipping_tax_rate_sample_plugin(order_with_lines):plugins = ["saleor.plugins.tests.sample_plugins.PluginSample"]shipping_price = TaxedMoney(Money(12, "USD"), Money(14, "USD"))tax_rate = PluginsManager(plugins=plugins).get_order_shipping_tax_rate(- order, shipping_price,+ order,+ shipping_price,)assert tax_rate == Decimal("0.08")@@ -288,7 +295,8 @@ def test_manager_get_order_shipping_tax_rate_no_plugins():order = order_with_linestax_rate = PluginsManager(plugins=[]).get_order_shipping_tax_rate(- order, shipping_price,+ order,+ shipping_price,)assert tax_rate == expected_tax_rate@@ -447,7 +455,10 @@ def test_manager_save_plugin_configuration(plugin_configuration):def test_plugin_updates_configuration_shape(- new_config, new_config_structure, plugin_configuration, monkeypatch,+ new_config,+ new_config_structure,+ plugin_configuration,+ monkeypatch,):config_structure = PluginSample.CONFIG_STRUCTURE.copy()@@ -470,11 +481,15 @@ def test_plugin_updates_configuration_shape(def test_plugin_add_new_configuration(- new_config, new_config_structure, monkeypatch,+ new_config,+ new_config_structure,+ monkeypatch,):monkeypatch.setattr(PluginInactive, "DEFAULT_ACTIVE", True)monkeypatch.setattr(- PluginInactive, "DEFAULT_CONFIGURATION", [new_config],+ PluginInactive,+ "DEFAULT_CONFIGURATION",+ [new_config],)config_structure = {"Foo": new_config_structure}monkeypatch.setattr(PluginInactive, "CONFIG_STRUCTURE", config_structure)diff --git a/saleor/plugins/vatlayer/plugin.py b/saleor/plugins/vatlayer/plugin.pyindex a0419acce4..92e0eec145 100644--- a/saleor/plugins/vatlayer/plugin.py+++ b/saleor/plugins/vatlayer/plugin.py@@ -33,14 +33,13 @@ if TYPE_CHECKING:from ...checkout import CheckoutLineInfofrom ...checkout.models import Checkout, CheckoutLinefrom ...discount import DiscountInfo+ from ...order.models import Order, OrderLinefrom ...product.models import (Collection,Product,ProductVariant,ProductVariantChannelListing,)- from ...account.models import Address- from ...order.models import OrderLine, Orderfrom ..models import PluginConfigurationdiff --git a/saleor/plugins/vatlayer/tests/test_vatlayer.py b/saleor/plugins/vatlayer/tests/test_vatlayer.pyindex 2416229af1..a978fbd539 100644--- a/saleor/plugins/vatlayer/tests/test_vatlayer.py+++ b/saleor/plugins/vatlayer/tests/test_vatlayer.py@@ -383,7 +383,8 @@ def test_save_plugin_configuration_cannot_be_enabled_without_config(settings):manager = get_plugins_manager()with pytest.raises(ValidationError):manager.save_plugin_configuration(- VatlayerPlugin.PLUGIN_ID, {"active": True},+ VatlayerPlugin.PLUGIN_ID,+ {"active": True},)@@ -400,7 +401,8 @@ def test_get_tax_rate_type_choices(vatlayer, settings, monkeypatch):"admission to entertainment events",]monkeypatch.setattr(- "saleor.plugins.vatlayer.plugin.get_tax_rate_types", lambda: expected_choices,+ "saleor.plugins.vatlayer.plugin.get_tax_rate_types",+ lambda: expected_choices,)settings.PLUGINS = ["saleor.plugins.vatlayer.plugin.VatlayerPlugin"]manager = get_plugins_manager()@@ -538,7 +540,11 @@ def test_skip_diabled_plugin(settings):def test_get_checkout_line_tax_rate(- site_settings, vatlayer, checkout_with_item, address, shipping_zone,+ site_settings,+ vatlayer,+ checkout_with_item,+ address,+ shipping_zone,):manager = get_plugins_manager(plugins=["saleor.plugins.vatlayer.plugin.VatlayerPlugin"]@@ -578,7 +584,9 @@ def test_get_checkout_line_tax_rate(def test_get_checkout_line_tax_rate_order_not_valid(- site_settings, vatlayer, checkout_with_item,+ site_settings,+ vatlayer,+ checkout_with_item,):manager = get_plugins_manager(plugins=["saleor.plugins.vatlayer.plugin.VatlayerPlugin"]@@ -614,7 +622,11 @@ def test_get_checkout_line_tax_rate_order_not_valid(def test_get_order_line_tax_rate(- site_settings, vatlayer, order_line, address, shipping_zone,+ site_settings,+ vatlayer,+ order_line,+ address,+ shipping_zone,):manager = get_plugins_manager(plugins=["saleor.plugins.vatlayer.plugin.VatlayerPlugin"]@@ -642,7 +654,9 @@ def test_get_order_line_tax_rate(def test_get_order_line_tax_rate_order_no_address_given(- site_settings, order_line, vatlayer,+ site_settings,+ order_line,+ vatlayer,):manager = get_plugins_manager(plugins=["saleor.plugins.vatlayer.plugin.VatlayerPlugin"]@@ -663,7 +677,11 @@ def test_get_order_line_tax_rate_order_no_address_given(def test_get_checkout_shipping_tax_rate(- site_settings, vatlayer, checkout_with_item, address, shipping_zone,+ site_settings,+ vatlayer,+ checkout_with_item,+ address,+ shipping_zone,):manager = get_plugins_manager(plugins=["saleor.plugins.vatlayer.plugin.VatlayerPlugin"]@@ -703,7 +721,9 @@ def test_get_checkout_shipping_tax_rate(def test_get_checkout_shipping_tax_rate_no_address(- site_settings, vatlayer, checkout_with_item,+ site_settings,+ vatlayer,+ checkout_with_item,):manager = get_plugins_manager(plugins=["saleor.plugins.vatlayer.plugin.VatlayerPlugin"]@@ -745,7 +765,8 @@ def test_get_checkout_shipping_tax_rate_skip_plugin(plugins=["saleor.plugins.vatlayer.plugin.VatlayerPlugin"])monkeypatch.setattr(- "saleor.plugins.vatlayer.plugin.VatlayerPlugin._skip_plugin", lambda *_: True,+ "saleor.plugins.vatlayer.plugin.VatlayerPlugin._skip_plugin",+ lambda *_: True,)checkout_with_item.shipping_address = address@@ -783,7 +804,11 @@ def test_get_checkout_shipping_tax_rate_skip_plugin(def test_get_order_shipping_tax_rate(- site_settings, vatlayer, order_line, address, shipping_zone,+ site_settings,+ vatlayer,+ order_line,+ address,+ shipping_zone,):manager = get_plugins_manager(plugins=["saleor.plugins.vatlayer.plugin.VatlayerPlugin"]@@ -811,7 +836,9 @@ def test_get_order_shipping_tax_rate(def test_get_order_shipping_tax_rate_no_address_given(- site_settings, order_line, vatlayer,+ site_settings,+ order_line,+ vatlayer,):manager = get_plugins_manager(plugins=["saleor.plugins.vatlayer.plugin.VatlayerPlugin"]@@ -842,7 +869,8 @@ def test_get_order_shipping_tax_rate_skip_plugin(plugins=["saleor.plugins.vatlayer.plugin.VatlayerPlugin"])monkeypatch.setattr(- "saleor.plugins.vatlayer.plugin.VatlayerPlugin._skip_plugin", lambda *_: True,+ "saleor.plugins.vatlayer.plugin.VatlayerPlugin._skip_plugin",+ lambda *_: True,)order = order_line.orderproduct = Product.objects.get(name=order_line.product_name)diff --git a/saleor/plugins/webhook/tests/test_webhook_protocols.py b/saleor/plugins/webhook/tests/test_webhook_protocols.pyindex cc136356ec..649168a7de 100644--- a/saleor/plugins/webhook/tests/test_webhook_protocols.py+++ b/saleor/plugins/webhook/tests/test_webhook_protocols.py@@ -24,7 +24,8 @@ def test_trigger_webhooks_with_aws_sqs(mocked_client_constructor = MagicMock(spec=boto3.client, return_value=mocked_client)monkeypatch.setattr(- "saleor.plugins.webhook.tasks.boto3.client", mocked_client_constructor,+ "saleor.plugins.webhook.tasks.boto3.client",+ mocked_client_constructor,)webhook.app.permissions.add(permission_manage_orders)@@ -70,7 +71,8 @@ def test_trigger_webhooks_with_aws_sqs_and_secret_key(mocked_client_constructor = MagicMock(spec=boto3.client, return_value=mocked_client)monkeypatch.setattr(- "saleor.plugins.webhook.tasks.boto3.client", mocked_client_constructor,+ "saleor.plugins.webhook.tasks.boto3.client",+ mocked_client_constructor,)webhook.app.permissions.add(permission_manage_orders)diff --git a/saleor/product/migrations/0113_auto_20200129_0717.py b/saleor/product/migrations/0113_auto_20200129_0717.pyindex 1d6066ec44..a68b37a708 100644--- a/saleor/product/migrations/0113_auto_20200129_0717.py+++ b/saleor/product/migrations/0113_auto_20200129_0717.py@@ -11,7 +11,9 @@ class Migration(migrations.Migration):operations = [migrations.AlterField(- model_name="attribute", name="name", field=models.CharField(max_length=255),+ model_name="attribute",+ name="name",+ field=models.CharField(max_length=255),),migrations.AlterField(model_name="attribute",@@ -29,7 +31,9 @@ class Migration(migrations.Migration):field=models.SlugField(max_length=255),),migrations.AlterField(- model_name="category", name="name", field=models.CharField(max_length=250),+ model_name="category",+ name="name",+ field=models.CharField(max_length=250),),migrations.AlterField(model_name="category",diff --git a/saleor/product/migrations/0114_auto_20200129_0815.py b/saleor/product/migrations/0114_auto_20200129_0815.pyindex 4097d11508..0c7be954a5 100644--- a/saleor/product/migrations/0114_auto_20200129_0815.py+++ b/saleor/product/migrations/0114_auto_20200129_0815.py@@ -55,7 +55,9 @@ class Migration(migrations.Migration):preserve_default=False,),migrations.AlterField(- model_name="product", name="name", field=models.CharField(max_length=250),+ model_name="product",+ name="name",+ field=models.CharField(max_length=250),),migrations.RunPython(create_unique_slug_for_products, migrations.RunPython.noopdiff --git a/saleor/product/migrations/0115_auto_20200221_0257.py b/saleor/product/migrations/0115_auto_20200221_0257.pyindex 15a6f1227b..934a61bdc3 100644--- a/saleor/product/migrations/0115_auto_20200221_0257.py+++ b/saleor/product/migrations/0115_auto_20200221_0257.py@@ -11,7 +11,9 @@ class Migration(migrations.Migration):operations = [migrations.RenameField(- model_name="attribute", old_name="meta", new_name="metadata",+ model_name="attribute",+ old_name="meta",+ new_name="metadata",),migrations.RenameField(model_name="attribute",@@ -19,13 +21,19 @@ class Migration(migrations.Migration):new_name="private_metadata",),migrations.RenameField(- model_name="category", old_name="meta", new_name="metadata",+ model_name="category",+ old_name="meta",+ new_name="metadata",),migrations.RenameField(- model_name="category", old_name="private_meta", new_name="private_metadata",+ model_name="category",+ old_name="private_meta",+ new_name="private_metadata",),migrations.RenameField(- model_name="collection", old_name="meta", new_name="metadata",+ model_name="collection",+ old_name="meta",+ new_name="metadata",),migrations.RenameField(model_name="collection",@@ -33,7 +41,9 @@ class Migration(migrations.Migration):new_name="private_metadata",),migrations.RenameField(- model_name="digitalcontent", old_name="meta", new_name="metadata",+ model_name="digitalcontent",+ old_name="meta",+ new_name="metadata",),migrations.RenameField(model_name="digitalcontent",@@ -41,13 +51,19 @@ class Migration(migrations.Migration):new_name="private_metadata",),migrations.RenameField(- model_name="product", old_name="meta", new_name="metadata",+ model_name="product",+ old_name="meta",+ new_name="metadata",),migrations.RenameField(- model_name="product", old_name="private_meta", new_name="private_metadata",+ model_name="product",+ old_name="private_meta",+ new_name="private_metadata",),migrations.RenameField(- model_name="producttype", old_name="meta", new_name="metadata",+ model_name="producttype",+ old_name="meta",+ new_name="metadata",),migrations.RenameField(model_name="producttype",@@ -55,7 +71,9 @@ class Migration(migrations.Migration):new_name="private_metadata",),migrations.RenameField(- model_name="productvariant", old_name="meta", new_name="metadata",+ model_name="productvariant",+ old_name="meta",+ new_name="metadata",),migrations.RenameField(model_name="productvariant",diff --git a/saleor/product/migrations/0116_auto_20200225_0237.py b/saleor/product/migrations/0116_auto_20200225_0237.pyindex 638c80f8a1..cd3001f630 100644--- a/saleor/product/migrations/0116_auto_20200225_0237.py+++ b/saleor/product/migrations/0116_auto_20200225_0237.py@@ -11,9 +11,11 @@ class Migration(migrations.Migration):operations = [migrations.AlterModelOptions(- name="producttype", options={"ordering": ("slug",)},+ name="producttype",+ options={"ordering": ("slug",)},),migrations.AlterModelOptions(- name="productvariant", options={"ordering": ("sku",)},+ name="productvariant",+ options={"ordering": ("sku",)},),]diff --git a/saleor/product/migrations/0118_populate_product_variant_price.py b/saleor/product/migrations/0118_populate_product_variant_price.pyindex 0788091415..ef5f272bff 100644--- a/saleor/product/migrations/0118_populate_product_variant_price.py+++ b/saleor/product/migrations/0118_populate_product_variant_price.py@@ -35,9 +35,13 @@ class Migration(migrations.Migration):field=models.DecimalField(decimal_places=2, max_digits=12),),migrations.RemoveField(- model_name="productvariant", name="price_override_amount",+ model_name="productvariant",+ name="price_override_amount",+ ),+ migrations.RemoveField(+ model_name="product",+ name="price_amount",),- migrations.RemoveField(model_name="product", name="price_amount",),migrations.AlterField(model_name="product",name="minimal_variant_price_amount",diff --git a/saleor/product/migrations/0119_auto_20200709_1102.py b/saleor/product/migrations/0119_auto_20200709_1102.pyindex cc0df69319..2c50f5bac9 100644--- a/saleor/product/migrations/0119_auto_20200709_1102.py+++ b/saleor/product/migrations/0119_auto_20200709_1102.py@@ -11,13 +11,16 @@ class Migration(migrations.Migration):operations = [migrations.AlterModelOptions(- name="attributeproduct", options={"ordering": ("sort_order", "pk")},+ name="attributeproduct",+ options={"ordering": ("sort_order", "pk")},),migrations.AlterModelOptions(- name="attributevalue", options={"ordering": ("sort_order", "pk")},+ name="attributevalue",+ options={"ordering": ("sort_order", "pk")},),migrations.AlterModelOptions(- name="attributevariant", options={"ordering": ("sort_order", "pk")},+ name="attributevariant",+ options={"ordering": ("sort_order", "pk")},),migrations.AlterModelOptions(name="product",@@ -27,6 +30,7 @@ class Migration(migrations.Migration):},),migrations.AlterModelOptions(- name="productimage", options={"ordering": ("sort_order", "pk")},+ name="productimage",+ options={"ordering": ("sort_order", "pk")},),]diff --git a/saleor/product/migrations/0123_auto_20200904_1251.py b/saleor/product/migrations/0123_auto_20200904_1251.pyindex ba7a9f94fa..4748edd29d 100644--- a/saleor/product/migrations/0123_auto_20200904_1251.py+++ b/saleor/product/migrations/0123_auto_20200904_1251.py@@ -17,7 +17,8 @@ def remove_variant_image_duplicates(apps, schema_editor):variant_image_ids_to_remove = []for image_data in duplicated_images:ids = VariantImage.objects.filter(- variant=image_data["variant_images__variant"], image__pk=image_data["pk"],+ variant=image_data["variant_images__variant"],+ image__pk=image_data["pk"],)[1:].values_list("pk", flat=True)variant_image_ids_to_remove += ids@@ -35,6 +36,7 @@ class Migration(migrations.Migration):remove_variant_image_duplicates, migrations.RunPython.noop),migrations.AlterUniqueTogether(- name="variantimage", unique_together={("variant", "image")},+ name="variantimage",+ unique_together={("variant", "image")},),]diff --git a/saleor/product/migrations/0125_auto_20200916_1511.py b/saleor/product/migrations/0125_auto_20200916_1511.pyindex 57007eb5f3..f97211763e 100644--- a/saleor/product/migrations/0125_auto_20200916_1511.py+++ b/saleor/product/migrations/0125_auto_20200916_1511.py@@ -11,7 +11,8 @@ class Migration(migrations.Migration):operations = [migrations.AlterModelOptions(- name="productvariant", options={"ordering": ("sort_order", "sku")},+ name="productvariant",+ options={"ordering": ("sort_order", "sku")},),migrations.AddField(model_name="productvariant",diff --git a/saleor/product/migrations/0133_product_variant_channel_listing.py b/saleor/product/migrations/0133_product_variant_channel_listing.pyindex ad17adf68b..615eabbfab 100644--- a/saleor/product/migrations/0133_product_variant_channel_listing.py+++ b/saleor/product/migrations/0133_product_variant_channel_listing.py@@ -55,7 +55,12 @@ class Migration(migrations.Migration):verbose_name="ID",),),- ("currency", models.CharField(max_length=3,),),+ (+ "currency",+ models.CharField(+ max_length=3,+ ),+ ),("price_amount", models.DecimalField(decimal_places=3, max_digits=12)),("channel",@@ -83,7 +88,16 @@ class Migration(migrations.Migration):options={"ordering": ("pk",), "unique_together": {("variant", "channel")}},),migrations.RunPython(migrate_variant_price_data),- migrations.RemoveField(model_name="productvariant", name="price_amount",),- migrations.RemoveField(model_name="productvariant", name="cost_price_amount",),- migrations.RemoveField(model_name="productvariant", name="currency",),+ migrations.RemoveField(+ model_name="productvariant",+ name="price_amount",+ ),+ migrations.RemoveField(+ model_name="productvariant",+ name="cost_price_amount",+ ),+ migrations.RemoveField(+ model_name="productvariant",+ name="currency",+ ),]diff --git a/saleor/product/migrations/0134_product_channel_listing.py b/saleor/product/migrations/0134_product_channel_listing.pyindex e576a47f7d..a33178a1be 100644--- a/saleor/product/migrations/0134_product_channel_listing.py+++ b/saleor/product/migrations/0134_product_channel_listing.py@@ -18,7 +18,8 @@ def migrate_products_publishable_data(apps, schema_editor):if not channel:name = f"Channel {currency}"channel, _ = Channel.objects.get_or_create(- currency_code=currency, defaults={"name": name, "slug": slugify(name)},+ currency_code=currency,+ defaults={"name": name, "slug": slugify(name)},)channels_dict[currency] = channelProductChannelListing.objects.create(@@ -74,7 +75,10 @@ class Migration(migrations.Migration):("discounted_price_amount",models.DecimalField(- blank=True, decimal_places=3, max_digits=12, null=True,+ blank=True,+ decimal_places=3,+ max_digits=12,+ null=True,),),("currency", models.CharField(max_length=3)),@@ -84,12 +88,28 @@ class Migration(migrations.Migration):options={"ordering": ("pk",), "unique_together": {("product", "channel")}},),migrations.RunPython(migrate_products_publishable_data),- migrations.RemoveField(model_name="product", name="is_published",),- migrations.RemoveField(model_name="product", name="publication_date",),- migrations.RemoveField(model_name="product", name="currency",),migrations.RemoveField(- model_name="product", name="minimal_variant_price_amount",+ model_name="product",+ name="is_published",+ ),+ migrations.RemoveField(+ model_name="product",+ name="publication_date",+ ),+ migrations.RemoveField(+ model_name="product",+ name="currency",+ ),+ migrations.RemoveField(+ model_name="product",+ name="minimal_variant_price_amount",+ ),+ migrations.RemoveField(+ model_name="product",+ name="visible_in_listings",+ ),+ migrations.RemoveField(+ model_name="product",+ name="available_for_purchase",),- migrations.RemoveField(model_name="product", name="visible_in_listings",),- migrations.RemoveField(model_name="product", name="available_for_purchase",),]diff --git a/saleor/product/migrations/0135_collection_channel_listing.py b/saleor/product/migrations/0135_collection_channel_listing.pyindex 224c874ff0..9464eee533 100644--- a/saleor/product/migrations/0135_collection_channel_listing.py+++ b/saleor/product/migrations/0135_collection_channel_listing.py@@ -16,7 +16,8 @@ def create_collection_channel_listing(apps, schema_editor):currency = os.environ.get("DEFAULT_CURRENCY", "USD")name = f"Channel {currency}"channel, _ = Channel.objects.get_or_create(- currency_code=currency, defaults={"name": name, "slug": slugify(name)},+ currency_code=currency,+ defaults={"name": name, "slug": slugify(name)},)for collection in Collection.objects.iterator():@@ -75,6 +76,12 @@ class Migration(migrations.Migration):migrations.RunPython(create_collection_channel_listing, migrations.RunPython.noop),- migrations.RemoveField(model_name="collection", name="is_published",),- migrations.RemoveField(model_name="collection", name="publication_date",),+ migrations.RemoveField(+ model_name="collection",+ name="is_published",+ ),+ migrations.RemoveField(+ model_name="collection",+ name="publication_date",+ ),]diff --git a/saleor/product/migrations/0136_add_attribute_type_and_page_to_attribute_relation.py b/saleor/product/migrations/0136_add_attribute_type_and_page_to_attribute_relation.pyindex dc7edd333e..af24ad202c 100644--- a/saleor/product/migrations/0136_add_attribute_type_and_page_to_attribute_relation.py+++ b/saleor/product/migrations/0136_add_attribute_type_and_page_to_attribute_relation.py@@ -27,7 +27,8 @@ class Migration(migrations.Migration):),),migrations.RunPython(- set_product_type_to_all_existing_attributes, migrations.RunPython.noop,+ set_product_type_to_all_existing_attributes,+ migrations.RunPython.noop,),migrations.AlterField(model_name="attribute",diff --git a/saleor/product/migrations/0137_drop_attribute_models.py b/saleor/product/migrations/0137_drop_attribute_models.pyindex ae1b6b793d..9f083ecf81 100644--- a/saleor/product/migrations/0137_drop_attribute_models.py+++ b/saleor/product/migrations/0137_drop_attribute_models.py@@ -12,62 +12,151 @@ class Migration(migrations.Migration):state_operations = [migrations.AlterUniqueTogether(- name="assignedproductattribute", unique_together=None,+ name="assignedproductattribute",+ unique_together=None,),migrations.RemoveField(- model_name="assignedproductattribute", name="assignment",+ model_name="assignedproductattribute",+ name="assignment",+ ),+ migrations.RemoveField(+ model_name="assignedproductattribute",+ name="product",+ ),+ migrations.RemoveField(+ model_name="assignedproductattribute",+ name="values",+ ),+ migrations.AlterUniqueTogether(+ name="assignedvariantattribute",+ unique_together=None,+ ),+ migrations.RemoveField(+ model_name="assignedvariantattribute",+ name="assignment",+ ),+ migrations.RemoveField(+ model_name="assignedvariantattribute",+ name="values",+ ),+ migrations.RemoveField(+ model_name="assignedvariantattribute",+ name="variant",+ ),+ migrations.RemoveField(+ model_name="attribute",+ name="page_types",+ ),+ migrations.RemoveField(+ model_name="attribute",+ name="product_types",+ ),+ migrations.RemoveField(+ model_name="attribute",+ name="product_variant_types",+ ),+ migrations.AlterUniqueTogether(+ name="attributepage",+ unique_together=None,+ ),+ migrations.RemoveField(+ model_name="attributepage",+ name="assigned_pages",+ ),+ migrations.RemoveField(+ model_name="attributepage",+ name="attribute",+ ),+ migrations.RemoveField(+ model_name="attributepage",+ name="page_type",),- migrations.RemoveField(model_name="assignedproductattribute", name="product",),- migrations.RemoveField(model_name="assignedproductattribute", name="values",),migrations.AlterUniqueTogether(- name="assignedvariantattribute", unique_together=None,+ name="attributeproduct",+ unique_together=None,+ ),+ migrations.RemoveField(+ model_name="attributeproduct",+ name="assigned_products",),migrations.RemoveField(- model_name="assignedvariantattribute", name="assignment",+ model_name="attributeproduct",+ name="attribute",+ ),+ migrations.RemoveField(+ model_name="attributeproduct",+ name="product_type",+ ),+ migrations.AlterUniqueTogether(+ name="attributetranslation",+ unique_together=None,),- migrations.RemoveField(model_name="assignedvariantattribute", name="values",),- migrations.RemoveField(model_name="assignedvariantattribute", name="variant",),- migrations.RemoveField(model_name="attribute", name="page_types",),- migrations.RemoveField(model_name="attribute", name="product_types",),- migrations.RemoveField(model_name="attribute", name="product_variant_types",),- migrations.AlterUniqueTogether(name="attributepage", unique_together=None,),- migrations.RemoveField(model_name="attributepage", name="assigned_pages",),- migrations.RemoveField(model_name="attributepage", name="attribute",),- migrations.RemoveField(model_name="attributepage", name="page_type",),- migrations.AlterUniqueTogether(name="attributeproduct", unique_together=None,),migrations.RemoveField(- model_name="attributeproduct", name="assigned_products",+ model_name="attributetranslation",+ name="attribute",),- migrations.RemoveField(model_name="attributeproduct", name="attribute",),- migrations.RemoveField(model_name="attributeproduct", name="product_type",),migrations.AlterUniqueTogether(- name="attributetranslation", unique_together=None,+ name="attributevalue",+ unique_together=None,+ ),+ migrations.RemoveField(+ model_name="attributevalue",+ name="attribute",+ ),+ migrations.AlterUniqueTogether(+ name="attributevaluetranslation",+ unique_together=None,+ ),+ migrations.RemoveField(+ model_name="attributevaluetranslation",+ name="attribute_value",),- migrations.RemoveField(model_name="attributetranslation", name="attribute",),- migrations.AlterUniqueTogether(name="attributevalue", unique_together=None,),- migrations.RemoveField(model_name="attributevalue", name="attribute",),migrations.AlterUniqueTogether(- name="attributevaluetranslation", unique_together=None,+ name="attributevariant",+ unique_together=None,),migrations.RemoveField(- model_name="attributevaluetranslation", name="attribute_value",+ model_name="attributevariant",+ name="assigned_variants",),- migrations.AlterUniqueTogether(name="attributevariant", unique_together=None,),migrations.RemoveField(- model_name="attributevariant", name="assigned_variants",+ model_name="attributevariant",+ name="attribute",+ ),+ migrations.RemoveField(+ model_name="attributevariant",+ name="product_type",+ ),+ migrations.DeleteModel(+ name="AssignedPageAttribute",+ ),+ migrations.DeleteModel(+ name="AssignedProductAttribute",+ ),+ migrations.DeleteModel(+ name="AssignedVariantAttribute",+ ),+ migrations.DeleteModel(+ name="Attribute",+ ),+ migrations.DeleteModel(+ name="AttributePage",+ ),+ migrations.DeleteModel(+ name="AttributeProduct",+ ),+ migrations.DeleteModel(+ name="AttributeTranslation",+ ),+ migrations.DeleteModel(+ name="AttributeValue",+ ),+ migrations.DeleteModel(+ name="AttributeValueTranslation",+ ),+ migrations.DeleteModel(+ name="AttributeVariant",),- migrations.RemoveField(model_name="attributevariant", name="attribute",),- migrations.RemoveField(model_name="attributevariant", name="product_type",),- migrations.DeleteModel(name="AssignedPageAttribute",),- migrations.DeleteModel(name="AssignedProductAttribute",),- migrations.DeleteModel(name="AssignedVariantAttribute",),- migrations.DeleteModel(name="Attribute",),- migrations.DeleteModel(name="AttributePage",),- migrations.DeleteModel(name="AttributeProduct",),- migrations.DeleteModel(name="AttributeTranslation",),- migrations.DeleteModel(name="AttributeValue",),- migrations.DeleteModel(name="AttributeValueTranslation",),- migrations.DeleteModel(name="AttributeVariant",),]operations = [diff --git a/saleor/product/tests/test_generate_and_set_variant_name.py b/saleor/product/tests/test_generate_and_set_variant_name.pyindex ca2134283b..4f0b071175 100644--- a/saleor/product/tests/test_generate_and_set_variant_name.py+++ b/saleor/product/tests/test_generate_and_set_variant_name.py@@ -19,7 +19,9 @@ def variant_with_no_attributes(category, channel_USD):name="Test product type", has_variants=True, is_shipping_required=True)product = Product.objects.create(- name="Test product", product_type=product_type, category=category,+ name="Test product",+ product_type=product_type,+ category=category,)variant = ProductVariant.objects.create(product=product, sku="123")ProductVariantChannelListing.objects.create(diff --git a/saleor/product/tests/test_product.py b/saleor/product/tests/test_product.pyindex af46c6b552..205529ac42 100644--- a/saleor/product/tests/test_product.py+++ b/saleor/product/tests/test_product.py@@ -114,7 +114,8 @@ def test_get_price(channel_USD,):product = models.Product.objects.create(- product_type=product_type, category=category,+ product_type=product_type,+ category=category,)variant = product.variants.create()channel_listing = models.ProductVariantChannelListing.objects.create(@@ -132,7 +133,9 @@ def test_product_get_price_do_not_charge_taxes(product_type, category, discount_info, channel_USD):product = models.Product.objects.create(- product_type=product_type, category=category, charge_taxes=False,+ product_type=product_type,+ category=category,+ charge_taxes=False,)variant = product.variants.create()channel_listing = models.ProductVariantChannelListing.objects.create(diff --git a/saleor/product/tests/test_product_minimal_variant_price.py b/saleor/product/tests/test_product_minimal_variant_price.pyindex 5df5708af3..8212889943 100644--- a/saleor/product/tests/test_product_minimal_variant_price.py+++ b/saleor/product/tests/test_product_minimal_variant_price.py@@ -49,7 +49,8 @@ def test_update_products_discounted_prices_of_catalogues_for_category():variant = product.variants.first()variant_channel_listing = variant.channel_listings.get(- channel=channel_USD, variant=variant,+ channel=channel_USD,+ variant=variant,)variant_channel_listing.price = Money("0.89", "USD")variant_channel_listing.save()@@ -69,7 +70,8 @@ def test_update_products_discounted_prices_of_catalogues_for_collection():variant = product.variants.first()variant_channel_listing = variant.channel_listings.get(- channel=channel_USD, variant=variant,+ channel=channel_USD,+ variant=variant,)variant_channel_listing.price = Money("0.79", "USD")product_channel_listing = product.channel_listings.get(channel_id=channel_USD.id)diff --git a/saleor/product/utils/__init__.py b/saleor/product/utils/__init__.pyindex 856a53948b..6d08ab1d4e 100644--- a/saleor/product/utils/__init__.py+++ b/saleor/product/utils/__init__.py@@ -12,8 +12,8 @@ if TYPE_CHECKING:from django.db.models.query import QuerySet- from ...order.models import OrderLine, Order- from ..models import Product, ProductVariant, Category+ from ...order.models import Order, OrderLine+ from ..models import Category, Product, ProductVariantdef calculate_revenue_for_variant(diff --git a/saleor/shipping/migrations/0019_remove_shippingmethod_meta.py b/saleor/shipping/migrations/0019_remove_shippingmethod_meta.pyindex f61ec2e015..ad40ed46e5 100644--- a/saleor/shipping/migrations/0019_remove_shippingmethod_meta.py+++ b/saleor/shipping/migrations/0019_remove_shippingmethod_meta.py@@ -10,5 +10,8 @@ class Migration(migrations.Migration):]operations = [- migrations.RemoveField(model_name="shippingmethod", name="meta",),+ migrations.RemoveField(+ model_name="shippingmethod",+ name="meta",+ ),]diff --git a/saleor/shipping/migrations/0022_shipping_method_channel_listing.py b/saleor/shipping/migrations/0022_shipping_method_channel_listing.pyindex 347753ff83..b390761c1e 100644--- a/saleor/shipping/migrations/0022_shipping_method_channel_listing.py+++ b/saleor/shipping/migrations/0022_shipping_method_channel_listing.py@@ -20,7 +20,8 @@ def create_shipping_method_channel_listing(apps, schema_editor):channel = channels_dict.get(currency)if not channel:channel, _ = Channel.objects.get_or_create(- currency_code=currency, defaults={"name": name, "slug": slugify(name)},+ currency_code=currency,+ defaults={"name": name, "slug": slugify(name)},)channels_dict[currency] = channelif shipping_method.type == "price":@@ -103,11 +104,19 @@ class Migration(migrations.Migration):),migrations.RunPython(create_shipping_method_channel_listing),migrations.RemoveField(- model_name="shippingmethod", name="maximum_order_price_amount",+ model_name="shippingmethod",+ name="maximum_order_price_amount",),migrations.RemoveField(- model_name="shippingmethod", name="minimum_order_price_amount",+ model_name="shippingmethod",+ name="minimum_order_price_amount",+ ),+ migrations.RemoveField(+ model_name="shippingmethod",+ name="price_amount",+ ),+ migrations.RemoveField(+ model_name="shippingmethod",+ name="currency",),- migrations.RemoveField(model_name="shippingmethod", name="price_amount",),- migrations.RemoveField(model_name="shippingmethod", name="currency",),]diff --git a/saleor/shipping/migrations/0024_shippingmethodzipcoderule.py b/saleor/shipping/migrations/0024_shippingmethodzipcoderule.pyindex f066cd3a7b..508f6bb3de 100644--- a/saleor/shipping/migrations/0024_shippingmethodzipcoderule.py+++ b/saleor/shipping/migrations/0024_shippingmethodzipcoderule.py@@ -34,6 +34,8 @@ class Migration(migrations.Migration):),),],- options={"unique_together": {("shipping_method", "start", "end")},}, # noqa+ options={+ "unique_together": {("shipping_method", "start", "end")},+ }, # noqa),]diff --git a/saleor/shipping/models.py b/saleor/shipping/models.pyindex 4f049227ee..f386578405 100644--- a/saleor/shipping/models.py+++ b/saleor/shipping/models.py@@ -251,7 +251,9 @@ class ShippingMethodChannelListing(models.Model):minimum_order_price = MoneyField(amount_field="minimum_order_price_amount", currency_field="currency")- currency = models.CharField(max_length=settings.DEFAULT_CURRENCY_CODE_LENGTH,)+ currency = models.CharField(+ max_length=settings.DEFAULT_CURRENCY_CODE_LENGTH,+ )maximum_order_price_amount = models.DecimalField(max_digits=settings.DEFAULT_MAX_DIGITS,decimal_places=settings.DEFAULT_DECIMAL_PLACES,diff --git a/saleor/shipping/tests/test_shipping.py b/saleor/shipping/tests/test_shipping.pyindex 19ccc7004b..f617b53133 100644--- a/saleor/shipping/tests/test_shipping.py+++ b/saleor/shipping/tests/test_shipping.py@@ -32,7 +32,9 @@ def test_applicable_shipping_methods_price(channel_USD,other_channel_USD,):- method = shipping_zone.shipping_methods.create(type=ShippingMethodType.PRICE_BASED,)+ method = shipping_zone.shipping_methods.create(+ type=ShippingMethodType.PRICE_BASED,+ )ShippingMethodChannelListing.objects.create(currency=channel_USD.currency_code,minimum_order_price_amount=min_price,@@ -95,7 +97,9 @@ def test_applicable_shipping_methods_weight(def test_applicable_shipping_methods_country_code_outside_shipping_zone(shipping_zone, channel_USD):- method = shipping_zone.shipping_methods.create(type=ShippingMethodType.PRICE_BASED,)+ method = shipping_zone.shipping_methods.create(+ type=ShippingMethodType.PRICE_BASED,+ )ShippingMethodChannelListing.objects.create(minimum_order_price=Money("1.0", "USD"),maximum_order_price=Money("10.0", "USD"),@@ -121,7 +125,8 @@ def test_applicable_shipping_methods_inproper_shipping_method_type(shipping method and the other way around."""price_method = shipping_zone.shipping_methods.create(- minimum_order_weight=Weight(kg=100), type=ShippingMethodType.WEIGHT_BASED,+ minimum_order_weight=Weight(kg=100),+ type=ShippingMethodType.WEIGHT_BASED,)weight_method = shipping_zone.shipping_methods.create(minimum_order_weight=Weight(kg=1),diff --git a/saleor/site/migrations/0026_remove_sitesettings_homepage_collection.py b/saleor/site/migrations/0026_remove_sitesettings_homepage_collection.pyindex 7fd9f48bfc..4dfe5f4727 100644--- a/saleor/site/migrations/0026_remove_sitesettings_homepage_collection.py+++ b/saleor/site/migrations/0026_remove_sitesettings_homepage_collection.py@@ -10,5 +10,8 @@ class Migration(migrations.Migration):]operations = [- migrations.RemoveField(model_name="sitesettings", name="homepage_collection",),+ migrations.RemoveField(+ model_name="sitesettings",+ name="homepage_collection",+ ),]diff --git a/saleor/site/migrations/0028_delete_authorizationkey.py b/saleor/site/migrations/0028_delete_authorizationkey.pyindex 033537b02f..656395b528 100644--- a/saleor/site/migrations/0028_delete_authorizationkey.py+++ b/saleor/site/migrations/0028_delete_authorizationkey.py@@ -10,5 +10,7 @@ class Migration(migrations.Migration):]operations = [- migrations.DeleteModel(name="AuthorizationKey",),+ migrations.DeleteModel(+ name="AuthorizationKey",+ ),]diff --git a/saleor/tests/fixtures.py b/saleor/tests/fixtures.pyindex 8724434fb3..9c298b5c22 100644--- a/saleor/tests/fixtures.py+++ b/saleor/tests/fixtures.py@@ -186,7 +186,9 @@ def setup_vatlayer(settings):settings.PLUGINS = ["saleor.plugins.vatlayer.plugin.VatlayerPlugin"]data = {"active": True,- "configuration": [{"name": "Access key", "value": "vatlayer_access_key"},],+ "configuration": [+ {"name": "Access key", "value": "vatlayer_access_key"},+ ],}PluginConfiguration.objects.create(identifier=VatlayerPlugin.PLUGIN_ID, **data)return settings@@ -326,7 +328,9 @@ def checkout_with_shipping_required(checkout_with_item, product):@pytest.fixturedef other_shipping_method(shipping_zone, channel_USD):method = ShippingMethod.objects.create(- name="DPD", type=ShippingMethodType.PRICE_BASED, shipping_zone=shipping_zone,+ name="DPD",+ type=ShippingMethodType.PRICE_BASED,+ shipping_zone=shipping_zone,)ShippingMethodChannelListing.objects.create(channel=channel_USD,@@ -605,7 +609,9 @@ def shipping_zone(db, channel_USD): # pylint: disable=W0613name="Europe", countries=[code for code, name in countries])method = shipping_zone.shipping_methods.create(- name="DHL", type=ShippingMethodType.PRICE_BASED, shipping_zone=shipping_zone,+ name="DHL",+ type=ShippingMethodType.PRICE_BASED,+ shipping_zone=shipping_zone,)ShippingMethodChannelListing.objects.create(channel=channel_USD,@@ -626,10 +632,14 @@ def shipping_zones(db, channel_USD, channel_PLN):])method = shipping_zone_poland.shipping_methods.create(- name="DHL", type=ShippingMethodType.PRICE_BASED, shipping_zone=shipping_zone,+ name="DHL",+ type=ShippingMethodType.PRICE_BASED,+ shipping_zone=shipping_zone,)second_method = shipping_zone_usa.shipping_methods.create(- name="DHL", type=ShippingMethodType.PRICE_BASED, shipping_zone=shipping_zone,+ name="DHL",+ type=ShippingMethodType.PRICE_BASED,+ shipping_zone=shipping_zone,)ShippingMethodChannelListing.objects.bulk_create([@@ -668,7 +678,9 @@ def shipping_zones(db, channel_USD, channel_PLN):def shipping_zone_without_countries(db, channel_USD): # pylint: disable=W0613shipping_zone = ShippingZone.objects.create(name="Europe", countries=[])method = shipping_zone.shipping_methods.create(- name="DHL", type=ShippingMethodType.PRICE_BASED, shipping_zone=shipping_zone,+ name="DHL",+ type=ShippingMethodType.PRICE_BASED,+ shipping_zone=shipping_zone,)ShippingMethodChannelListing.objects.create(channel=channel_USD,@@ -706,7 +718,9 @@ def shipping_method_excldued_by_zip_code(shipping_method):@pytest.fixturedef shipping_method_channel_PLN(shipping_zone, channel_PLN):method = ShippingMethod.objects.create(- name="DHL", type=ShippingMethodType.PRICE_BASED, shipping_zone=shipping_zone,+ name="DHL",+ type=ShippingMethodType.PRICE_BASED,+ shipping_zone=shipping_zone,)ShippingMethodChannelListing.objects.create(shipping_method=method,@@ -1111,7 +1125,9 @@ def product_with_collections(@pytest.fixturedef product_available_in_many_channels(product, channel_PLN):ProductChannelListing.objects.create(- product=product, channel=channel_PLN, is_published=True,+ product=product,+ channel=channel_PLN,+ is_published=True,)variant = product.variants.get()ProductVariantChannelListing.objects.create(@@ -1169,7 +1185,11 @@ def product_with_two_variants(product_type, category, warehouse, channel_USD):)variants = [- ProductVariant(product=product, sku=f"Product variant #{i}",) for i in (1, 2)+ ProductVariant(+ product=product,+ sku=f"Product variant #{i}",+ )+ for i in (1, 2)]ProductVariant.objects.bulk_create(variants)variants_channel_listing = [@@ -1185,7 +1205,11 @@ def product_with_two_variants(product_type, category, warehouse, channel_USD):ProductVariantChannelListing.objects.bulk_create(variants_channel_listing)Stock.objects.bulk_create([- Stock(warehouse=warehouse, product_variant=variant, quantity=10,)+ Stock(+ warehouse=warehouse,+ product_variant=variant,+ quantity=10,+ )for variant in variants])@@ -1267,7 +1291,10 @@ def product_with_variant_with_file_attribute(available_for_purchase=datetime.date(1999, 1, 1),)- variant = ProductVariant.objects.create(product=product, sku="prodVarTest",)+ variant = ProductVariant.objects.create(+ product=product,+ sku="prodVarTest",+ )ProductVariantChannelListing.objects.create(variant=variant,channel=channel_USD,@@ -1356,7 +1383,9 @@ def variant_without_inventory_tracking(available_for_purchase=datetime.date.today(),)variant = ProductVariant.objects.create(- product=product, sku="tracking123", track_inventory=False,+ product=product,+ sku="tracking123",+ track_inventory=False,)ProductVariantChannelListing.objects.create(variant=variant,@@ -1717,13 +1746,19 @@ def product_list_with_many_channels(product_list, channel_PLN):ProductChannelListing.objects.bulk_create([ProductChannelListing(- product=product_list[0], channel=channel_PLN, is_published=True,+ product=product_list[0],+ channel=channel_PLN,+ is_published=True,),ProductChannelListing(- product=product_list[1], channel=channel_PLN, is_published=True,+ product=product_list[1],+ channel=channel_PLN,+ is_published=True,),ProductChannelListing(- product=product_list[2], channel=channel_PLN, is_published=True,+ product=product_list[2],+ channel=channel_PLN,+ is_published=True,),])@@ -1805,7 +1840,10 @@ def unavailable_product_with_variant(product_type, category, warehouse, channel_variant_attr = product_type.variant_attributes.first()variant_attr_value = variant_attr.values.first()- variant = ProductVariant.objects.create(product=product, sku="123",)+ variant = ProductVariant.objects.create(+ product=product,+ sku="123",+ )ProductVariantChannelListing.objects.create(variant=variant,channel=channel_USD,@@ -1870,7 +1908,8 @@ def voucher_with_many_channels(voucher, channel_PLN):@pytest.fixturedef voucher_percentage(channel_USD):voucher = Voucher.objects.create(- code="saleor", discount_value_type=DiscountValueType.PERCENTAGE,+ code="saleor",+ discount_value_type=DiscountValueType.PERCENTAGE,)VoucherChannelListing.objects.create(voucher=voucher,@@ -2286,7 +2325,9 @@ def order_with_lines_channel_PLN(order.shipping_address = order.billing_address.get_copy()order.channel = channel_PLNshipping_method = shipping_method_channel_PLN- shipping_price = shipping_method.channel_listings.get(channel_id=channel_PLN.id,)+ shipping_price = shipping_method.channel_listings.get(+ channel_id=channel_PLN.id,+ )order.shipping_method_name = shipping_method.nameorder.shipping_method = shipping_method@@ -2659,7 +2700,9 @@ def permission_group_manage_users(permission_manage_users, staff_users):@pytest.fixturedef collection(db):collection = Collection.objects.create(- name="Collection", slug="collection", description="Test description",+ name="Collection",+ slug="collection",+ description="Test description",)return collection@@ -2667,7 +2710,9 @@ def collection(db):@pytest.fixturedef published_collection(db, channel_USD):collection = Collection.objects.create(- name="Collection USD", slug="collection-usd", description="Test description",+ name="Collection USD",+ slug="collection-usd",+ description="Test description",)CollectionChannelListing.objects.create(channel=channel_USD,@@ -2681,7 +2726,9 @@ def published_collection(db, channel_USD):@pytest.fixturedef published_collection_PLN(db, channel_PLN):collection = Collection.objects.create(- name="Collection PLN", slug="collection-pln", description="Test description",+ name="Collection PLN",+ slug="collection-pln",+ description="Test description",)CollectionChannelListing.objects.create(channel=channel_PLN,@@ -2708,7 +2755,9 @@ def unpublished_collection(db, channel_USD):@pytest.fixturedef unpublished_collection_PLN(db, channel_PLN):collection = Collection.objects.create(- name="Collection", slug="collection", description="Test description",+ name="Collection",+ slug="collection",+ description="Test description",)CollectionChannelListing.objects.create(channel=channel_PLN, collection=collection, is_published=False@@ -3072,7 +3121,9 @@ def digital_content(category, media_root, warehouse, channel_USD) -> DigitalContcurrency=channel_USD.currency_code,)Stock.objects.create(- product_variant=product_variant, warehouse=warehouse, quantity=5,+ product_variant=product_variant,+ warehouse=warehouse,+ quantity=5,)assert product_variant.is_digital()@@ -3415,7 +3466,8 @@ def allocations(order_list, stock, channel_USD):@pytest.fixturedef app_installation():app_installation = AppInstallation.objects.create(- app_name="External App", manifest_url="http://localhost:3000/manifest",+ app_name="External App",+ manifest_url="http://localhost:3000/manifest",)return app_installation@@ -3438,10 +3490,18 @@ def export_file_list(staff_user):ExportFile.objects.bulk_create([ExportFile(user=staff_user),- ExportFile(user=staff_user,),- ExportFile(user=staff_user, status=JobStatus.SUCCESS,),+ ExportFile(+ user=staff_user,+ ),+ ExportFile(+ user=staff_user,+ status=JobStatus.SUCCESS,+ ),ExportFile(user=staff_user, status=JobStatus.SUCCESS),- ExportFile(user=staff_user, status=JobStatus.FAILED,),+ ExportFile(+ user=staff_user,+ status=JobStatus.FAILED,+ ),]))diff --git a/saleor/warehouse/management.py b/saleor/warehouse/management.pyindex 17251620ff..7353f3cce1 100644--- a/saleor/warehouse/management.py+++ b/saleor/warehouse/management.py@@ -14,7 +14,9 @@ if TYPE_CHECKING:@transaction.atomicdef allocate_stock(- order_line: "OrderLine", country_code: str, quantity: int,+ order_line: "OrderLine",+ country_code: str,+ quantity: int,):"""Allocate stocks for given `order_line` in given country.@@ -32,7 +34,10 @@ def allocate_stock()quantity_allocation_list = list(- Allocation.objects.filter(stock__in=stocks, quantity_allocated__gt=0,)+ Allocation.objects.filter(+ stock__in=stocks,+ quantity_allocated__gt=0,+ ).values("stock").annotate(Sum("quantity_allocated")))@@ -82,7 +87,12 @@ def deallocate_stock(order_line: "OrderLine", quantity: int):"""allocations = (order_line.allocations.select_related("stock")- .select_for_update(of=("self", "stock",))+ .select_for_update(+ of=(+ "self",+ "stock",+ )+ ).order_by("stock__pk"))quantity_dealocated = 0diff --git a/saleor/warehouse/migrations/0002_auto_20200123_0036.py b/saleor/warehouse/migrations/0002_auto_20200123_0036.pyindex f7da98b6a8..7c056220c4 100644--- a/saleor/warehouse/migrations/0002_auto_20200123_0036.py+++ b/saleor/warehouse/migrations/0002_auto_20200123_0036.py@@ -21,6 +21,8 @@ class Migration(migrations.Migration):field=models.EmailField(blank=True, default="", max_length=254),),migrations.AlterField(- model_name="warehouse", name="name", field=models.CharField(max_length=255),+ model_name="warehouse",+ name="name",+ field=models.CharField(max_length=255),),]diff --git a/saleor/warehouse/migrations/0004_auto_20200129_0717.py b/saleor/warehouse/migrations/0004_auto_20200129_0717.pyindex 53c61a6d0d..742f943afd 100644--- a/saleor/warehouse/migrations/0004_auto_20200129_0717.py+++ b/saleor/warehouse/migrations/0004_auto_20200129_0717.py@@ -11,6 +11,8 @@ class Migration(migrations.Migration):operations = [migrations.AlterField(- model_name="warehouse", name="name", field=models.CharField(max_length=250),+ model_name="warehouse",+ name="name",+ field=models.CharField(max_length=250),),]diff --git a/saleor/warehouse/migrations/0007_auto_20200406_0341.py b/saleor/warehouse/migrations/0007_auto_20200406_0341.pyindex 74ebbd4ad7..b4d4155197 100644--- a/saleor/warehouse/migrations/0007_auto_20200406_0341.py+++ b/saleor/warehouse/migrations/0007_auto_20200406_0341.py@@ -48,7 +48,10 @@ class Migration(migrations.Migration):]operations = [- migrations.AlterModelOptions(name="stock", options={"ordering": ("pk",)},),+ migrations.AlterModelOptions(+ name="stock",+ options={"ordering": ("pk",)},+ ),migrations.CreateModel(name="Allocation",fields=[@@ -85,5 +88,8 @@ class Migration(migrations.Migration):},),migrations.RunPython(create_allocations),- migrations.RemoveField(model_name="stock", name="quantity_allocated",),+ migrations.RemoveField(+ model_name="stock",+ name="quantity_allocated",+ ),]diff --git a/saleor/warehouse/migrations/0010_auto_20200709_1102.py b/saleor/warehouse/migrations/0010_auto_20200709_1102.pyindex 9f119daa46..c9394e0d09 100644--- a/saleor/warehouse/migrations/0010_auto_20200709_1102.py+++ b/saleor/warehouse/migrations/0010_auto_20200709_1102.py@@ -11,6 +11,7 @@ class Migration(migrations.Migration):operations = [migrations.AlterModelOptions(- name="warehouse", options={"ordering": ("-slug",)},+ name="warehouse",+ options={"ordering": ("-slug",)},),]diff --git a/saleor/warehouse/tests/test_stock_management.py b/saleor/warehouse/tests/test_stock_management.pyindex 6b70d785b4..ee28882c59 100644--- a/saleor/warehouse/tests/test_stock_management.py+++ b/saleor/warehouse/tests/test_stock_management.py@@ -111,7 +111,9 @@ def test_deallocate_stock_partially(allocation):assert allocation.quantity_allocated == 30-def test_deallocate_stock_many_allocations(order_line_with_allocation_in_many_stocks,):+def test_deallocate_stock_many_allocations(+ order_line_with_allocation_in_many_stocks,+):order_line = order_line_with_allocation_in_many_stocksdeallocate_stock(order_line, 3)@@ -208,7 +210,9 @@ def test_decrease_stock_partially(allocation):assert allocation.quantity_allocated == 0-def test_decrease_stock_many_allocations(order_line_with_allocation_in_many_stocks,):+def test_decrease_stock_many_allocations(+ order_line_with_allocation_in_many_stocks,+):order_line = order_line_with_allocation_in_many_stocksallocations = order_line.allocations.all()warehouse_pk = allocations[1].stock.warehouse.pk@@ -236,7 +240,9 @@ def test_decrease_stock_many_allocations_partially(assert allocations[1].stock.quantity == 3-def test_decrease_stock_more_then_allocated(order_line_with_allocation_in_many_stocks,):+def test_decrease_stock_more_then_allocated(+ order_line_with_allocation_in_many_stocks,+):order_line = order_line_with_allocation_in_many_stocksallocations = order_line.allocations.all()warehouse_pk = allocations[0].stock.warehouse.pk@@ -253,7 +259,9 @@ def test_decrease_stock_more_then_allocated(order_line_with_allocation_in_many_sassert allocations[1].stock.quantity == 3-def test_deallocate_stock_for_order(order_line_with_allocation_in_many_stocks,):+def test_deallocate_stock_for_order(+ order_line_with_allocation_in_many_stocks,+):order_line = order_line_with_allocation_in_many_stocksorder = order_line.orderdiff --git a/saleor/webhook/migrations/0003_unmount_service_account.py b/saleor/webhook/migrations/0003_unmount_service_account.pyindex 8f90f50710..59839fde99 100644--- a/saleor/webhook/migrations/0003_unmount_service_account.py+++ b/saleor/webhook/migrations/0003_unmount_service_account.py@@ -11,7 +11,10 @@ class Migration(migrations.Migration):]state_operations = [- migrations.RemoveField(model_name="webhook", name="app",),+ migrations.RemoveField(+ model_name="webhook",+ name="app",+ ),]operations = [diff --git a/saleor/webhook/migrations/0005_drop_manage_webhooks_permission.py b/saleor/webhook/migrations/0005_drop_manage_webhooks_permission.pyindex 88c6ab714c..bf82f24ec2 100644--- a/saleor/webhook/migrations/0005_drop_manage_webhooks_permission.py+++ b/saleor/webhook/migrations/0005_drop_manage_webhooks_permission.py@@ -46,5 +46,8 @@ class Migration(migrations.Migration):operations = [migrations.RunPython(change_webhook_permission_to_app_permission),- migrations.AlterModelOptions(name="webhook", options={},),+ migrations.AlterModelOptions(+ name="webhook",+ options={},+ ),]