Skip to content

Commit

Permalink
ruff
Browse files Browse the repository at this point in the history
  • Loading branch information
cp-at-mit committed Sep 10, 2024
1 parent 9ce6c75 commit 03d1c99
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 7 deletions.
3 changes: 2 additions & 1 deletion authentication/middleware.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from django.shortcuts import redirect
from social_core.exceptions import SocialAuthBaseException
from social_django.middleware import SocialAuthExceptionMiddleware
from urllib.parse import quote


class SocialAuthExceptionRedirectMiddleware(SocialAuthExceptionMiddleware):
Expand Down Expand Up @@ -30,5 +31,5 @@ def process_exception(self, request, exception):
if url: # noqa: RET503
url += (
"?" in url and "&" or "?"
) + f"message={urlquote(message)}&backend={backend_name}"
) + f"message={quote(message)}&backend={backend_name}"
return redirect(url)
2 changes: 1 addition & 1 deletion courses/views/v1/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
get_program_certificate_by_enrollment,
get_unenrollable_courses,
)
from ecommerce.models import FulfilledOrder, Order, OrderStatus, PendingOrder, Product
from ecommerce.models import FulfilledOrder, OrderStatus, PendingOrder, Product
from hubspot_sync.task_helpers import sync_hubspot_deal
from main import features
from main.constants import (
Expand Down
2 changes: 1 addition & 1 deletion ecommerce/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ class BaseOrderAdmin(fsm.FlowAdminMixin, TimestampedModelAdmin):
readonly_fields = ["reference_number"]
flow_state = OrderFlow.state

def get_transition_fields(self, request, obj, slug):
def get_transition_fields(self, request, obj, slug): # noqa: ARG002
return ["state"]

def get_object_flow(self, request, obj):
Expand Down
2 changes: 1 addition & 1 deletion ecommerce/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,7 @@ def _get_order_state(self):
return self.order.state

@state.on_success()
def _on_transition_success(self, descriptor, source, target, **kwargs):
def _on_transition_success(self, descriptor, source, target, **kwargs): # noqa: ARG002
self.order.save()

@state.transition(source=State.ANY, target=OrderStatus.CANCELED)
Expand Down
5 changes: 2 additions & 3 deletions flexiblepricing/api_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,8 @@
def test_parse_country_income_thresholds_no_header(tmp_path):
"""parse_country_income_thresholds should throw error if no header is found"""
path = tmp_path / "test.csv"
with open(path, "w"): # create a file # noqa: SIM115, PTH123
with pytest.raises(CountryIncomeThresholdException) as exc:
parse_country_income_thresholds(path)
with open(path, "w"), pytest.raises(CountryIncomeThresholdException) as exc: # create a file # noqa: SIM115, PTH123
parse_country_income_thresholds(path)

assert exc.value.args[0] == "Unable to find the header row"

Expand Down

0 comments on commit 03d1c99

Please sign in to comment.