From f03b943b9551d3ad6f99687ae0e67ce085c4a7c7 Mon Sep 17 00:00:00 2001 From: stv Date: Mon, 16 Feb 2015 06:55:08 -0800 Subject: [PATCH] Fix Pylint: W0612(unused-variable) --- .../certificates/management/commands/cert_whitelist.py | 2 +- .../certificates/management/commands/ungenerated_certs.py | 2 +- lms/djangoapps/course_wiki/tests/tests.py | 1 - lms/djangoapps/courseware/tests/__init__.py | 2 +- lms/djangoapps/django_comment_client/forum/tests.py | 4 ++-- lms/djangoapps/instructor/tests/test_legacy_enrollment.py | 2 +- lms/djangoapps/instructor/tests/test_tools.py | 2 +- lms/djangoapps/instructor_task/tests/test_api.py | 2 -- .../lms_migration/management/commands/create_groups.py | 2 +- .../lms_migration/management/commands/create_user.py | 2 +- 10 files changed, 9 insertions(+), 12 deletions(-) diff --git a/lms/djangoapps/certificates/management/commands/cert_whitelist.py b/lms/djangoapps/certificates/management/commands/cert_whitelist.py index 1af6873250..427caced94 100644 --- a/lms/djangoapps/certificates/management/commands/cert_whitelist.py +++ b/lms/djangoapps/certificates/management/commands/cert_whitelist.py @@ -74,7 +74,7 @@ class Command(BaseCommand): else: user = User.objects.get(username=user_str) - cert_whitelist, created = \ + cert_whitelist, _created = \ CertificateWhitelist.objects.get_or_create( user=user, course_id=course) if options['add']: diff --git a/lms/djangoapps/certificates/management/commands/ungenerated_certs.py b/lms/djangoapps/certificates/management/commands/ungenerated_certs.py index 838e4224a3..67d019ce80 100644 --- a/lms/djangoapps/certificates/management/commands/ungenerated_certs.py +++ b/lms/djangoapps/certificates/management/commands/ungenerated_certs.py @@ -124,7 +124,7 @@ class Command(BaseCommand): diff = datetime.datetime.now(UTC) - start timeleft = diff * (total - count) / STATUS_INTERVAL hours, remainder = divmod(timeleft.seconds, 3600) - minutes, seconds = divmod(remainder, 60) + minutes, _seconds = divmod(remainder, 60) print "{0}/{1} completed ~{2:02}:{3:02}m remaining".format( count, total, hours, minutes) start = datetime.datetime.now(UTC) diff --git a/lms/djangoapps/course_wiki/tests/tests.py b/lms/djangoapps/course_wiki/tests/tests.py index fbecd44b54..9037c16c77 100644 --- a/lms/djangoapps/course_wiki/tests/tests.py +++ b/lms/djangoapps/course_wiki/tests/tests.py @@ -92,7 +92,6 @@ class WikiRedirectTestCase(LoginEnrollmentTestCase, ModuleStoreTestCase): course_wiki_page = referer.replace('progress', 'wiki/' + self.toy.wiki_slug + "/") ending_location = resp.redirect_chain[-1][0] - ending_status = resp.redirect_chain[-1][1] self.assertEquals(ending_location, 'http://testserver' + course_wiki_page) self.assertEquals(resp.status_code, 200) diff --git a/lms/djangoapps/courseware/tests/__init__.py b/lms/djangoapps/courseware/tests/__init__.py index 1071b26044..9259f4ceb2 100644 --- a/lms/djangoapps/courseware/tests/__init__.py +++ b/lms/djangoapps/courseware/tests/__init__.py @@ -106,7 +106,7 @@ class BaseTestXmodule(ModuleStoreTestCase): # username = robot{0}, password = 'test' self.users = [ UserFactory.create() - for i in range(self.USER_COUNT) + for dummy0 in range(self.USER_COUNT) ] for user in self.users: diff --git a/lms/djangoapps/django_comment_client/forum/tests.py b/lms/djangoapps/django_comment_client/forum/tests.py index b7c3c731bd..3329454835 100644 --- a/lms/djangoapps/django_comment_client/forum/tests.py +++ b/lms/djangoapps/django_comment_client/forum/tests.py @@ -1085,7 +1085,7 @@ class UserProfileTestCase(ModuleStoreTestCase): request = RequestFactory().get("dummy_url") request.user = self.student with self.assertRaises(Http404): - response = views.user_profile( + views.user_profile( request, self.course.id.to_deprecated_string(), -999 @@ -1095,7 +1095,7 @@ class UserProfileTestCase(ModuleStoreTestCase): request = RequestFactory().get("dummy_url") request.user = self.student with self.assertRaises(Http404): - response = views.user_profile( + views.user_profile( request, "non/existent/course", self.profiled_user.id diff --git a/lms/djangoapps/instructor/tests/test_legacy_enrollment.py b/lms/djangoapps/instructor/tests/test_legacy_enrollment.py index 0eb3efecee..3749a69a22 100644 --- a/lms/djangoapps/instructor/tests/test_legacy_enrollment.py +++ b/lms/djangoapps/instructor/tests/test_legacy_enrollment.py @@ -188,7 +188,7 @@ class TestInstructorEnrollsStudent(ModuleStoreTestCase, LoginEnrollmentTestCase) """ string = "abc@test.com, def@test.com ghi@test.com \n \n jkl@test.com \n mno@test.com " - cleaned_string, cleaned_string_lc = get_and_clean_student_list(string) + cleaned_string, _cleaned_string_lc = get_and_clean_student_list(string) self.assertEqual(cleaned_string, ['abc@test.com', 'def@test.com', 'ghi@test.com', 'jkl@test.com', 'mno@test.com']) @ddt.data('http', 'https') diff --git a/lms/djangoapps/instructor/tests/test_tools.py b/lms/djangoapps/instructor/tests/test_tools.py index 0fdc2534de..a286aa15d7 100644 --- a/lms/djangoapps/instructor/tests/test_tools.py +++ b/lms/djangoapps/instructor/tests/test_tools.py @@ -148,7 +148,7 @@ class TestGetUnitsWithDueDate(ModuleStoreTestCase): week1 = ItemFactory.create(due=due, parent=course) week2 = ItemFactory.create(due=due, parent=course) - homework = ItemFactory.create( + ItemFactory.create( parent=week1, due=due ) diff --git a/lms/djangoapps/instructor_task/tests/test_api.py b/lms/djangoapps/instructor_task/tests/test_api.py index c071ba8127..c55e9ed706 100644 --- a/lms/djangoapps/instructor_task/tests/test_api.py +++ b/lms/djangoapps/instructor_task/tests/test_api.py @@ -82,7 +82,6 @@ class InstructorTaskModuleSubmitTest(InstructorTaskModuleTestCase): def test_submit_nonexistent_modules(self): # confirm that a rescore of a non-existent module returns an exception problem_url = InstructorTaskModuleTestCase.problem_location("NonexistentProblem") - course_id = self.course.id request = None with self.assertRaises(ItemNotFoundError): submit_rescore_problem_for_student(request, problem_url, self.student) @@ -98,7 +97,6 @@ class InstructorTaskModuleSubmitTest(InstructorTaskModuleTestCase): # (Note that it is easier to test a scoreable but non-rescorable module in test_tasks, # where we are creating real modules.) problem_url = self.problem_section.location - course_id = self.course.id request = None with self.assertRaises(NotImplementedError): submit_rescore_problem_for_student(request, problem_url, self.student) diff --git a/lms/djangoapps/lms_migration/management/commands/create_groups.py b/lms/djangoapps/lms_migration/management/commands/create_groups.py index 6cdc032278..626f22c5d3 100644 --- a/lms/djangoapps/lms_migration/management/commands/create_groups.py +++ b/lms/djangoapps/lms_migration/management/commands/create_groups.py @@ -31,7 +31,7 @@ def create_groups(): cxfn = path(data_dir) / course_dir / 'course.xml' try: coursexml = etree.parse(cxfn) - except Exception as err: + except Exception: print "Oops, cannot read %s, skipping" % cxfn continue cxmlroot = coursexml.getroot() diff --git a/lms/djangoapps/lms_migration/management/commands/create_user.py b/lms/djangoapps/lms_migration/management/commands/create_user.py index 55590f6b2b..53c879974f 100644 --- a/lms/djangoapps/lms_migration/management/commands/create_user.py +++ b/lms/djangoapps/lms_migration/management/commands/create_user.py @@ -44,7 +44,7 @@ class MyCompleter(object): # Custom completer def GenPasswd(length=8, chars=string.letters + string.digits): - return ''.join([choice(chars) for i in range(length)]) + return ''.join([choice(chars) for dummy0 in range(length)]) #----------------------------------------------------------------------------- # main command