BOM-2477: pylint warnings lint-amnesty (#27585)

This commit is contained in:
Usama Sadiq
2021-05-11 17:22:40 +05:00
committed by GitHub
parent 156a1a80ee
commit 4f4be6538a
52 changed files with 67 additions and 69 deletions

View File

@@ -2,7 +2,7 @@
Course API Views
"""
import json
import json # lint-amnesty, pylint: disable=unused-import
from completion.exceptions import UnavailableCompletionData
from completion.utilities import get_key_to_last_completed_block

View File

@@ -13,7 +13,7 @@ signals.)
import logging
import shlex
import sys
import sys # lint-amnesty, pylint: disable=unused-import
from datetime import datetime, timedelta
import dateutil.parser

View File

@@ -8,7 +8,7 @@ from unittest import mock
from django.core.management import call_command
from django.core.management.base import CommandError
from django.test import TestCase, override_settings
from django.test import TestCase, override_settings # lint-amnesty, pylint: disable=unused-import
from freezegun import freeze_time
from openedx.core.djangoapps.catalog.tests.factories import ProgramFactory, CourseFactory, CourseRunFactory

View File

@@ -3,8 +3,8 @@
from unittest import mock
from django.conf import settings
from django.test import TestCase, override_settings
from django.conf import settings # lint-amnesty, pylint: disable=unused-import
from django.test import TestCase, override_settings # lint-amnesty, pylint: disable=unused-import
from lms.djangoapps.certificates.tests.factories import GeneratedCertificateFactory
from lms.djangoapps.grades.course_grade_factory import CourseGradeFactory

View File

@@ -126,7 +126,7 @@ class LegacySettingsSerializer(serializers.BaseSerializer):
raise serializers.ValidationError('Wrong type for discussion_topics')
payload = {
key: value
for key, value in data.items()
for key, value in data.items() # lint-amnesty, pylint: disable=unnecessary-comprehension
}
return payload

View File

@@ -28,7 +28,7 @@ def make_image_file(dimensions=(320, 240), prefix='tmp', extension='.jpeg', forc
"""
image = Image.new('RGB', dimensions, "green")
image_file = NamedTemporaryFile(prefix=prefix, suffix=extension)
image_file = NamedTemporaryFile(prefix=prefix, suffix=extension) # lint-amnesty, pylint: disable=consider-using-with
try:
if orientation and orientation in range(1, 9):
exif_bytes = piexif.dump({'0th': {piexif.ImageIFD.Orientation: orientation}})

View File

@@ -475,7 +475,7 @@ class TestProgramProgressMeter(ModuleStoreTestCase):
programs = data[:3]
assert meter.engaged_programs == programs
def test_simulate_progress(self, mock_get_programs):
def test_simulate_progress(self, mock_get_programs): # lint-amnesty, pylint: disable=too-many-statements
"""Simulate the entirety of a user's progress through a program."""
today = datetime.datetime.now(utc)
two_days_ago = today - datetime.timedelta(days=2)

View File

@@ -274,7 +274,7 @@ class EmailOptInListTest(ModuleStoreTestCase):
call_command('email_opt_in_list', *args)
def test_file_already_exists(self):
temp_file = tempfile.NamedTemporaryFile(delete=True)
temp_file = tempfile.NamedTemporaryFile(delete=True) # lint-amnesty, pylint: disable=consider-using-with
def _cleanup():
temp_file.close()

View File

@@ -5,7 +5,7 @@ Utility functions used during user authentication.
import random
import string
from urllib.parse import urlparse # pylint: disable=import-error
from uuid import uuid4
from uuid import uuid4 # lint-amnesty, pylint: disable=unused-import
from django.conf import settings
from django.utils import http

View File

@@ -44,7 +44,7 @@ from openedx.core.djangoapps.user_authn.views.utils import (
from openedx.core.djangoapps.user_authn.toggles import is_require_third_party_auth_enabled
from openedx.core.djangoapps.user_authn.config.waffle import ENABLE_LOGIN_USING_THIRDPARTY_AUTH_ONLY
from openedx.core.djangolib.markup import HTML, Text
from openedx.core.lib.api.view_utils import require_post_params
from openedx.core.lib.api.view_utils import require_post_params # lint-amnesty, pylint: disable=unused-import
from openedx.features.enterprise_support.api import activate_learner_enterprise, get_enterprise_learner_data_from_api
from common.djangoapps.student.helpers import get_next_url_for_login_page, get_redirect_url_with_host
from common.djangoapps.student.models import LoginFailures, AllowedAuthUser, UserProfile

View File

@@ -12,7 +12,7 @@ def html_to_text(html_message):
Currently uses lynx in a subprocess; should be refactored to
use something more pythonic.
"""
process = Popen(
process = Popen( # lint-amnesty, pylint: disable=consider-using-with
['lynx', '-stdin', '-display_charset=UTF-8', '-assume_charset=UTF-8', '-dump'],
stdin=PIPE,
stdout=PIPE

View File

@@ -4,7 +4,7 @@ Script to process pytest warnings output by pytest-json-report plugin and output
"""
import argparse
import io
import io # lint-amnesty, pylint: disable=unused-import
import itertools
import json
import os

View File

@@ -2,7 +2,7 @@
Module to put all pytest hooks that modify pytest behaviour
"""
import os
import io
import io # lint-amnesty, pylint: disable=unused-import
import json

View File

@@ -2,7 +2,7 @@
Class used to write pytest warning data into html format
"""
import textwrap
import six
import six # lint-amnesty, pylint: disable=unused-import
class HtmlOutlineWriter: