Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Fix pydocstyle errors
fowczarekb7e7a7191916
diff --git a/saleor/checkout/models.py b/saleor/checkout/models.pyindex 966389f84f..6b3505429d 100644--- a/saleor/checkout/models.py+++ b/saleor/checkout/models.py@@ -123,7 +123,7 @@ class Checkout(models.Model):return max(total, ZERO_TAXED_MONEY)def get_total_gift_cards_balance(self):- """Return the total balance of the gift cards assigned to the checkout"""+ """Return the total balance of the gift cards assigned to the checkout."""gift_cards_total_balance = self.gift_cards.aggregate(models.Sum("current_balance"))["current_balance__sum"]diff --git a/saleor/checkout/utils.py b/saleor/checkout/utils.pyindex c6c353c88b..dd995230ab 100644--- a/saleor/checkout/utils.py+++ b/saleor/checkout/utils.py@@ -789,7 +789,8 @@ def recalculate_checkout_discount(checkout, discounts, taxes):def add_promo_code_to_checkout(checkout: Checkout, promo_code: str):"""Add gift card or voucher data to checkout.- Raise ValidationError if promo code does not match to any voucher or gift card."""+ Raise ValidationError if promo code does not match to any voucher or gift card.+ """if promo_code_is_voucher(promo_code):add_voucher_code_to_checkout(checkout, promo_code)elif promo_code_is_gift_card(promo_code):@@ -801,7 +802,8 @@ def add_promo_code_to_checkout(checkout: Checkout, promo_code: str):def add_voucher_code_to_checkout(checkout: Checkout, voucher_code: str):"""Add voucher data to checkout by code.- Raise ValidationError if voucher of given type cannot be applied."""+ Raise ValidationError if voucher of given type cannot be applied.+ """try:voucher = Voucher.objects.active(date=date.today()).get(code=voucher_code)except Voucher.DoesNotExist:@@ -817,7 +819,8 @@ def add_voucher_code_to_checkout(checkout: Checkout, voucher_code: str):def add_voucher_to_checkout(checkout: Checkout, voucher: Voucher):"""Add voucher data to checkout.- Raise NotApplicable if voucher of given type cannot be applied."""+ Raise NotApplicable if voucher of given type cannot be applied.+ """discount_amount = get_voucher_discount_for_checkout(voucher, checkout)checkout.voucher_code = voucher.codecheckout.discount_name = voucher.name@@ -844,7 +847,7 @@ def remove_promo_code_from_checkout(checkout: Checkout, promo_code: str):def remove_voucher_code_from_checkout(checkout: Checkout, voucher_code: str):- """Remove voucher data from checkout by code"""+ """Remove voucher data from checkout by code."""existing_voucher = get_voucher_for_checkout(checkout)if existing_voucher and existing_voucher.code == voucher_code:remove_voucher_from_checkout(checkout)diff --git a/saleor/giftcard/utils.py b/saleor/giftcard/utils.pyindex 4b245dbaaf..b18ea3d0de 100644--- a/saleor/giftcard/utils.py+++ b/saleor/giftcard/utils.py@@ -9,7 +9,8 @@ from .models import GiftCarddef add_gift_card_code_to_checkout(checkout: Checkout, promo_code: str):"""Add gift card data to checkout by code.- Raise ValidationError if gift card cannot be applied."""+ Raise ValidationError if gift card cannot be applied.+ """try:gift_card = GiftCard.objects.active(date=date.today()).get(code=promo_code)except GiftCard.DoesNotExist:@@ -18,21 +19,21 @@ def add_gift_card_code_to_checkout(checkout: Checkout, promo_code: str):def remove_gift_card_code_from_checkout(checkout: Checkout, gift_card_code: str):- """Remove gift card data from checkout by code"""+ """Remove gift card data from checkout by code."""gift_card = checkout.gift_cards.filter(code=gift_card_code).first()if gift_card:checkout.gift_cards.remove(gift_card)def deactivate_gift_card(gift_card: GiftCard):- """Set gift card status as inactive"""+ """Set gift card status as inactive."""if gift_card.is_active:gift_card.is_active = Falsegift_card.save(update_fields=["is_active"])def activate_gift_card(gift_card: GiftCard):- """Set gift card status as active"""+ """Set gift card status as active."""if not gift_card.is_active:gift_card.is_active = Truegift_card.save(update_fields=["is_active"])