Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Use param-less super() where possible
Patryk Zawadzkia49e39ee9280
diff --git a/saleor/cart/forms.py b/saleor/cart/forms.pyindex 4c7e036ec2..de945402d9 100644--- a/saleor/cart/forms.py+++ b/saleor/cart/forms.py@@ -13,7 +13,7 @@ class QuantityField(forms.IntegerField):"""A specialized integer field with initial quantity and min/max values."""def __init__(self, **kwargs):- super(QuantityField, self).__init__(+ super().__init__(min_value=0, max_value=settings.MAX_CART_LINE_QUANTITY,initial=1, **kwargs)@@ -47,7 +47,7 @@ class AddToCartForm(forms.Form):self.cart = kwargs.pop('cart')self.product = kwargs.pop('product')self.discounts = kwargs.pop('discounts', ())- super(AddToCartForm, self).__init__(*args, **kwargs)+ super().__init__(*args, **kwargs)def clean(self):"""Clean the form.@@ -55,7 +55,7 @@ class AddToCartForm(forms.Form):Makes sure the total quantity in cart (taking into account what wasalready there) does not exceed available quantity."""- cleaned_data = super(AddToCartForm, self).clean()+ cleaned_data = super().clean()quantity = cleaned_data.get('quantity')if quantity is None:return cleaned_data@@ -105,7 +105,7 @@ class ReplaceCartLineForm(AddToCartForm):def __init__(self, *args, **kwargs):self.variant = kwargs.pop('variant')kwargs['product'] = self.variant.product- super(ReplaceCartLineForm, self).__init__(*args, **kwargs)+ super().__init__(*args, **kwargs)self.cart_line = self.cart.get_line(self.variant)self.fields['quantity'].widget.attrs = {'min': 1, 'max': settings.MAX_CART_LINE_QUANTITY}diff --git a/saleor/cart/models.py b/saleor/cart/models.pyindex fa98e5565e..a2adea3311 100644--- a/saleor/cart/models.py+++ b/saleor/cart/models.py@@ -119,7 +119,7 @@ class Cart(models.Model):def __init__(self, *args, **kwargs):self.discounts = kwargs.pop('discounts', None)- super(Cart, self).__init__(*args, **kwargs)+ super().__init__(*args, **kwargs)def update_quantity(self):"""Recalculate cart quantity based on lines."""@@ -292,7 +292,7 @@ class CartLine(models.Model, ItemLine):def get_total(self, **kwargs):"""Return the total price of this line."""- amount = super(CartLine, self).get_total(**kwargs)+ amount = super().get_total(**kwargs)return amount.quantize(CENTS)def get_quantity(self, **kwargs):diff --git a/saleor/checkout/forms.py b/saleor/checkout/forms.pyindex 4d11583673..b785be26d3 100644--- a/saleor/checkout/forms.py+++ b/saleor/checkout/forms.py@@ -27,7 +27,7 @@ class ShippingAddressesForm(forms.Form):def __init__(self, *args, **kwargs):additional_addresses = kwargs.pop('additional_addresses', [])- super(ShippingAddressesForm, self).__init__(*args, **kwargs)+ super().__init__(*args, **kwargs)address_field = self.fields['address']address_choices = [(address.id, str(address)) for address in additional_addresses]@@ -84,7 +84,7 @@ class ShippingMethodForm(forms.Form):required=True)def __init__(self, country_code, *args, **kwargs):- super(ShippingMethodForm, self).__init__(*args, **kwargs)+ super().__init__(*args, **kwargs)method_field = self.fields['method']if country_code:queryset = method_field.querysetdiff --git a/saleor/core/filters.py b/saleor/core/filters.pyindex e1641616cc..f2c1133c2b 100644--- a/saleor/core/filters.py+++ b/saleor/core/filters.py@@ -10,7 +10,7 @@ class SortedFilterSet(FilterSet):def __init__(self, data, *args, **kwargs):data_copy = data.copy() if data else Noneself.is_bound_unsorted = self.set_is_bound_unsorted(data_copy)- super(SortedFilterSet, self).__init__(data, *args, **kwargs)+ super().__init__(data, *args, **kwargs)def set_is_bound_unsorted(self, data_copy):if data_copy and data_copy.get('sort_by', None):diff --git a/saleor/core/forms.py b/saleor/core/forms.pyindex 781897a36a..d493c6db7e 100644--- a/saleor/core/forms.py+++ b/saleor/core/forms.py@@ -12,7 +12,7 @@ class AjaxSelect2ChoiceField(forms.ChoiceField):def __init__(self, fetch_data_url='', initial=None, *args, **kwargs):self.queryset = kwargs.pop('queryset')- super(AjaxSelect2ChoiceField, self).__init__(*args, **kwargs)+ super().__init__(*args, **kwargs)self.widget.attrs['class'] = 'enable-ajax-select2'self.widget.attrs['data-url'] = fetch_data_urlif initial:@@ -48,7 +48,7 @@ class AjaxSelect2MultipleChoiceField(forms.MultipleChoiceField):def __init__(self, fetch_data_url='', initial=[], *args, **kwargs):self.queryset = kwargs.pop('queryset')- super(AjaxSelect2MultipleChoiceField, self).__init__(*args, **kwargs)+ super().__init__(*args, **kwargs)self.widget.attrs['class'] = 'enable-ajax-select2'self.widget.attrs['data-url'] = fetch_data_urlif initial:diff --git a/saleor/core/storages.py b/saleor/core/storages.pyindex 780059a01e..ee39f433fb 100644--- a/saleor/core/storages.py+++ b/saleor/core/storages.py@@ -5,4 +5,4 @@ from storages.backends.s3boto3 import S3Boto3Storageclass S3MediaStorage(S3Boto3Storage):def __init__(self, *args, **kwargs):self.bucket_name = settings.AWS_MEDIA_BUCKET_NAME- super(S3MediaStorage, self).__init__(*args, **kwargs)+ super().__init__(*args, **kwargs)diff --git a/saleor/core/utils/form_renderer.py b/saleor/core/utils/form_renderer.pyindex 0690b3e2f1..5d4b798f30 100644--- a/saleor/core/utils/form_renderer.py+++ b/saleor/core/utils/form_renderer.py@@ -4,4 +4,4 @@ from bootstrap3.renderers import FormRenderer as BaseFormRendererclass FormRenderer(BaseFormRenderer):def render_errors(self, type='non_fields'):- return super(FormRenderer, self).render_errors(type)+ return super().render_errors(type)diff --git a/saleor/dashboard/category/forms.py b/saleor/dashboard/category/forms.pyindex c72283f02c..52b33caa03 100644--- a/saleor/dashboard/category/forms.py+++ b/saleor/dashboard/category/forms.py@@ -10,7 +10,7 @@ from ...product.models import Categoryclass CategoryForm(forms.ModelForm):def __init__(self, *args, **kwargs):self.parent_pk = kwargs.pop('parent_pk')- super(CategoryForm, self).__init__(*args, **kwargs)+ super().__init__(*args, **kwargs)self.fields['is_hidden'].label = pgettext_lazy('Category form field label', 'Hide in site navigation')if self.instance.parent and self.instance.parent.is_hidden:@@ -27,6 +27,6 @@ class CategoryForm(forms.ModelForm):Category, pk=self.parent_pk)if self.instance.parent and self.instance.parent.is_hidden:self.instance.is_hidden = True- super(CategoryForm, self).save(commit=commit)+ super().save(commit=commit)self.instance.set_is_hidden_descendants(self.cleaned_data['is_hidden'])return self.instancediff --git a/saleor/dashboard/discount/forms.py b/saleor/dashboard/discount/forms.pyindex 0c827e3fa2..47c8ac54b3 100644--- a/saleor/dashboard/discount/forms.py+++ b/saleor/dashboard/discount/forms.py@@ -23,12 +23,12 @@ class SaleForm(forms.ModelForm):exclude = []def __init__(self, *args, **kwargs):- super(SaleForm, self).__init__(*args, **kwargs)+ super().__init__(*args, **kwargs)if self.instance.pk:self.fields['products'].set_initial(self.instance.products.all())def clean(self):- cleaned_data = super(SaleForm, self).clean()+ cleaned_data = super().clean()discount_type = cleaned_data['type']value = cleaned_data['value']if discount_type == Sale.PERCENTAGE and value > 100:@@ -50,7 +50,7 @@ class VoucherForm(forms.ModelForm):if instance and instance.id is None and not initial.get('code'):initial['code'] = self._generate_codekwargs['initial'] = initial- super(VoucherForm, self).__init__(*args, **kwargs)+ super().__init__(*args, **kwargs)def _generate_code(self):while True:@@ -90,7 +90,7 @@ class ShippingVoucherForm(forms.ModelForm):def save(self, commit=True):self.instance.category = Noneself.instance.product = None- return super(ShippingVoucherForm, self).save(commit)+ return super().save(commit)class ValueVoucherForm(forms.ModelForm):@@ -109,7 +109,7 @@ class ValueVoucherForm(forms.ModelForm):self.instance.category = Noneself.instance.apply_to = Noneself.instance.product = None- return super(ValueVoucherForm, self).save(commit)+ return super().save(commit)class CommonVoucherForm(forms.ModelForm):@@ -119,7 +119,7 @@ class CommonVoucherForm(forms.ModelForm):choices=Voucher.APPLY_TO_PRODUCT_CHOICES, required=False)def __init__(self, *args, **kwargs):- super(CommonVoucherForm, self).__init__(*args, **kwargs)+ super().__init__(*args, **kwargs)def save(self, commit=True):self.instance.category = None@@ -131,7 +131,7 @@ class CommonVoucherForm(forms.ModelForm):if (self.instance.discount_value_type ==Voucher.DISCOUNT_VALUE_PERCENTAGE):self.instance.apply_to = None- return super(CommonVoucherForm, self).save(commit)+ return super().save(commit)class ProductVoucherForm(CommonVoucherForm):@@ -145,7 +145,7 @@ class ProductVoucherForm(CommonVoucherForm):fields = ['product', 'apply_to']def __init__(self, *args, **kwargs):- super(ProductVoucherForm, self).__init__(*args, **kwargs)+ super().__init__(*args, **kwargs)if self.instance.product:self.fields['product'].set_initial(self.instance.product)@@ -157,5 +157,5 @@ class CategoryVoucherForm(CommonVoucherForm):fields = ['category', 'apply_to']def __init__(self, *args, **kwargs):- super(CategoryVoucherForm, self).__init__(*args, **kwargs)+ super().__init__(*args, **kwargs)self.fields['category'].required = Truediff --git a/saleor/dashboard/order/forms.py b/saleor/dashboard/order/forms.pyindex b996cbeef8..c04c67eff3 100644--- a/saleor/dashboard/order/forms.py+++ b/saleor/dashboard/order/forms.py@@ -29,7 +29,7 @@ class OrderNoteForm(forms.ModelForm):}def __init__(self, *args, **kwargs):- super(OrderNoteForm, self).__init__(*args, **kwargs)+ super().__init__(*args, **kwargs)class ManagePaymentForm(forms.Form):@@ -42,7 +42,7 @@ class ManagePaymentForm(forms.Form):def __init__(self, *args, **kwargs):self.payment = kwargs.pop('payment')- super(ManagePaymentForm, self).__init__(*args, **kwargs)+ super().__init__(*args, **kwargs)def clean(self):if self.payment.status != self.clean_status:@@ -107,7 +107,7 @@ class MoveLinesForm(forms.Form):def __init__(self, *args, **kwargs):self.line = kwargs.pop('line')- super(MoveLinesForm, self).__init__(*args, **kwargs)+ super().__init__(*args, **kwargs)self.fields['quantity'].validators.append(MaxValueValidator(self.line.quantity))self.fields['quantity'].widget.attrs.update({@@ -133,7 +133,7 @@ class CancelLinesForm(forms.Form):def __init__(self, *args, **kwargs):self.line = kwargs.pop('line')- super(CancelLinesForm, self).__init__(*args, **kwargs)+ super().__init__(*args, **kwargs)def cancel_line(self):if self.line.stock:@@ -154,7 +154,7 @@ class ChangeQuantityForm(forms.ModelForm):fields = ['quantity']def __init__(self, *args, **kwargs):- super(ChangeQuantityForm, self).__init__(*args, **kwargs)+ super().__init__(*args, **kwargs)self.initial_quantity = self.instance.quantityself.fields['quantity'].initial = self.initial_quantity@@ -190,7 +190,7 @@ class ShipGroupForm(forms.ModelForm):fields = ['tracking_number']def __init__(self, *args, **kwargs):- super(ShipGroupForm, self).__init__(*args, **kwargs)+ super().__init__(*args, **kwargs)self.fields['tracking_number'].widget.attrs.update({'placeholder': pgettext_lazy('Ship group form field placeholder',@@ -222,7 +222,7 @@ class ShipGroupForm(forms.ModelForm):class CancelGroupForm(forms.Form):def __init__(self, *args, **kwargs):self.delivery_group = kwargs.pop('delivery_group')- super(CancelGroupForm, self).__init__(*args, **kwargs)+ super().__init__(*args, **kwargs)def cancel_group(self):cancel_delivery_group(self.delivery_group)@@ -232,10 +232,10 @@ class CancelOrderForm(forms.Form):def __init__(self, *args, **kwargs):self.order = kwargs.pop('order')- super(CancelOrderForm, self).__init__(*args, **kwargs)+ super().__init__(*args, **kwargs)def clean(self):- data = super(CancelOrderForm, self).clean()+ data = super().clean()if not self.order.can_cancel():raise forms.ValidationError(pgettext_lazy(@@ -251,10 +251,10 @@ class RemoveVoucherForm(forms.Form):def __init__(self, *args, **kwargs):self.order = kwargs.pop('order')- super(RemoveVoucherForm, self).__init__(*args, **kwargs)+ super().__init__(*args, **kwargs)def clean(self):- data = super(RemoveVoucherForm, self).clean()+ data = super().clean()if not self.order.voucher:raise forms.ValidationError(pgettext_lazy(@@ -298,7 +298,7 @@ class ChangeStockForm(forms.ModelForm):fields = ['stock']def __init__(self, *args, **kwargs):- super(ChangeStockForm, self).__init__(*args, **kwargs)+ super().__init__(*args, **kwargs)sku = self.instance.product_skuself.fields['stock'].queryset = Stock.objects.filter(variant__sku=sku)self.old_stock = self.instance.stock@@ -322,7 +322,7 @@ class ChangeStockForm(forms.ModelForm):self.instance.stock_location = (stock.location.name if stock.location else '')Stock.objects.allocate_stock(stock, quantity)- super(ChangeStockForm, self).save(commit)+ super().save(commit)merge_duplicates_into_order_line(self.instance)return self.instance@@ -340,11 +340,11 @@ class AddVariantToDeliveryGroupForm(forms.Form):def __init__(self, *args, **kwargs):self.group = kwargs.pop('group')- super(AddVariantToDeliveryGroupForm, self).__init__(*args, **kwargs)+ super().__init__(*args, **kwargs)def clean(self):""" Checks if given quantity is available in stocks. """- cleaned_data = super(AddVariantToDeliveryGroupForm, self).clean()+ cleaned_data = super().clean()variant = cleaned_data.get('variant')quantity = cleaned_data.get('quantity')if variant and quantity is not None:diff --git a/saleor/dashboard/product/forms.py b/saleor/dashboard/product/forms.pyindex 70ac05a339..76cdc0ad01 100644--- a/saleor/dashboard/product/forms.py+++ b/saleor/dashboard/product/forms.py@@ -17,7 +17,7 @@ class ProductClassSelectorForm(forms.Form):def __init__(self, *args, **kwargs):product_classes = kwargs.pop('product_classes', [])- super(ProductClassSelectorForm, self).__init__(*args, **kwargs)+ super().__init__(*args, **kwargs)choices = [(obj.pk, obj.name) for obj in product_classes]self.fields['product_cls'] = forms.ChoiceField(label=pgettext_lazy('Product class form label', 'Product type'),@@ -31,7 +31,7 @@ class StockForm(forms.ModelForm):def __init__(self, *args, **kwargs):self.variant = kwargs.pop('variant')- super(StockForm, self).__init__(*args, **kwargs)+ super().__init__(*args, **kwargs)def clean_location(self):location = self.cleaned_data['location']@@ -47,7 +47,7 @@ class StockForm(forms.ModelForm):def save(self, commit=True):self.instance.variant = self.variant- return super(StockForm, self).save(commit)+ return super().save(commit)class ProductClassForm(forms.ModelForm):@@ -63,7 +63,7 @@ class ProductClassForm(forms.ModelForm):'Attributes common to all variants')}def clean(self):- data = super(ProductClassForm, self).clean()+ data = super().clean()has_variants = self.cleaned_data['has_variants']product_attr = set(self.cleaned_data['product_attributes'])variant_attr = set(self.cleaned_data['variant_attributes'])@@ -107,7 +107,7 @@ class ProductForm(forms.ModelForm):def __init__(self, *args, **kwargs):self.product_attributes = []- super(ProductForm, self).__init__(*args, **kwargs)+ super().__init__(*args, **kwargs)self.fields['categories'].widget.attrs['data-placeholder'] = (pgettext_lazy('Product form placeholder', 'Search'))product_class = self.instance.product_class@@ -142,7 +142,7 @@ class ProductForm(forms.ModelForm):else:attributes[smart_text(attr.pk)] = valueself.instance.attributes = attributes- instance = super(ProductForm, self).save(commit=commit)+ instance = super().save(commit=commit)return instance@@ -152,7 +152,7 @@ class ProductVariantForm(forms.ModelForm):exclude = ['attributes', 'product', 'images']def __init__(self, *args, **kwargs):- super(ProductVariantForm, self).__init__(*args, **kwargs)+ super().__init__(*args, **kwargs)if self.instance.product.pk:self.fields['price_override'].widget.attrs['placeholder'] = self.instance.product.price.gross@@ -180,7 +180,7 @@ class VariantAttributeForm(forms.ModelForm):fields = []def __init__(self, *args, **kwargs):- super(VariantAttributeForm, self).__init__(*args, **kwargs)+ super().__init__(*args, **kwargs)attrs = self.instance.product.product_class.variant_attributes.all()self.available_attrs = attrs.prefetch_related('values')for attr in self.available_attrs:@@ -204,7 +204,7 @@ class VariantAttributeForm(forms.ModelForm):else:attributes[smart_text(attr.pk)] = valueself.instance.attributes = attributes- return super(VariantAttributeForm, self).save(commit=commit)+ return super().save(commit=commit)class VariantBulkDeleteForm(forms.Form):@@ -235,7 +235,7 @@ class ProductImageForm(forms.ModelForm):exclude = ('product', 'order')def __init__(self, *args, **kwargs):- super(ProductImageForm, self).__init__(*args, **kwargs)+ super().__init__(*args, **kwargs)if self.instance.image:self.fields['image'].widget = ImagePreviewWidget()@@ -248,7 +248,7 @@ class VariantImagesSelectForm(forms.Form):def __init__(self, *args, **kwargs):self.variant = kwargs.pop('variant')- super(VariantImagesSelectForm, self).__init__(*args, **kwargs)+ super().__init__(*args, **kwargs)self.fields['images'].queryset = self.variant.product.images.all()self.fields['images'].initial = self.variant.images.all()@@ -280,12 +280,12 @@ class AttributeChoiceValueForm(forms.ModelForm):def save(self, commit=True):self.instance.slug = slugify(self.instance.name)- return super(AttributeChoiceValueForm, self).save(commit=commit)+ return super().save(commit=commit)class OrderedModelMultipleChoiceField(forms.ModelMultipleChoiceField):def clean(self, value):- qs = super(OrderedModelMultipleChoiceField, self).clean(value)+ qs = super().clean(value)keys = list(map(int, value))return sorted(qs, key=lambda v: keys.index(v.pk))@@ -299,7 +299,7 @@ class ReorderProductImagesForm(forms.ModelForm):fields = ()def __init__(self, *args, **kwargs):- super(ReorderProductImagesForm, self).__init__(*args, **kwargs)+ super().__init__(*args, **kwargs)if self.instance:self.fields['ordered_images'].queryset = self.instance.images.all()@@ -317,7 +317,7 @@ class UploadImageForm(forms.ModelForm):def __init__(self, *args, **kwargs):product = kwargs.pop('product')- super(UploadImageForm, self).__init__(*args, **kwargs)+ super().__init__(*args, **kwargs)self.instance.product = productdiff --git a/saleor/dashboard/product/widgets.py b/saleor/dashboard/product/widgets.pyindex 27b261cecd..56a6ddf56b 100644--- a/saleor/dashboard/product/widgets.py+++ b/saleor/dashboard/product/widgets.py@@ -7,7 +7,7 @@ class ImagePreviewFileInput(ClearableFileInputWithImagePreview):template_name = 'dashboard/product/product_image/versatile_image.html'def get_context(self, name, value, attrs):- context = super(ImagePreviewFileInput, self).get_context(+ context = super().get_context(name, value, attrs)value = context['widget']['value']if value:@@ -23,4 +23,4 @@ class ImagePreviewWidget(SizedImageCenterpointWidgetMixIn, MultiWidget):def __init__(self, attrs=None):widgets = (ImagePreviewFileInput(attrs={'class': 'file-chooser'}),HiddenInput(attrs={'class': 'ppoi-input'}))- super(ImagePreviewWidget, self).__init__(widgets, attrs)+ super().__init__(widgets, attrs)diff --git a/saleor/dashboard/staff/forms.py b/saleor/dashboard/staff/forms.pyindex 1cedcce935..67a34f3cb9 100644--- a/saleor/dashboard/staff/forms.py+++ b/saleor/dashboard/staff/forms.py@@ -7,7 +7,7 @@ class StaffForm(forms.ModelForm):def __init__(self, *args, **kwargs):self.user = kwargs.pop('user', None)kwargs.update(initial={'is_staff': True})- super(StaffForm, self).__init__(*args, **kwargs)+ super().__init__(*args, **kwargs)if self.user == self.instance:self.fields['is_staff'].disabled = Trueself.fields['is_active'].disabled = Truediff --git a/saleor/discount/forms.py b/saleor/discount/forms.pyindex 3590b39e55..4bb2c9011b 100644--- a/saleor/discount/forms.py+++ b/saleor/discount/forms.py@@ -32,12 +32,12 @@ class CheckoutDiscountForm(forms.Form):if 'voucher' not in initial:initial['voucher'] = self.checkout.voucher_codekwargs['initial'] = initial- super(CheckoutDiscountForm, self).__init__(*args, **kwargs)+ super().__init__(*args, **kwargs)self.fields['voucher'].queryset = Voucher.objects.active(date=date.today())def clean(self):- cleaned_data = super(CheckoutDiscountForm, self).clean()+ cleaned_data = super().clean()if 'voucher' in cleaned_data:voucher = cleaned_data['voucher']try:diff --git a/saleor/discount/models.py b/saleor/discount/models.pyindex 683f9232f1..64b153e829 100644--- a/saleor/discount/models.py+++ b/saleor/discount/models.py@@ -23,7 +23,7 @@ class NotApplicable(ValueError):"""def __init__(self, msg, limit=None):- super(NotApplicable, self).__init__(msg)+ super().__init__(msg)self.limit = limitdiff --git a/saleor/order/forms.py b/saleor/order/forms.pyindex 0691c35688..b24c4adde6 100644--- a/saleor/order/forms.py+++ b/saleor/order/forms.py@@ -19,10 +19,10 @@ class PaymentDeleteForm(forms.Form):def __init__(self, *args, **kwargs):self.order = kwargs.pop('order')- super(PaymentDeleteForm, self).__init__(*args, **kwargs)+ super().__init__(*args, **kwargs)def clean(self):- cleaned_data = super(PaymentDeleteForm, self).clean()+ cleaned_data = super().clean()payment_id = cleaned_data.get('payment_id')waiting_payments = self.order.payments.filter(status=PaymentStatus.WAITING)@@ -45,5 +45,5 @@ class PaymentDeleteForm(forms.Form):class PasswordForm(SignupForm):def __init__(self, *args, **kwargs):- super(PasswordForm, self).__init__(*args, **kwargs)+ super().__init__(*args, **kwargs)self.fields['email'].widget = forms.HiddenInput()diff --git a/saleor/order/models.py b/saleor/order/models.pyindex 8e29687630..35eec048b4 100644--- a/saleor/order/models.py+++ b/saleor/order/models.py@@ -83,7 +83,7 @@ class Order(models.Model, ItemSet):def save(self, *args, **kwargs):if not self.token:self.token = str(uuid4())- return super(Order, self).save(*args, **kwargs)+ return super().save(*args, **kwargs)def get_lines(self):return OrderLine.objects.filter(delivery_group__order=self)@@ -170,7 +170,7 @@ class Order(models.Model, ItemSet):def get_subtotal_without_voucher(self):if self.get_lines():- return super(Order, self).get_total()+ return super().get_total()return Price(net=0, currency=settings.DEFAULT_CURRENCY)def get_total_shipping(self):@@ -217,14 +217,14 @@ class DeliveryGroup(models.Model, ItemSet):def __iter__(self):if self.id:return iter(self.lines.all())- return super(DeliveryGroup, self).__iter__()+ return super().__iter__()@propertydef shipping_required(self):return self.shipping_method_name is not Nonedef get_total(self, **kwargs):- subtotal = super(DeliveryGroup, self).get_total(**kwargs)+ subtotal = super().get_total(**kwargs)return subtotal + self.shipping_pricedef get_total_quantity(self):diff --git a/saleor/product/filters.py b/saleor/product/filters.pyindex 9ad4abf23f..e40ed925f0 100644--- a/saleor/product/filters.py+++ b/saleor/product/filters.py@@ -26,7 +26,7 @@ class ProductFilter(SortedFilterSet):def __init__(self, *args, **kwargs):self.category = kwargs.pop('category')- super(ProductFilter, self).__init__(*args, **kwargs)+ super().__init__(*args, **kwargs)self.product_attributes, self.variant_attributes = (self._get_attributes())self.filters.update(self._get_product_attributes_filters())diff --git a/saleor/product/forms.py b/saleor/product/forms.pyindex 057b0aff40..efcde3bd92 100644--- a/saleor/product/forms.py+++ b/saleor/product/forms.py@@ -25,7 +25,7 @@ class ProductForm(AddToCartForm):variant = VariantChoiceField(queryset=None)def __init__(self, *args, **kwargs):- super(ProductForm, self).__init__(*args, **kwargs)+ super().__init__(*args, **kwargs)variant_field = self.fields['variant']variant_field.queryset = self.product.variantsvariant_field.discounts = self.cart.discountsdiff --git a/saleor/product/models.py b/saleor/product/models.pyindex 8aec8a9047..99b339e650 100644--- a/saleor/product/models.py+++ b/saleor/product/models.py@@ -199,7 +199,7 @@ class Product(models.Model, ItemRange):self, self.price, discounts, **kwargs)return PriceRange(price, price)else:- return super(Product, self).get_price_range(+ return super().get_price_range(discounts=discounts, **kwargs)def get_gross_price_range(self, **kwargs):@@ -454,12 +454,12 @@ class ProductImage(models.Model):existing_max = qs.aggregate(Max('order'))existing_max = existing_max.get('order__max')self.order = 0 if existing_max is None else existing_max + 1- super(ProductImage, self).save(*args, **kwargs)+ super().save(*args, **kwargs)def delete(self, *args, **kwargs):qs = self.get_ordering_queryset()qs.filter(order__gt=self.order).update(order=F('order') - 1)- super(ProductImage, self).delete(*args, **kwargs)+ super().delete(*args, **kwargs)class VariantImage(models.Model):diff --git a/saleor/registration/forms.py b/saleor/registration/forms.pyindex f7ac59d83d..458103454f 100644--- a/saleor/registration/forms.py+++ b/saleor/registration/forms.py@@ -13,7 +13,7 @@ class LoginForm(django_forms.AuthenticationForm):label=pgettext('Form field', 'Email'), max_length=75)def __init__(self, request=None, *args, **kwargs):- super(LoginForm, self).__init__(request=request, *args, **kwargs)+ super().__init__(request=request, *args, **kwargs)if request:email = request.GET.get('email')if email:@@ -30,13 +30,13 @@ class SignupForm(forms.ModelForm):fields = ('email',)def __init__(self, *args, **kwargs):- super(SignupForm, self).__init__(*args, **kwargs)+ super().__init__(*args, **kwargs)if self._meta.model.USERNAME_FIELD in self.fields:self.fields[self._meta.model.USERNAME_FIELD].widget.attrs.update({'autofocus': ''})def save(self, request=None, commit=True):- user = super(SignupForm, self).save(commit=False)+ user = super().save(commit=False)password = self.cleaned_data['password']user.set_password(password)if commit:diff --git a/saleor/userprofile/forms.py b/saleor/userprofile/forms.pyindex fc9f83ebdc..733c918149 100644--- a/saleor/userprofile/forms.py+++ b/saleor/userprofile/forms.py@@ -37,7 +37,7 @@ def get_address_form(data, country_code, initial=None, instance=None, **kwargs):class ChangePasswordForm(django_forms.PasswordChangeForm):def __init__(self, *args, **kwargs):- super(ChangePasswordForm, self).__init__(*args, **kwargs)+ super().__init__(*args, **kwargs)self.fields['new_password1'].user = self.userself.fields['old_password'].widget.attrs['placeholder'] = ''self.fields['new_password1'].widget.attrs['placeholder'] = ''diff --git a/saleor/userprofile/i18n.py b/saleor/userprofile/i18n.pyindex d3d4784d0f..7b03ede600 100644--- a/saleor/userprofile/i18n.py+++ b/saleor/userprofile/i18n.py@@ -61,7 +61,7 @@ class AddressMetaForm(forms.ModelForm):fields = ['country', 'preview']def clean(self):- data = super(AddressMetaForm, self).clean()+ data = super().clean()if data.get('preview'):self.data = self.data.copy()self.data['preview'] = False@@ -94,7 +94,7 @@ class AddressForm(forms.ModelForm):def __init__(self, *args, **kwargs):autocomplete_type = kwargs.pop('autocomplete_type', None)- super(AddressForm, self).__init__(*args, **kwargs)+ super().__init__(*args, **kwargs)autocomplete_dict = defaultdict(lambda: 'off', self.AUTOCOMPLETE_MAPPING)for field_name, field in self.fields.items():@@ -149,7 +149,7 @@ class CountryAwareAddressForm(AddressForm):return datadef clean(self):- data = super(CountryAwareAddressForm, self).clean()+ data = super().clean()return self.validate_address(data)