Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Feb 4, 2025
1 parent 45e85f0 commit 0838f00
Show file tree
Hide file tree
Showing 20 changed files with 27 additions and 27 deletions.
2 changes: 1 addition & 1 deletion authentication/middleware.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,6 @@ def process_exception(self, request, exception):

if url: # noqa: RET503
url += (
"?" in url and "&" or "?"
("?" in url and "&") or "?"
) + f"message={quote(message)}&backend={backend_name}"
return redirect(url)
2 changes: 1 addition & 1 deletion authentication/pipeline/user_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def mock_create_user_strategy(mocker):


@pytest.fixture
def application(settings): # noqa: PT004
def application(settings):
"""Test data and settings needed for create_edx_user tests"""
settings.OPENEDX_API_BASE_URL = "http://example.com"

Expand Down
4 changes: 2 additions & 2 deletions cms/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -1226,7 +1226,7 @@ def get_context(self, request, *args, **kwargs):
sign_in_url = (
None
if request.user.is_authenticated
else f'{reverse("login")}?next={quote_plus(self.get_url())}'
else f"{reverse('login')}?next={quote_plus(self.get_url())}"
)
start_date = relevant_run.start_date if relevant_run else None
can_access_edx_course = (
Expand Down Expand Up @@ -1295,7 +1295,7 @@ def get_context(self, request, *args, **kwargs):
sign_in_url = (
None
if request.user.is_authenticated
else f'{reverse("login")}?next={quote_plus(self.get_url())}'
else f"{reverse('login')}?next={quote_plus(self.get_url())}"
)
start_date = None
can_access_edx_course = False
Expand Down
6 changes: 3 additions & 3 deletions cms/models_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -339,9 +339,9 @@ def test_flex_pricing_form_state_display(mocker, submission_status):
elif submission_status == FlexiblePriceStatus.DENIED:
assert "Application Denied" in response.rendered_content
elif submission_status == FlexiblePriceStatus.RESET:
assert (
"csrfmiddlewaretoken" in response.rendered_content
), response.rendered_content
assert "csrfmiddlewaretoken" in response.rendered_content, (
response.rendered_content
)


@pytest.mark.parametrize("course_or_program", [True, False])
Expand Down
4 changes: 2 additions & 2 deletions conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@


@pytest.fixture(autouse=True)
def default_settings(monkeypatch, settings): # noqa: PT004
def default_settings(monkeypatch, settings):
"""Set default settings for all tests"""
monkeypatch.setenv("DJANGO_SETTINGS_MODULE", "main.settings")

Expand All @@ -18,7 +18,7 @@ def default_settings(monkeypatch, settings): # noqa: PT004


@pytest.fixture(autouse=True)
def mocked_product_signal(mocker): # noqa: PT004
def mocked_product_signal(mocker):
"""Mock hubspot_sync signals"""
mocker.patch("ecommerce.signals.sync_hubspot_product")

Expand Down
2 changes: 1 addition & 1 deletion courses/management/commands/create_courseware.py
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ def handle(self, *args, **kwargs): # pylint: disable=unused-argument # noqa: C
):
self.stderr.write(
self.style.ERROR(
f"Object ID \"{kwargs['courseware_id']}\" would be named \"{kwargs['title']}\" - you might have your ID and title options swapped. Use --force to force creation anyway."
f'Object ID "{kwargs["courseware_id"]}" would be named "{kwargs["title"]}" - you might have your ID and title options swapped. Use --force to force creation anyway.'
)
)
exit(-1) # noqa: PLR1722
Expand Down
2 changes: 1 addition & 1 deletion ecommerce/api_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ def user(db):


@pytest.fixture(autouse=True)
def payment_gateway_settings(): # noqa: PT004
def payment_gateway_settings():
settings.MITOL_PAYMENT_GATEWAY_CYBERSOURCE_SECURITY_KEY = "Test Security Key"
settings.MITOL_PAYMENT_GATEWAY_CYBERSOURCE_ACCESS_KEY = "Test Access Key"
settings.MITOL_PAYMENT_GATEWAY_CYBERSOURCE_PROFILE_ID = uuid.uuid4()
Expand Down
2 changes: 1 addition & 1 deletion ecommerce/views_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ def user(db):


@pytest.fixture(autouse=True)
def payment_gateway_settings(): # noqa: PT004
def payment_gateway_settings():
settings.MITOL_PAYMENT_GATEWAY_CYBERSOURCE_SECURITY_KEY = "Test Security Key"
settings.MITOL_PAYMENT_GATEWAY_CYBERSOURCE_ACCESS_KEY = "Test Access Key"
settings.MITOL_PAYMENT_GATEWAY_CYBERSOURCE_PROFILE_ID = uuid.uuid4()
Expand Down
6 changes: 3 additions & 3 deletions fixtures/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,13 +131,13 @@ def user_profile_dict():


@pytest.fixture
def nplusone_fail(settings): # noqa: PT004
def nplusone_fail(settings):
"""Configures the nplusone app to raise errors"""
settings.NPLUSONE_RAISE = True


