Skip to content

Commit

Permalink
chore(deps): update dependency ruff to ^0.4.0 (#2962)
Browse files Browse the repository at this point in the history
* chore(deps): update dependency ruff to ^0.4.0

* fix: update ruff.lint in pyproject.toml

* lint: format using ruff after update

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Asad Ali <[email protected]>
  • Loading branch information
renovate[bot] and asadali145 authored May 2, 2024
1 parent 76cef60 commit 9f01d9b
Show file tree
Hide file tree
Showing 252 changed files with 323 additions and 59 deletions.
1 change: 1 addition & 0 deletions affiliate/api.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Affiliate tracking logic"""

from affiliate.constants import AFFILIATE_QS_PARAM
from affiliate.models import Affiliate
from mitxpro.utils import first_or_none
Expand Down
1 change: 1 addition & 0 deletions affiliate/api_test.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Affiliate tracking logic"""

import pytest
from django.test.client import RequestFactory

Expand Down
1 change: 1 addition & 0 deletions affiliate/apps.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Apps config for affiliate tracking"""

from django.apps import AppConfig


Expand Down
1 change: 1 addition & 0 deletions affiliate/middleware.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Middleware for affiliate tracking"""

from affiliate.api import get_affiliate_code_from_qstring
from affiliate.constants import AFFILIATE_CODE_SESSION_KEY

Expand Down
1 change: 1 addition & 0 deletions affiliate/middleware_test.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Affiliate middleware tests"""

from django.contrib.sessions.middleware import SessionMiddleware
from django.test.client import RequestFactory

Expand Down
1 change: 1 addition & 0 deletions affiliate/models.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Model definitions for affiliate tracking"""

from django.conf import settings
from django.db import models

Expand Down
1 change: 1 addition & 0 deletions authentication/api.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Authentication api"""

from importlib import import_module

from django.conf import settings
Expand Down
1 change: 1 addition & 0 deletions authentication/api_test.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""API tests"""

import pytest
from django.db import IntegrityError

Expand Down
1 change: 1 addition & 0 deletions authentication/apps.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Authentication Apps"""

from django.apps import AppConfig


Expand Down
1 change: 1 addition & 0 deletions authentication/exceptions.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Authentication exceptions"""

from social_core.exceptions import AuthException


Expand Down
1 change: 1 addition & 0 deletions authentication/middleware.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Authentication middleware"""

from urllib.parse import quote

from django.shortcuts import redirect
Expand Down
1 change: 1 addition & 0 deletions authentication/middleware_test.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Tests for auth middleware"""

from urllib.parse import quote

from django.contrib.sessions.middleware import SessionMiddleware
Expand Down
1 change: 1 addition & 0 deletions authentication/pipeline/compliance.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Compliance pipeline actions"""

import logging

import pycountry
Expand Down
1 change: 1 addition & 0 deletions authentication/pipeline/compliance_test.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Compliance pipeline tests"""

import pytest
from social_core.exceptions import AuthException

Expand Down
1 change: 1 addition & 0 deletions authentication/pipeline/user.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Auth pipline functions for user authentication"""

import json
import logging

Expand Down
1 change: 1 addition & 0 deletions authentication/serializers.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Authentication serializers"""

import logging

from django.contrib.auth import get_user_model
Expand Down
1 change: 1 addition & 0 deletions authentication/serializers_test.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Serializers tests"""

import pytest
from rest_framework.serializers import ValidationError
from social_core.backends.email import EmailAuth
Expand Down
1 change: 1 addition & 0 deletions authentication/strategy.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Custom strategy"""

from social_django.strategy import DjangoStrategy


Expand Down
1 change: 1 addition & 0 deletions authentication/strategy_test.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Tests for the strategy"""

from django.http import HttpRequest
from rest_framework.request import Request

Expand Down
1 change: 1 addition & 0 deletions authentication/urls.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""URL configurations for authentication"""

from django.urls import path
from django.urls.conf import include

Expand Down
1 change: 1 addition & 0 deletions authentication/utils.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Authentication utils"""

import hashlib

from social_core.utils import get_strategy
Expand Down
1 change: 1 addition & 0 deletions authentication/utils_test.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Utils tests"""

from authentication.strategy import DjangoRestFrameworkStrategy
from authentication.utils import load_drf_strategy

Expand Down
1 change: 1 addition & 0 deletions authentication/views.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Authentication views"""

from urllib.parse import quote, urlencode, urljoin, urlparse

import requests
Expand Down
43 changes: 26 additions & 17 deletions authentication/views_test.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Tests for authentication views"""

from contextlib import ExitStack, contextmanager
from unittest.mock import patch

Expand Down Expand Up @@ -105,9 +106,10 @@ def noop():
@contextmanager
def export_check_response(response_name):
"""Context manager for configuring export check responses"""
with override_settings(
**get_cybersource_test_settings()
), responses.RequestsMock() as mocked_responses:
with (
override_settings(**get_cybersource_test_settings()),
responses.RequestsMock() as mocked_responses,
):
mock_cybersource_wsdl(mocked_responses, settings)
mock_cybersource_wsdl_operation(mocked_responses, response_name)
yield
Expand Down Expand Up @@ -264,14 +266,15 @@ def register_email_exists(self, recaptcha_enabled):
def register_email_not_exists_with_recaptcha_invalid(self):
"""Yield a function for this step"""
self.flow_started = True
with patch(
"authentication.views.requests.post",
return_value=MockResponse(
content='{"success": false, "error-codes": ["bad-request"]}',
status_code=status.HTTP_200_OK,
),
) as mock_recaptcha_failure, override_settings(
**{"RECAPTCHA_SITE_KEY": "fakse"}
with (
patch(
"authentication.views.requests.post",
return_value=MockResponse(
content='{"success": false, "error-codes": ["bad-request"]}',
status_code=status.HTTP_200_OK,
),
) as mock_recaptcha_failure,
override_settings(**{"RECAPTCHA_SITE_KEY": "fakse"}),
):
assert_api_call(
self.client,
Expand Down Expand Up @@ -449,9 +452,12 @@ def login_password_user_inactive(self, auth_state, verify_exports):
@rule(auth_state=consumes(LoginPasswordAuthStates))
def login_password_exports_temporary_error(self, auth_state):
"""Login for a user who hasn't been OFAC verified yet"""
with override_settings(**get_cybersource_test_settings()), patch(
"authentication.pipeline.compliance.api.verify_user_with_exports",
side_effect=Exception("register_details_export_temporary_error"),
with (
override_settings(**get_cybersource_test_settings()),
patch(
"authentication.pipeline.compliance.api.verify_user_with_exports",
side_effect=Exception("register_details_export_temporary_error"),
),
):
assert_api_call(
self.client,
Expand Down Expand Up @@ -646,9 +652,12 @@ def register_details_export_reject(self, auth_state):
@rule(auth_state=consumes(ConfirmationRedeemedAuthStates))
def register_details_export_temporary_error(self, auth_state):
"""Complete the register confirmation details page with exports raising a temporary error"""
with override_settings(**get_cybersource_test_settings()), patch(
"authentication.pipeline.compliance.api.verify_user_with_exports",
side_effect=Exception("register_details_export_temporary_error"),
with (
override_settings(**get_cybersource_test_settings()),
patch(
"authentication.pipeline.compliance.api.verify_user_with_exports",
side_effect=Exception("register_details_export_temporary_error"),
),
):
assert_api_call(
self.client,
Expand Down
1 change: 1 addition & 0 deletions b2b_ecommerce/admin_test.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Tests for admin interface for b2b_ecommerce"""

import pytest

from b2b_ecommerce.admin import B2BCouponAdmin, B2BOrderAdmin
Expand Down
1 change: 1 addition & 0 deletions b2b_ecommerce/api.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Functions for b2b_ecommerce"""

import uuid
from decimal import Decimal

Expand Down
1 change: 1 addition & 0 deletions b2b_ecommerce/api_test.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Tests for b2b_ecommerce functions"""

from decimal import Decimal

import faker
Expand Down
1 change: 1 addition & 0 deletions b2b_ecommerce/apps.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""b2b_ecommerce app settings"""

from django.apps import AppConfig


Expand Down
1 change: 1 addition & 0 deletions b2b_ecommerce/conftest.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Fixtures for b2b_ecommerce"""

from types import SimpleNamespace

import pytest
Expand Down
1 change: 1 addition & 0 deletions b2b_ecommerce/constants.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
"""Constants for b2b_ecommerce"""

REFERENCE_NUMBER_PREFIX = "xpro-bulk-"
B2B_ORDER_PREFIX = "XPRO-B2BORDER"
1 change: 1 addition & 0 deletions b2b_ecommerce/factories.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Factories for b2b_ecommerce"""

from datetime import timezone

import factory
Expand Down
1 change: 1 addition & 0 deletions b2b_ecommerce/models.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Models for business to business ecommerce"""

import uuid

from django.conf import settings
Expand Down
1 change: 1 addition & 0 deletions b2b_ecommerce/models_test.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""models for b2b_ecommerce"""

from datetime import timedelta

import pytest
Expand Down
1 change: 1 addition & 0 deletions b2b_ecommerce/signals.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Signals for b2b_ecommerce models"""

from django.db.models.signals import post_save
from django.dispatch import receiver

Expand Down
1 change: 1 addition & 0 deletions b2b_ecommerce/urls.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""URLs for business to business ecommerce"""

from django.urls import path

from b2b_ecommerce.views import (
Expand Down
1 change: 1 addition & 0 deletions b2b_ecommerce/views_test.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Views for b2b_ecommerce"""

import uuid
from urllib.parse import urlencode, urljoin

Expand Down
1 change: 1 addition & 0 deletions blog/api.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""API for the Blog app"""

import logging

import requests
Expand Down
1 change: 1 addition & 0 deletions blog/api_test.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Tests for Blog API"""

import pytest

from blog.api import fetch_blog, parse_blog
Expand Down
1 change: 1 addition & 0 deletions cms/api.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""API for the CMS app"""

import itertools
import logging
from datetime import MAXYEAR, datetime, timezone
Expand Down
1 change: 1 addition & 0 deletions cms/api_test.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Tests for CMS API"""

from datetime import timedelta

import pytest
Expand Down
1 change: 1 addition & 0 deletions cms/blocks.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Wagtail custom blocks for the CMS
"""

from django import forms
from django.apps import apps
from django.core.exceptions import ValidationError
Expand Down
1 change: 1 addition & 0 deletions cms/embeds_test.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Tests for custom embed providers and finders"""

import pytest
from django.core.exceptions import ImproperlyConfigured
from wagtail.embeds.oembed_providers import vimeo
Expand Down
1 change: 1 addition & 0 deletions cms/factories.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Wagtail page factories"""

import factory
import faker
import wagtail_factories
Expand Down
1 change: 1 addition & 0 deletions cms/forms.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Custom forms for the cms
"""

from django import forms
from django.contrib.contenttypes.models import ContentType
from wagtail.admin.forms import WagtailAdminPageForm
Expand Down
1 change: 1 addition & 0 deletions cms/management/commands/configure_wagtail.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Management command to fully configure Wagtail"""

from django.core.management.base import BaseCommand

from cms.api import configure_wagtail
Expand Down
1 change: 1 addition & 0 deletions cms/management/commands/setup_index_pages.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Management command to setup courseware index pages"""

from django.core.management.base import BaseCommand

from cms.api import ensure_index_pages
Expand Down
1 change: 1 addition & 0 deletions cms/migrations/0029_setup_course_program_index_pages.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Data migrations moved to cms/migrations/0046_page_data_migrations.py in response to Page model change
"""

from django.db import migrations


Expand Down
1 change: 1 addition & 0 deletions cms/models.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Page models for the CMS
"""

import re
from collections import defaultdict
from datetime import datetime, timedelta
Expand Down
1 change: 1 addition & 0 deletions cms/models_test.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Tests for cms pages."""

import json
from datetime import date, datetime, timedelta

Expand Down
1 change: 1 addition & 0 deletions cms/template_tags_test.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Tests for custom CMS templatetags"""

from urllib.parse import urljoin

import pytest
Expand Down
1 change: 1 addition & 0 deletions cms/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

The pattern(s) defined here serve the same Wagtail view that the library-defined pattern serves.
"""

from django.urls import re_path
from wagtail import views
from wagtail.coreutils import WAGTAIL_APPEND_SLASH
Expand Down
1 change: 1 addition & 0 deletions cms/views_test.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Tests for CMS views"""

from datetime import datetime, timedelta
from types import SimpleNamespace

Expand Down
1 change: 1 addition & 0 deletions cms/wagtail_hooks.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Custom hooks to configure wagtail behavior"""

from wagtail import hooks
from wagtail.admin.api.views import PagesAdminAPIViewSet

Expand Down
Loading

0 comments on commit 9f01d9b

Please sign in to comment.