Skip to content

Saleor Core: the high performance, composable, headless commerce API.

Fix styling

Jakub Draganekb87c0ccc0faa
diff --git a/saleor/account/models.py b/saleor/account/models.py
index d5b5c9ab29..19f28a0cf7 100644
--- a/saleor/account/models.py
+++ b/saleor/account/models.py
@@ -190,12 +190,12 @@ class User(PermissionsMixin, AbstractBaseUser):
return self.email
def get_private_meta(self, label):
- if not label in self.private_meta:
+ if label not in self.private_meta:
return None
return self.private_meta[label]
def store_private_meta(self, label, key, value):
- if not label in self.private_meta:
+ if label not in self.private_meta:
self.private_meta[label] = {}
self.private_meta[label][str(key)] = str(value)
diff --git a/saleor/graphql/payment/schema.py b/saleor/graphql/payment/schema.py
index a342ffbe71..cfd944a2c6 100644
--- a/saleor/graphql/payment/schema.py
+++ b/saleor/graphql/payment/schema.py
@@ -32,8 +32,7 @@ class PaymentQueries(graphene.ObjectType):
def resolve_payment_client_token(self, _info, gateway=None):
if _info.context.user.is_authenticated:
return resolve_payment_client_token(gateway, user=_info.context.user)
- else:
- return resolve_payment_client_token(gateway)
+ return resolve_payment_client_token(gateway)
class PaymentMutations(graphene.ObjectType):
diff --git a/saleor/graphql/utils.py b/saleor/graphql/utils.py
index 21bacf9287..ec12b77ac4 100644
--- a/saleor/graphql/utils.py
+++ b/saleor/graphql/utils.py
@@ -154,14 +154,14 @@ def extract_id_for_payment_gateway(user, gateway):
gateway_meta = user.get_private_meta(label="gateways")
if not gateway_meta:
return None
- if not gateway in gateway_meta:
+ if gateway not in gateway_meta:
return None
gateway_config = gateway_meta[gateway]
- if not "customer_id" in gateway_config:
+ if "customer_id" not in gateway_config:
return None
return gateway_config["customer_id"]
-def store_id_for_payment_gateway(user, gateway, id):
- user.store_private_meta(user, label=gateway, key="customer_id", value=id)
+def store_id_for_payment_gateway(user, gateway, customer_id):
+ user.store_private_meta(user, label=gateway, key="customer_id", value=customer_id)
user.save()
diff --git a/tests/test_payment.py b/tests/test_payment.py
index d559384090..262e1fd03d 100644
--- a/tests/test_payment.py
+++ b/tests/test_payment.py
@@ -219,7 +219,8 @@ def test_gateway_get_client_token(get_payment_gateway_mock, gateway_config):
assert token == "client-token"
get_client_token_mock.assert_called_once_with(
- config=gateway_config, token_config=TokenConfig())
+ config=gateway_config, token_config=TokenConfig()
+ )
def test_gateway_get_client_token_not_allowed_gateway(settings):