Skip to content

Commit 0d8b828

Browse files
feanilclaude
andcommitted
fix: add pylint inline disables broken by ruff import expansion
When ruff auto-fixes expand single-line imports to multi-line (adding parentheses and trailing commas), inline pylint disables that were on the original line end up on the last item inside the parens rather than on the `from` statement. Pylint does not recognize these as suppressing the warning on the import. Affected issues: unused-import, reimported, redefined-outer-name, useless-import-alias, wrong-import-position. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 01e3e71 commit 0d8b828

13 files changed

Lines changed: 32 additions & 32 deletions

File tree

common/djangoapps/student/roles.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -429,8 +429,8 @@ def _legacy_add_users(self, users):
429429
"""
430430
# silently ignores anonymous and inactive users so that any that are
431431
# legit get updated.
432-
from common.djangoapps.student.models import (
433-
CourseAccessRole, # lint-amnesty, pylint: disable=redefined-outer-name, reimported
432+
from common.djangoapps.student.models import ( # lint-amnesty, pylint: disable=redefined-outer-name, reimported
433+
CourseAccessRole,
434434
)
435435
for user in users:
436436
if user.is_authenticated and user.is_active:

common/djangoapps/third_party_auth/tests/specs/base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
import pytest
1111
from django import test
1212
from django.conf import settings # lint-amnesty, pylint: disable=reimported
13-
from django.conf import settings as django_settings
13+
from django.conf import settings as django_settings # pylint: disable=reimported
1414
from django.contrib import auth, messages
1515
from django.contrib.auth import models as auth_models
1616
from django.contrib.messages.storage import fallback

lms/djangoapps/commerce/api/v0/tests/test_views.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717
from common.djangoapps.course_modes.models import CourseMode
1818
from common.djangoapps.course_modes.tests.factories import CourseModeFactory
1919
from common.djangoapps.student.models import CourseEnrollment
20-
from common.djangoapps.student.tests.tests import (
21-
EnrollmentEventTestMixin, # lint-amnesty, pylint: disable=unused-import
20+
from common.djangoapps.student.tests.tests import ( # lint-amnesty, pylint: disable=unused-import
21+
EnrollmentEventTestMixin,
2222
)
2323
from openedx.core.djangoapps.embargo.test_utils import restrict_course
2424
from openedx.core.djangoapps.enrollments.api import get_enrollment

lms/djangoapps/course_api/blocks/permissions.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
from lms.djangoapps.courseware.access_utils import ACCESS_DENIED, ACCESS_GRANTED, check_public_access
1212
from lms.djangoapps.courseware.courses import get_course
1313
from lms.djangoapps.courseware.exceptions import CourseRunNotFound
14-
from openedx.core.djangoapps.content.course_overviews.models import (
15-
CourseOverview, # lint-amnesty, pylint: disable=unused-import
14+
from openedx.core.djangoapps.content.course_overviews.models import ( # lint-amnesty, pylint: disable=unused-import
15+
CourseOverview,
1616
)
1717
from xmodule.course_block import COURSE_VISIBILITY_PUBLIC # lint-amnesty, pylint: disable=wrong-import-order
1818

lms/djangoapps/course_api/serializers.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212

1313
from common.djangoapps.student.models import CourseEnrollment
1414
from lms.djangoapps.certificates.api import can_show_certificate_available_date_field
15-
from openedx.core.djangoapps.content.course_overviews.models import (
16-
CourseOverview, # lint-amnesty, pylint: disable=unused-import
15+
from openedx.core.djangoapps.content.course_overviews.models import ( # lint-amnesty, pylint: disable=unused-import
16+
CourseOverview,
1717
)
1818
from openedx.core.djangoapps.models.course_details import CourseDetails
1919
from openedx.core.lib.api.fields import AbsoluteURLField

lms/djangoapps/courseware/access.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@
3333
OrgStaffRole,
3434
SupportStaffRole,
3535
)
36-
from common.djangoapps.util import (
37-
milestones_helpers as milestones_helpers, # lint-amnesty, pylint: disable=useless-import-alias
36+
from common.djangoapps.util import ( # lint-amnesty, pylint: disable=useless-import-alias
37+
milestones_helpers as milestones_helpers,
3838
)
3939
from common.djangoapps.util.milestones_helpers import (
4040
any_unfulfilled_milestones,

lms/djangoapps/experiments/views.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
from common.djangoapps.student.models import get_user_by_username_or_email
1616
from common.djangoapps.util.json_request import JsonResponse # lint-amnesty, pylint: disable=reimported
17-
from lms.djangoapps.courseware import courses # lint-amnesty, pylint: disable=reimported
17+
from lms.djangoapps.courseware import courses # lint-amnesty, pylint: disable=reimported, unused-import
1818
from lms.djangoapps.experiments import filters, serializers
1919
from lms.djangoapps.experiments.models import ExperimentData, ExperimentKeyValue
2020
from lms.djangoapps.experiments.permissions import IsStaffOrOwner, IsStaffOrReadOnly, IsStaffOrReadOnlyForSelf

lms/djangoapps/grades/tasks.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@
2626
from lms.djangoapps.grades.config.models import ComputeGradesSetting
2727
from openedx.core.djangoapps.content.block_structure.api import clear_course_from_cache
2828
from openedx.core.djangoapps.content.block_structure.exceptions import UsageKeyNotInBlockStructure
29-
from openedx.core.djangoapps.content.course_overviews.models import (
30-
CourseOverview, # lint-amnesty, pylint: disable=unused-import
29+
from openedx.core.djangoapps.content.course_overviews.models import ( # lint-amnesty, pylint: disable=unused-import
30+
CourseOverview,
3131
)
3232
from xmodule.modulestore.django import modulestore # lint-amnesty, pylint: disable=wrong-import-order
3333

lms/djangoapps/program_enrollments/apps.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ def ready(self):
2929
"""
3030
Connect handlers to signals.
3131
"""
32-
from lms.djangoapps.program_enrollments import (
33-
signals, # pylint: disable=unused-import
34-
tasks, # pylint: disable=unused-import
32+
from lms.djangoapps.program_enrollments import ( # pylint: disable=unused-import
33+
signals,
34+
tasks,
3535
)

openedx/core/djangoapps/credentials/apps.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,6 @@ class CredentialsConfig(AppConfig):
4444

4545
def ready(self):
4646
# Register celery workers
47-
from openedx.core.djangoapps.credentials.tasks.v1 import (
48-
tasks, # lint-amnesty, pylint: disable=unused-import, unused-variable
47+
from openedx.core.djangoapps.credentials.tasks.v1 import ( # lint-amnesty, pylint: disable=unused-import, unused-variable
48+
tasks,
4949
)

0 commit comments

Comments
 (0)