@pytest.fixture(autouse=True)
def webpack_stats(settings): # noqa: PT004
def webpack_stats(settings):
"""Mocks out webpack stats"""

directory = "scripts/test/data/webpack-stats/"
Expand All @@ -151,7 +151,7 @@ def webpack_stats(settings): # noqa: PT004


@pytest.fixture
def raise_nplusone(request): # noqa: PT004
def raise_nplusone(request):
if request.node.get_closest_marker("skip_nplusone"):
yield
else:
Expand Down
2 changes: 1 addition & 1 deletion flexiblepricing/management/commands/configure_tiers.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ def handle(self, *args, **kwargs): # pylint: disable=unused-argument # noqa: A
{
"tier": {"threshold": row["threshold"]},
"discount": {
"discount_code": f"{discount_abbrev}-fa-tier{idx+1}-{current_year}",
"discount_code": f"{discount_abbrev}-fa-tier{idx + 1}-{current_year}",
"discount_type": row["type"],
"amount": row["value"],
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class Command(BaseCommand):

def create_parser(self, prog_name, subcommand): # pylint: disable=arguments-differ
"""
create parser to add new line in help text.
Create parser to add new line in help text.
"""
parser = super().create_parser(prog_name, subcommand)
parser.formatter_class = RawTextHelpFormatter
Expand Down
2 changes: 1 addition & 1 deletion mail/api_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@


@pytest.fixture
def email_settings(settings): # noqa: PT004
def email_settings(settings):
"""Default settings for email tests"""
settings.MAILGUN_RECIPIENT_OVERRIDE = None

Expand Down
2 changes: 1 addition & 1 deletion main/tests/js_interop_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def test_js_settings(mocker, rf):

request = rf.get("/")
context = Context({"request": request})
template = Template("{% load js_interop %}" "{% js_settings %}")
template = Template("{% load js_interop %}{% js_settings %}")

rendered_template = template.render(context)
assert (
Expand Down
2 changes: 1 addition & 1 deletion openedx/management/commands/regenerate_edx_auth_tokens.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class Command(BaseCommand):

def create_parser(self, prog_name, subcommand): # pylint: disable=arguments-differ
"""
create parser to add new line in help text.
Create parser to add new line in help text.
"""
parser = super().create_parser(prog_name, subcommand)
parser.formatter_class = RawTextHelpFormatter
Expand Down
2 changes: 1 addition & 1 deletion users/management/commands/block_users.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class Command(BaseCommand):

def create_parser(self, prog_name, subcommand): # pylint: disable=arguments-differ
"""
create parser to add new line in help text.
Create parser to add new line in help text.
"""
parser = super().create_parser(prog_name, subcommand)
parser.formatter_class = RawTextHelpFormatter
Expand Down
4 changes: 2 additions & 2 deletions users/management/commands/create_user.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class Command(BaseCommand):

def create_parser(self, prog_name, subcommand): # pylint: disable=arguments-differ
"""
create parser to add new line in help text.
Create parser to add new line in help text.
"""
parser = super().create_parser(prog_name, subcommand)
parser.formatter_class = RawTextHelpFormatter
Expand Down Expand Up @@ -92,7 +92,7 @@ def handle(self, *args, **kwargs): # noqa: ARG002
validate_email_addresses([kwargs["email"]])

password = getpass(
f'Creating user {kwargs["username"]}. Please enter their new password: '
f"Creating user {kwargs['username']}. Please enter their new password: "
)

new_account = User.objects.create_user(
Expand Down
2 changes: 1 addition & 1 deletion users/management/commands/find_username_conflicts.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def make_normalized_username(self, username):

def create_parser(self, prog_name, subcommand): # pylint: disable=arguments-differ
"""
create parser to add new line in help text.
Create parser to add new line in help text.
"""
parser = super().create_parser(prog_name, subcommand)
parser.formatter_class = RawTextHelpFormatter
Expand Down
2 changes: 1 addition & 1 deletion users/management/commands/retire_users.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class Command(BaseCommand):

def create_parser(self, prog_name, subcommand): # pylint: disable=arguments-differ
"""
create parser to add new line in help text.
Create parser to add new line in help text.
"""
parser = super().create_parser(prog_name, subcommand)
parser.formatter_class = RawTextHelpFormatter
Expand Down
2 changes: 1 addition & 1 deletion users/management/commands/unblock_users.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class Command(BaseCommand):

def create_parser(self, prog_name, subcommand): # pylint: disable=arguments-differ
"""
create parser to add new line in help text.
Create parser to add new line in help text.
"""
parser = super().create_parser(prog_name, subcommand)
parser.formatter_class = RawTextHelpFormatter
Expand Down
2 changes: 1 addition & 1 deletion users/serializers_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@


@pytest.fixture
def application(settings): # noqa: PT004
def application(settings):
"""Test data and settings needed for create_edx_user tests"""
settings.OPENEDX_API_BASE_URL = "http://example.com"

Expand Down

0 comments on commit 0838f00

Please sign in to comment.