Skip to content

Commit

Permalink
Replace pyupgrade with ruff
Browse files Browse the repository at this point in the history
  • Loading branch information
WhyNotHugo committed Aug 14, 2023
1 parent be79e8e commit 7ec34a7
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 14 deletions.
5 changes: 0 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,6 @@ repos:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
exclude: docs\/.*
- repo: https://github.com/asottile/pyupgrade
rev: v3.4.0
hooks:
- id: pyupgrade
args: [--py38-plus]
- repo: https://github.com/pre-commit/mirrors-mypy
rev: "v1.3.0"
hooks:
Expand Down
2 changes: 1 addition & 1 deletion payments/sagepay/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ def get_hidden_fields(self, payment):
if payment.billing_country_code == "US":
data["BillingState"] = payment.billing_country_area
data["DeliveryState"] = payment.billing_country_area
udata = "&".join("%s=%s" % kv for kv in data.items())
udata = "&".join("{}={}".format(*kv) for kv in data.items())
crypt = self.aes_enc(udata)
return {
"VPSProtocol": self._version,
Expand Down
4 changes: 2 additions & 2 deletions payments/sagepay/test_sagepay.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def setUp(self):
@patch("payments.sagepay.redirect")
def test_provider_raises_redirect_needed_on_success(self, mocked_redirect):
data = {"Status": "OK"}
data = "&".join("%s=%s" % kv for kv in data.items())
data = "&".join("{}={}".format(*kv) for kv in data.items())
with patch.object(SagepayProvider, "aes_dec", return_value=data):
self.provider.process_data(self.payment, MagicMock())
self.assertEqual(self.payment.status, PaymentStatus.CONFIRMED)
Expand All @@ -50,7 +50,7 @@ def test_provider_raises_redirect_needed_on_success(self, mocked_redirect):
@patch("payments.sagepay.redirect")
def test_provider_raises_redirect_needed_on_failure(self, mocked_redirect):
data = {"Status": ""}
data = "&".join("%s=%s" % kv for kv in data.items())
data = "&".join("{}={}".format(*kv) for kv in data.items())
with patch.object(SagepayProvider, "aes_dec", return_value=data):
self.provider.process_data(self.payment, MagicMock())
self.assertEqual(self.payment.status, PaymentStatus.REJECTED)
Expand Down
14 changes: 8 additions & 6 deletions payments/stripe/test_stripe.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,10 @@ def test_form_contains_stripe_script(self):
self.assertTrue(
'<script class="stripe-button" data-amount="10000" '
'data-currency="USD" data-description="payment" data-email="[email protected]" '
'data-image="" data-key="%s" data-name="%s" '
'src="https://checkout.stripe.com/checkout.js"></script>'
% (PUBLIC_KEY, store_name)
'data-image="" data-key="{}" data-name="{}" '
'src="https://checkout.stripe.com/checkout.js"></script>'.format(
PUBLIC_KEY, store_name
)
in str(form)
)

Expand All @@ -114,9 +115,10 @@ def test_form_contains_stripe_script_without_billing_email(self):
self.assertTrue(
'<script class="stripe-button" data-amount="10000" '
'data-currency="USD" data-description="payment" '
'data-image="" data-key="%s" data-name="%s" '
'src="https://checkout.stripe.com/checkout.js"></script>'
% (PUBLIC_KEY, store_name)
'data-image="" data-key="{}" data-name="{}" '
'src="https://checkout.stripe.com/checkout.js"></script>'.format(
PUBLIC_KEY, store_name
)
in str(form)
)

Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ select = [
"F",
"W",
"B",
"UP",
"C4",
]
target-version = "py38"
Expand Down

0 comments on commit 7ec34a7

Please sign in to comment.