Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Update the documentation to reflect the use of the black code style
NyanKiyoshi2a20e5b704e4
diff --git a/docs/architecture/events.rst b/docs/architecture/events.rstindex 7ec0934647..797f992abb 100644--- a/docs/architecture/events.rst+++ b/docs/architecture/events.rst@@ -90,8 +90,7 @@ To send an event, simply do the following:from saleor.order import events# returns an OrderEvent- events.note_added_event(- order=order, user=user, message='hello world!')+ events.note_added_event(order=order, user=user, message="hello world!")If now you want to send a 'sent email' event you would do the following:@@ -100,8 +99,10 @@ If now you want to send a 'sent email' event you would do the following:from saleor.order import eventsevents.email_sent_event(- order=order, user=user,- email_type=events.OrderEventsEmails.TRACKING_UPDATED)+ order=order,+ user=user,+ email_type=events.OrderEventsEmails.TRACKING_UPDATED,+ )Notice how we are providing the email type.diff --git a/docs/architecture/money.rst b/docs/architecture/money.rstindex 921d6b46bd..7abd379383 100644--- a/docs/architecture/money.rst+++ b/docs/architecture/money.rst@@ -22,7 +22,7 @@ Money and TaxedMoneyIn Saleor's codebase, money amounts exist either as `Money` or `TaxedMoney` instances.-`Money` is a type representing amount of money in specific currency: 100 USD is represented by `Money(100, 'USD')`.+`Money` is a type representing amount of money in specific currency: 100 USD is represented by `Money(100, "USD")`.This type doesn't hold any additional information useful for commerce but, unlike `Decimal`, it implements safeguards and checks for calculations and comparisons of monetary values.Money amounts are stored on model using `MoneyField` that provides its own safechecks on currency and precision of stored amount.diff --git a/docs/architecture/translations.rst b/docs/architecture/translations.rstindex 91f58b35a1..322a34b68d 100644--- a/docs/architecture/translations.rst+++ b/docs/architecture/translations.rst@@ -63,12 +63,15 @@ We will use ``ProductTranslation`` to store our translated properties, it requiclass ProductTranslation(models.Model):language_code = models.CharField(max_length=10)product = models.ForeignKey(- Product, related_name='translations', on_delete=models.CASCADE)+ Product,+ related_name="translations",+ on_delete=models.CASCADE,+ )name = models.CharField(max_length=128)description = models.CharField(max_length=256)class Meta:- unique_together = ('product', 'language_code')+ unique_together = ("product", "language_code").. note:: Don't forget to set ``unique_together`` on the ``product`` and ``language_code``, there should be only one translation per product per language.diff --git a/docs/guides/payments.rst b/docs/guides/payments.rstindex d14eb06d4c..4dc85d6ec4 100644--- a/docs/guides/payments.rst+++ b/docs/guides/payments.rst@@ -39,8 +39,8 @@ Example.. note::- All the below methods receive ``payment_information`` as a dataclass: ``PaymentData``.- Methods should return a response as a dataclass: ``GatewayResponse``.+ All the below methods receive ``payment_information`` as a dataclass: ``PaymentData``.+ Methods should return a response as a dataclass: ``GatewayResponse``.The description of the given structures can be found below.@@ -57,7 +57,8 @@ Exampledef authorize(payment_information: PaymentData,- connection_params: Dict) -> GatewayResponse:+ connection_params: Dict,+ ) -> GatewayResponse:# Handle connecting to the gateway and sending the auth request hereresponse = gateway.authorize(token=payment_information.token)@@ -86,7 +87,8 @@ Exampledef refund(payment_information: PaymentData,- **connection_params: Dict) -> GatewayResponse:+ **connection_params: Dict,+ ) -> GatewayResponse:# Handle connecting to the gateway and sending the refund request hereresponse = gateway.refund(token=payment_information.token)@@ -115,7 +117,8 @@ Exampledef capture(payment_information: PaymentData,- connection_params: Dict) -> GatewayResponse:+ connection_params: Dict,+ ) -> GatewayResponse:# Handle connecting to the gateway and sending the capture request hereresponse = gateway.capture(token=payment_information.token)@@ -144,7 +147,8 @@ Exampledef void(payment_information: PaymentData,- connection_params: Dict) -> GatewayResponse:+ connection_params: Dict,+ ) -> GatewayResponse:# Handle connecting to the gateway and sending the void request hereresponse = gateway.void(token=payment_information.token)@@ -173,7 +177,8 @@ Exampledef charge(payment_information: PaymentData,- connection_params: Dict) -> GatewayResponse:+ connection_params: Dict,+ ) -> GatewayResponse:# Handle connecting to the gateway and sending the charge request hereresponse = gateway.charge(@@ -206,7 +211,8 @@ Exampledef process_payment(payment_information: PaymentData,- connection_params: Dict) -> GatewayResponse:+ connection_params: Dict,+ ) -> GatewayResponse:# Authorize, update the token, then captureauthorize_response = authorize(@@ -348,7 +354,7 @@ Examplepayment_method_nonce = forms.CharField()def get_payment_token(self):- return self.cleaned_data['payment_method_nonce']+ return self.cleaned_data["payment_method_nonce"]Implement create_form(data, payment_information, connection_params)^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^@@ -365,7 +371,10 @@ Exampledef create_form(data, payment_information, connection_params):return BraintreePaymentForm(- data, payment_information, connection_params)+ data,+ payment_information,+ connection_params,+ )Implement TEMPLATE_PATH@@ -378,7 +387,7 @@ Example.. code-block:: python- TEMPLATE_PATH = 'order/payment/braintree.html'+ TEMPLATE_PATH = "order/payment/braintree.html"Add template^^^^^^^^^^^^@@ -393,13 +402,13 @@ Adding new payment gateway to the settings.. code-block:: pythonPAYMENT_GATEWAYS = {- 'braintree': {- 'module': 'saleor.payment.gateways.braintree',- 'connection_params': {- 'sandbox_mode': get_bool_from_env('BRAINTREE_SANDBOX_MODE', True),- 'merchant_id': os.environ.get('BRAINTREE_MERCHANT_ID'),- 'public_key': os.environ.get('BRAINTREE_PUBLIC_KEY'),- 'private_key': os.environ.get('BRAINTREE_PRIVATE_KEY')+ "braintree": {+ "module": "saleor.payment.gateways.braintree",+ "connection_params": {+ "sandbox_mode": get_bool_from_env("BRAINTREE_SANDBOX_MODE", True),+ "merchant_id": os.environ.get("BRAINTREE_MERCHANT_ID"),+ "public_key": os.environ.get("BRAINTREE_PUBLIC_KEY"),+ "private_key": os.environ.get("BRAINTREE_PRIVATE_KEY"),}}}@@ -440,4 +449,3 @@ TipsIn such case, you might want to charge the customer 70 dollars, but dueto gateway misconfiguration, he will be charged 70 euros.Such a situation should be handled, and adequate error should be thrown.-