From 2e1238b83eba48dd7dc34cd7762551d3a0575429 Mon Sep 17 00:00:00 2001 From: Ned Batchelder Date: Fri, 8 Apr 2016 11:23:05 -0400 Subject: [PATCH 1/2] Remove unused imports --- cms/djangoapps/contentstore/features/video.py | 2 -- .../contentstore/management/commands/delete_course.py | 1 - .../management/commands/tests/test_delete_course.py | 1 - cms/djangoapps/contentstore/tests/test_courseware_index.py | 2 +- cms/djangoapps/contentstore/tests/test_crud.py | 2 -- cms/djangoapps/contentstore/tests/test_utils.py | 1 - cms/djangoapps/contentstore/views/component.py | 2 -- cms/djangoapps/contentstore/views/entrance_exam.py | 1 - cms/djangoapps/contentstore/views/library.py | 1 - common/djangoapps/cache_toolbox/middleware.py | 1 - common/djangoapps/contentserver/test/test_contentserver.py | 1 - common/djangoapps/embargo/tests/test_api.py | 2 +- common/djangoapps/status/status.py | 1 - common/djangoapps/student/tests/test_email.py | 1 - common/djangoapps/third_party_auth/pipeline.py | 1 - common/lib/xmodule/xmodule/modulestore/inheritance.py | 2 -- .../xmodule/xmodule/modulestore/tests/test_contentstore.py | 1 - .../tests/test_cross_modulestore_import_export.py | 5 +---- common/lib/xmodule/xmodule/modulestore/xml_exporter.py | 4 +--- common/lib/xmodule/xmodule/seq_module.py | 1 - common/lib/xmodule/xmodule/tests/test_export.py | 4 ---- common/lib/xmodule/xmodule/video_module/video_utils.py | 6 +----- .../pages/studio/settings_group_configurations.py | 1 - .../tests/lms/test_lms_cohorted_courseware_search.py | 2 +- .../tests/lms/test_lms_split_test_courseware_search.py | 2 +- common/test/acceptance/tests/video/test_video_events.py | 1 - lms/djangoapps/bulk_email/models.py | 2 +- lms/djangoapps/ccx/overrides.py | 2 +- lms/djangoapps/ccx/tests/test_utils.py | 7 +------ lms/djangoapps/ccx/views.py | 1 - lms/djangoapps/certificates/models.py | 1 - lms/djangoapps/certificates/tests/test_models.py | 1 - lms/djangoapps/commerce/tests/test_views.py | 3 +-- .../course_blocks/transformers/tests/test_split_test.py | 2 +- lms/djangoapps/course_structure_api/v0/tests.py | 2 +- lms/djangoapps/course_structure_api/v0/views.py | 2 +- lms/djangoapps/courseware/access.py | 4 +--- lms/djangoapps/courseware/entrance_exams.py | 1 - lms/djangoapps/courseware/features/navigation.py | 1 - .../courseware/management/commands/dump_course_ids.py | 3 +-- .../management/commands/tests/test_dump_course.py | 2 +- .../courseware/tests/test_self_paced_overrides.py | 1 - lms/djangoapps/courseware/tests/test_tabs.py | 1 - lms/djangoapps/courseware/tests/test_video_mongo.py | 2 +- lms/djangoapps/courseware/tests/test_views.py | 2 +- lms/djangoapps/courseware/user_state_client.py | 2 +- lms/djangoapps/dashboard/tests/test_sysadmin.py | 5 ----- lms/djangoapps/discussion_api/forms.py | 3 +-- .../management/commands/get_discussion_link.py | 1 - lms/djangoapps/edxnotes/views.py | 2 +- lms/djangoapps/instructor/tests/test_enrollment.py | 1 - lms/djangoapps/instructor_task/tasks_helper.py | 2 +- lms/djangoapps/lms_xblock/test/test_runtime.py | 1 - lms/djangoapps/lti_provider/models.py | 2 +- lms/djangoapps/mobile_api/course_info/views.py | 2 +- .../shoppingcart/management/commands/retire_order.py | 2 +- lms/djangoapps/survey/tests/test_views.py | 1 - .../management/commands/tests/test_reindex_course_team.py | 2 +- lms/djangoapps/verify_student/models.py | 2 +- lms/djangoapps/verify_student/views.py | 2 +- .../management/commands/generate_course_overview.py | 2 +- openedx/core/djangoapps/course_groups/models.py | 2 +- openedx/core/djangoapps/course_groups/tests/helpers.py | 2 +- openedx/core/djangoapps/credit/serializers.py | 1 - openedx/core/djangoapps/profile_images/views.py | 2 +- openedx/core/djangoapps/programs/tests/test_models.py | 1 - openedx/core/lib/tests/test_xblock_utils.py | 2 -- 67 files changed, 33 insertions(+), 98 deletions(-) diff --git a/cms/djangoapps/contentstore/features/video.py b/cms/djangoapps/contentstore/features/video.py index 1bc1b5a19c..a71c248cb6 100644 --- a/cms/djangoapps/contentstore/features/video.py +++ b/cms/djangoapps/contentstore/features/video.py @@ -1,8 +1,6 @@ # pylint: disable=missing-docstring from lettuce import world, step -from selenium.webdriver.common.keys import Keys -from xmodule.modulestore.django import modulestore SELECTORS = { 'spinner': '.video-wrapper .spinner', diff --git a/cms/djangoapps/contentstore/management/commands/delete_course.py b/cms/djangoapps/contentstore/management/commands/delete_course.py index 3807aa317f..8876fce581 100644 --- a/cms/djangoapps/contentstore/management/commands/delete_course.py +++ b/cms/djangoapps/contentstore/management/commands/delete_course.py @@ -13,7 +13,6 @@ from .prompt import query_yes_no from contentstore.utils import delete_course_and_groups from opaque_keys.edx.keys import CourseKey from opaque_keys import InvalidKeyError -from opaque_keys.edx.locations import SlashSeparatedCourseKey from xmodule.modulestore import ModuleStoreEnum from xmodule.modulestore.django import modulestore diff --git a/cms/djangoapps/contentstore/management/commands/tests/test_delete_course.py b/cms/djangoapps/contentstore/management/commands/tests/test_delete_course.py index c3c9494c3a..5ea41377eb 100644 --- a/cms/djangoapps/contentstore/management/commands/tests/test_delete_course.py +++ b/cms/djangoapps/contentstore/management/commands/tests/test_delete_course.py @@ -2,7 +2,6 @@ Unittests for deleting a course in an chosen modulestore """ -import unittest import mock from opaque_keys.edx.locations import SlashSeparatedCourseKey diff --git a/cms/djangoapps/contentstore/tests/test_courseware_index.py b/cms/djangoapps/contentstore/tests/test_courseware_index.py index 50c3a20eac..d3d2205cea 100644 --- a/cms/djangoapps/contentstore/tests/test_courseware_index.py +++ b/cms/djangoapps/contentstore/tests/test_courseware_index.py @@ -7,7 +7,7 @@ from lazy.lazy import lazy import time from datetime import datetime from dateutil.tz import tzutc -from mock import patch, call +from mock import patch from pytz import UTC from uuid import uuid4 from unittest import skip diff --git a/cms/djangoapps/contentstore/tests/test_crud.py b/cms/djangoapps/contentstore/tests/test_crud.py index 512667fa02..f7f73c9a26 100644 --- a/cms/djangoapps/contentstore/tests/test_crud.py +++ b/cms/djangoapps/contentstore/tests/test_crud.py @@ -1,5 +1,3 @@ -import unittest - from xmodule import templates from xmodule.modulestore import ModuleStoreEnum from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory diff --git a/cms/djangoapps/contentstore/tests/test_utils.py b/cms/djangoapps/contentstore/tests/test_utils.py index 38890c4e4c..c4b9e667e4 100644 --- a/cms/djangoapps/contentstore/tests/test_utils.py +++ b/cms/djangoapps/contentstore/tests/test_utils.py @@ -3,7 +3,6 @@ import collections from datetime import datetime, timedelta import mock -import ddt from pytz import UTC from django.test import TestCase from django.test.utils import override_settings diff --git a/cms/djangoapps/contentstore/views/component.py b/cms/djangoapps/contentstore/views/component.py index 16895c84b9..d7ac594700 100644 --- a/cms/djangoapps/contentstore/views/component.py +++ b/cms/djangoapps/contentstore/views/component.py @@ -16,7 +16,6 @@ from xmodule.modulestore.django import modulestore from xblock.core import XBlock from xblock.django.request import webob_to_django_response, django_to_webob_request from xblock.exceptions import NoSuchHandlerError -from xblock.fields import Scope from xblock.plugin import PluginMissingError from xblock.runtime import Mixologist @@ -28,7 +27,6 @@ from opaque_keys.edx.keys import UsageKey from student.auth import has_course_author_access from django.utils.translation import ugettext as _ -from models.settings.course_grading import CourseGradingModel from xblock_django.models import XBlockDisableConfig __all__ = [ diff --git a/cms/djangoapps/contentstore/views/entrance_exam.py b/cms/djangoapps/contentstore/views/entrance_exam.py index 9726156c7b..5bedb11100 100644 --- a/cms/djangoapps/contentstore/views/entrance_exam.py +++ b/cms/djangoapps/contentstore/views/entrance_exam.py @@ -3,7 +3,6 @@ Entrance Exams view module -- handles all requests related to entrance exam mana Intended to be utilized as an AJAX callback handler, versus a proper view/screen """ from functools import wraps -import json import logging from django.contrib.auth.decorators import login_required diff --git a/cms/djangoapps/contentstore/views/library.py b/cms/djangoapps/contentstore/views/library.py index 7e157c0ef5..cb3cd4e18b 100644 --- a/cms/djangoapps/contentstore/views/library.py +++ b/cms/djangoapps/contentstore/views/library.py @@ -5,7 +5,6 @@ multiple courses. """ from __future__ import absolute_import -import json import logging from contentstore.views.item import create_xblock_info diff --git a/common/djangoapps/cache_toolbox/middleware.py b/common/djangoapps/cache_toolbox/middleware.py index 3c22194e20..eba90210de 100644 --- a/common/djangoapps/cache_toolbox/middleware.py +++ b/common/djangoapps/cache_toolbox/middleware.py @@ -78,7 +78,6 @@ choice for most environments but you may be happy with the trade-offs of the """ -from django.contrib.auth import SESSION_KEY from django.contrib.auth.models import User from django.contrib.auth.middleware import AuthenticationMiddleware from logging import getLogger diff --git a/common/djangoapps/contentserver/test/test_contentserver.py b/common/djangoapps/contentserver/test/test_contentserver.py index 0181e11560..c68bc5a63c 100644 --- a/common/djangoapps/contentserver/test/test_contentserver.py +++ b/common/djangoapps/contentserver/test/test_contentserver.py @@ -18,7 +18,6 @@ from mock import patch from xmodule.contentstore.django import contentstore from xmodule.modulestore.django import modulestore from xmodule.modulestore.tests.django_utils import SharedModuleStoreTestCase -from xmodule.modulestore import ModuleStoreEnum from xmodule.modulestore.xml_importer import import_course_from_xml from contentserver.middleware import parse_range_header, HTTP_DATE_FORMAT, StaticContentServer diff --git a/common/djangoapps/embargo/tests/test_api.py b/common/djangoapps/embargo/tests/test_api.py index 16bcaae6ce..e48940fe10 100644 --- a/common/djangoapps/embargo/tests/test_api.py +++ b/common/djangoapps/embargo/tests/test_api.py @@ -11,7 +11,7 @@ import ddt from django.conf import settings from django.test.utils import override_settings from django.core.cache import cache -from django.db import connection, transaction +from django.db import connection from student.tests.factories import UserFactory from xmodule.modulestore.tests.factories import CourseFactory diff --git a/common/djangoapps/status/status.py b/common/djangoapps/status/status.py index dd525601d7..7ff1390b54 100644 --- a/common/djangoapps/status/status.py +++ b/common/djangoapps/status/status.py @@ -2,7 +2,6 @@ A tiny app that checks for a status message. """ -from django.conf import settings import logging from .models import GlobalStatusMessage diff --git a/common/djangoapps/student/tests/test_email.py b/common/djangoapps/student/tests/test_email.py index 6a26d3cfbd..eb86f3290c 100644 --- a/common/djangoapps/student/tests/test_email.py +++ b/common/djangoapps/student/tests/test_email.py @@ -1,6 +1,5 @@ import json -import django.db import unittest from student.tests.factories import UserFactory, RegistrationFactory, PendingEmailChangeFactory diff --git a/common/djangoapps/third_party_auth/pipeline.py b/common/djangoapps/third_party_auth/pipeline.py index de7d081f26..2e2aa3c2f0 100644 --- a/common/djangoapps/third_party_auth/pipeline.py +++ b/common/djangoapps/third_party_auth/pipeline.py @@ -73,7 +73,6 @@ from django.contrib.auth.models import User from django.core.urlresolvers import reverse from django.http import HttpResponseBadRequest from django.shortcuts import redirect -from django.utils.translation import ugettext as _ from social.apps.django_app.default import models from social.exceptions import AuthException from social.pipeline import partial diff --git a/common/lib/xmodule/xmodule/modulestore/inheritance.py b/common/lib/xmodule/xmodule/modulestore/inheritance.py index 07d9f98cc4..bd2089578f 100644 --- a/common/lib/xmodule/xmodule/modulestore/inheritance.py +++ b/common/lib/xmodule/xmodule/modulestore/inheritance.py @@ -3,9 +3,7 @@ Support for inheritance of fields down an XBlock hierarchy. """ from __future__ import absolute_import -from datetime import datetime from django.conf import settings -from pytz import UTC from xmodule.partitions.partitions import UserPartition from xblock.fields import Scope, Boolean, String, Float, XBlockMixin, Dict, Integer, List diff --git a/common/lib/xmodule/xmodule/modulestore/tests/test_contentstore.py b/common/lib/xmodule/xmodule/modulestore/tests/test_contentstore.py index 5735d89f20..5676f9bf40 100644 --- a/common/lib/xmodule/xmodule/modulestore/tests/test_contentstore.py +++ b/common/lib/xmodule/xmodule/modulestore/tests/test_contentstore.py @@ -16,7 +16,6 @@ from xmodule.contentstore.mongo import MongoContentStore from xmodule.contentstore.content import StaticContent from xmodule.exceptions import NotFoundError import ddt -from __builtin__ import delattr from xmodule.modulestore.tests.mongo_connection import MONGO_PORT_NUM, MONGO_HOST log = logging.getLogger(__name__) diff --git a/common/lib/xmodule/xmodule/modulestore/tests/test_cross_modulestore_import_export.py b/common/lib/xmodule/xmodule/modulestore/tests/test_cross_modulestore_import_export.py index c4c4974b84..7ebef5e4d5 100644 --- a/common/lib/xmodule/xmodule/modulestore/tests/test_cross_modulestore_import_export.py +++ b/common/lib/xmodule/xmodule/modulestore/tests/test_cross_modulestore_import_export.py @@ -11,7 +11,7 @@ and then for each combination of modulestores, performing the sequence: 4) Compare all modules in the source and destination modulestores to make sure that they line up """ -from contextlib import contextmanager, nested + import itertools import os from path import Path as path @@ -25,11 +25,8 @@ from mock import patch from xmodule.tests import CourseComparisonTest from xmodule.modulestore.xml_importer import import_course_from_xml from xmodule.modulestore.xml_exporter import export_course_to_xml -from xmodule.modulestore.tests.mongo_connection import MONGO_PORT_NUM, MONGO_HOST from xmodule.modulestore.tests.utils import mock_tab_from_json -from xmodule.modulestore.inheritance import InheritanceMixin from xmodule.partitions.tests.test_partitions import PartitionTestCase -from xmodule.x_module import XModuleMixin from xmodule.modulestore.tests.utils import ( MongoContentstoreBuilder, MODULESTORE_SETUPS, SPLIT_MODULESTORE_SETUP, CONTENTSTORE_SETUPS, TEST_DATA_DIR diff --git a/common/lib/xmodule/xmodule/modulestore/xml_exporter.py b/common/lib/xmodule/xmodule/modulestore/xml_exporter.py index dac0e20f91..91066d485d 100644 --- a/common/lib/xmodule/xmodule/modulestore/xml_exporter.py +++ b/common/lib/xmodule/xmodule/modulestore/xml_exporter.py @@ -15,10 +15,8 @@ from xmodule.modulestore.store_utilities import draft_node_constructor, get_draf from xmodule.modulestore import LIBRARY_ROOT from fs.osfs import OSFS from json import dumps -import json import os -from path import Path as path -import shutil + from xmodule.modulestore.draft_and_published import DIRECT_ONLY_CATEGORIES from opaque_keys.edx.locator import CourseLocator, LibraryLocator diff --git a/common/lib/xmodule/xmodule/seq_module.py b/common/lib/xmodule/xmodule/seq_module.py index 9548bfa57d..fb8ee0a70f 100644 --- a/common/lib/xmodule/xmodule/seq_module.py +++ b/common/lib/xmodule/xmodule/seq_module.py @@ -7,7 +7,6 @@ import collections import json import logging from pkg_resources import resource_string -import warnings from lxml import etree from xblock.core import XBlock diff --git a/common/lib/xmodule/xmodule/tests/test_export.py b/common/lib/xmodule/xmodule/tests/test_export.py index 082ebc9741..4e5c330419 100644 --- a/common/lib/xmodule/xmodule/tests/test_export.py +++ b/common/lib/xmodule/xmodule/tests/test_export.py @@ -5,12 +5,9 @@ Tests of XML export import ddt import lxml.etree import mock -import os import pytz import shutil -import tarfile import unittest -import uuid from datetime import datetime, timedelta, tzinfo from fs.osfs import OSFS @@ -26,7 +23,6 @@ from opaque_keys.edx.locations import Location from xmodule.modulestore import EdxJSONEncoder from xmodule.modulestore.xml import XMLModuleStore from xmodule.tests import DATA_DIR -from xmodule.tests.helpers import directories_equal from xmodule.x_module import XModuleMixin diff --git a/common/lib/xmodule/xmodule/video_module/video_utils.py b/common/lib/xmodule/xmodule/video_module/video_utils.py index 3f5a33d822..0749b54f2d 100644 --- a/common/lib/xmodule/xmodule/video_module/video_utils.py +++ b/common/lib/xmodule/xmodule/video_module/video_utils.py @@ -2,11 +2,9 @@ """ Module contains utils specific for video_module but not for transcripts. """ -import json + from collections import OrderedDict import logging -import urllib -import requests from urllib import urlencode from urlparse import parse_qs, urlsplit, urlunsplit, urlparse @@ -14,8 +12,6 @@ from django.conf import settings from django.core.validators import URLValidator from django.core.exceptions import ValidationError -from requests.exceptions import RequestException - log = logging.getLogger(__name__) diff --git a/common/test/acceptance/pages/studio/settings_group_configurations.py b/common/test/acceptance/pages/studio/settings_group_configurations.py index 4fad4ef288..b0341cb112 100644 --- a/common/test/acceptance/pages/studio/settings_group_configurations.py +++ b/common/test/acceptance/pages/studio/settings_group_configurations.py @@ -1,7 +1,6 @@ """ Course Group Configurations page. """ -from bok_choy.promise import EmptyPromise from ..common.utils import confirm_prompt from .course_page import CoursePage diff --git a/common/test/acceptance/tests/lms/test_lms_cohorted_courseware_search.py b/common/test/acceptance/tests/lms/test_lms_cohorted_courseware_search.py index 76560d9d11..2f129b70bf 100644 --- a/common/test/acceptance/tests/lms/test_lms_cohorted_courseware_search.py +++ b/common/test/acceptance/tests/lms/test_lms_cohorted_courseware_search.py @@ -1,7 +1,7 @@ """ Test courseware search """ -import os + import json import uuid diff --git a/common/test/acceptance/tests/lms/test_lms_split_test_courseware_search.py b/common/test/acceptance/tests/lms/test_lms_split_test_courseware_search.py index e3ba27cce1..24513db360 100644 --- a/common/test/acceptance/tests/lms/test_lms_split_test_courseware_search.py +++ b/common/test/acceptance/tests/lms/test_lms_split_test_courseware_search.py @@ -1,7 +1,7 @@ """ Test courseware search """ -import os + import json from ..helpers import remove_file diff --git a/common/test/acceptance/tests/video/test_video_events.py b/common/test/acceptance/tests/video/test_video_events.py index ac06ca0d3f..3e4993c7ed 100644 --- a/common/test/acceptance/tests/video/test_video_events.py +++ b/common/test/acceptance/tests/video/test_video_events.py @@ -4,7 +4,6 @@ import datetime import json from nose.plugins.attrib import attr import ddt -import unittest from ..helpers import EventsTestMixin from .test_video_module import VideoBaseTest diff --git a/lms/djangoapps/bulk_email/models.py b/lms/djangoapps/bulk_email/models.py index 0c8347d819..bf79d023b0 100644 --- a/lms/djangoapps/bulk_email/models.py +++ b/lms/djangoapps/bulk_email/models.py @@ -14,7 +14,7 @@ file and check it in at the same time as your model changes. To do that, import logging from django.conf import settings from django.contrib.auth.models import User -from django.db import models, transaction +from django.db import models from openedx.core.lib.html_to_text import html_to_text from openedx.core.lib.mail_utils import wrap_message diff --git a/lms/djangoapps/ccx/overrides.py b/lms/djangoapps/ccx/overrides.py index 79caed1a5c..aeae8b8662 100644 --- a/lms/djangoapps/ccx/overrides.py +++ b/lms/djangoapps/ccx/overrides.py @@ -5,7 +5,7 @@ by the individual custom courses feature. import json import logging -from django.db import transaction, IntegrityError +from django.db import transaction import request_cache diff --git a/lms/djangoapps/ccx/tests/test_utils.py b/lms/djangoapps/ccx/tests/test_utils.py index edefacec79..76c1ba9967 100644 --- a/lms/djangoapps/ccx/tests/test_utils.py +++ b/lms/djangoapps/ccx/tests/test_utils.py @@ -12,17 +12,12 @@ from student.roles import ( CourseInstructorRole, CourseStaffRole, ) -from student.tests.factories import ( - AdminFactory, - CourseEnrollmentFactory, - UserFactory -) +from student.tests.factories import AdminFactory from student.models import CourseEnrollment, CourseEnrollmentException from xmodule.modulestore.tests.django_utils import ( ModuleStoreTestCase, - SharedModuleStoreTestCase, TEST_DATA_SPLIT_MODULESTORE ) from xmodule.modulestore.tests.factories import CourseFactory diff --git a/lms/djangoapps/ccx/views.py b/lms/djangoapps/ccx/views.py index 86705f40e5..f24201331c 100644 --- a/lms/djangoapps/ccx/views.py +++ b/lms/djangoapps/ccx/views.py @@ -41,7 +41,6 @@ from instructor.views.api import _split_input_list from instructor.views.gradebook_api import get_grade_book_page from instructor.enrollment import ( enroll_email, - unenroll_email, get_email_params, ) diff --git a/lms/djangoapps/certificates/models.py b/lms/djangoapps/certificates/models.py index 42da820c1c..b98240c193 100644 --- a/lms/djangoapps/certificates/models.py +++ b/lms/djangoapps/certificates/models.py @@ -55,7 +55,6 @@ from django.contrib.auth.models import User from django.core.exceptions import ValidationError from django.db import models, transaction from django.db.models import Count -from django.db.models.signals import post_save from django.dispatch import receiver from django.utils.translation import ugettext_lazy as _ from django_extensions.db.fields import CreationDateTimeField diff --git a/lms/djangoapps/certificates/tests/test_models.py b/lms/djangoapps/certificates/tests/test_models.py index 3e25b6bb50..2227f78554 100644 --- a/lms/djangoapps/certificates/tests/test_models.py +++ b/lms/djangoapps/certificates/tests/test_models.py @@ -12,7 +12,6 @@ from certificates.models import ( ExampleCertificateSet, CertificateHtmlViewConfiguration, CertificateTemplateAsset, - EligibleCertificateManager, GeneratedCertificate, CertificateStatuses, ) diff --git a/lms/djangoapps/commerce/tests/test_views.py b/lms/djangoapps/commerce/tests/test_views.py index 1e5cd24f2a..c3df4e0a41 100644 --- a/lms/djangoapps/commerce/tests/test_views.py +++ b/lms/djangoapps/commerce/tests/test_views.py @@ -1,6 +1,5 @@ """ Tests for commerce views. """ -import json -from uuid import uuid4 + from nose.plugins.attrib import attr import ddt diff --git a/lms/djangoapps/course_blocks/transformers/tests/test_split_test.py b/lms/djangoapps/course_blocks/transformers/tests/test_split_test.py index 0a1850eda1..fd214d6f5d 100644 --- a/lms/djangoapps/course_blocks/transformers/tests/test_split_test.py +++ b/lms/djangoapps/course_blocks/transformers/tests/test_split_test.py @@ -7,7 +7,7 @@ import openedx.core.djangoapps.user_api.course_tag.api as course_tag_api from openedx.core.djangoapps.user_api.partition_schemes import RandomUserPartitionScheme from student.tests.factories import CourseEnrollmentFactory from xmodule.partitions.partitions import Group, UserPartition -from xmodule.modulestore.tests.factories import check_mongo_calls, check_mongo_calls_range +from xmodule.modulestore.tests.factories import check_mongo_calls from ...api import get_course_blocks from ..user_partitions import UserPartitionTransformer, _get_user_partition_groups diff --git a/lms/djangoapps/course_structure_api/v0/tests.py b/lms/djangoapps/course_structure_api/v0/tests.py index 000d8b2584..954c9beb45 100644 --- a/lms/djangoapps/course_structure_api/v0/tests.py +++ b/lms/djangoapps/course_structure_api/v0/tests.py @@ -14,7 +14,7 @@ from opaque_keys.edx.locator import CourseLocator from xmodule.error_module import ErrorDescriptor from xmodule.modulestore import ModuleStoreEnum from xmodule.modulestore.tests.django_utils import SharedModuleStoreTestCase -from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory, check_mongo_calls +from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory from xmodule.modulestore.xml import CourseLocationManager from xmodule.tests import get_test_system diff --git a/lms/djangoapps/course_structure_api/v0/views.py b/lms/djangoapps/course_structure_api/v0/views.py index a61e94433a..ebe60bb04d 100644 --- a/lms/djangoapps/course_structure_api/v0/views.py +++ b/lms/djangoapps/course_structure_api/v0/views.py @@ -6,7 +6,7 @@ from django.conf import settings from django.http import Http404 from rest_framework.authentication import SessionAuthentication from rest_framework_oauth.authentication import OAuth2Authentication -from rest_framework.exceptions import AuthenticationFailed, ParseError +from rest_framework.exceptions import AuthenticationFailed from rest_framework.generics import RetrieveAPIView, ListAPIView from rest_framework.permissions import IsAuthenticated from rest_framework.response import Response diff --git a/lms/djangoapps/courseware/access.py b/lms/djangoapps/courseware/access.py index fa4d244bb4..e6063dbdf5 100644 --- a/lms/djangoapps/courseware/access.py +++ b/lms/djangoapps/courseware/access.py @@ -28,7 +28,7 @@ from xmodule.course_module import ( CATALOG_VISIBILITY_ABOUT, ) from xmodule.error_module import ErrorDescriptor -from xmodule.x_module import XModule, DEPRECATION_VSCOMPAT_EVENT +from xmodule.x_module import XModule from xmodule.split_test_module import get_split_user_partitions from xmodule.partitions.partitions import NoSuchUserPartitionError, NoSuchUserPartitionGroupError @@ -54,8 +54,6 @@ from util.milestones_helpers import ( ) from ccx_keys.locator import CCXLocator -import dogstats_wrapper as dog_stats_api - from courseware.access_response import ( MilestoneError, MobileAvailabilityError, diff --git a/lms/djangoapps/courseware/entrance_exams.py b/lms/djangoapps/courseware/entrance_exams.py index 51429df539..82e3861e3d 100644 --- a/lms/djangoapps/courseware/entrance_exams.py +++ b/lms/djangoapps/courseware/entrance_exams.py @@ -1,7 +1,6 @@ """ This file contains all entrance exam related utils/logic. """ -from django.conf import settings from courseware.access import has_access from courseware.model_data import FieldDataCache, ScoresClient diff --git a/lms/djangoapps/courseware/features/navigation.py b/lms/djangoapps/courseware/features/navigation.py index 90c0517319..36f03e020a 100644 --- a/lms/djangoapps/courseware/features/navigation.py +++ b/lms/djangoapps/courseware/features/navigation.py @@ -5,7 +5,6 @@ from lettuce import world, step from common import course_location from problems_setup import PROBLEM_DICT -from nose.tools import assert_in @step(u'I am viewing a course with multiple sections') diff --git a/lms/djangoapps/courseware/management/commands/dump_course_ids.py b/lms/djangoapps/courseware/management/commands/dump_course_ids.py index 04ad8eb01d..ff66e4c12c 100644 --- a/lms/djangoapps/courseware/management/commands/dump_course_ids.py +++ b/lms/djangoapps/courseware/management/commands/dump_course_ids.py @@ -3,9 +3,8 @@ from optparse import make_option from textwrap import dedent -from django.core.management.base import BaseCommand, CommandError +from django.core.management.base import BaseCommand -from xmodule.modulestore.django import modulestore from openedx.core.djangoapps.content.course_overviews.models import CourseOverview diff --git a/lms/djangoapps/courseware/management/commands/tests/test_dump_course.py b/lms/djangoapps/courseware/management/commands/tests/test_dump_course.py index ec2042b49a..bbff7ff15e 100644 --- a/lms/djangoapps/courseware/management/commands/tests/test_dump_course.py +++ b/lms/djangoapps/courseware/management/commands/tests/test_dump_course.py @@ -16,7 +16,7 @@ from django.core.management import call_command from xmodule.modulestore import ModuleStoreEnum from xmodule.modulestore.django import modulestore -from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase, mixed_store_config +from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase from xmodule.modulestore.tests.django_utils import ( TEST_DATA_MONGO_MODULESTORE, TEST_DATA_SPLIT_MODULESTORE ) diff --git a/lms/djangoapps/courseware/tests/test_self_paced_overrides.py b/lms/djangoapps/courseware/tests/test_self_paced_overrides.py index 1a1abcacc8..14fa347c36 100644 --- a/lms/djangoapps/courseware/tests/test_self_paced_overrides.py +++ b/lms/djangoapps/courseware/tests/test_self_paced_overrides.py @@ -3,7 +3,6 @@ import datetime import pytz -from dateutil.tz import tzutc from django.test.utils import override_settings from mock import patch diff --git a/lms/djangoapps/courseware/tests/test_tabs.py b/lms/djangoapps/courseware/tests/test_tabs.py index 4d8b7f8d68..d94de34be5 100644 --- a/lms/djangoapps/courseware/tests/test_tabs.py +++ b/lms/djangoapps/courseware/tests/test_tabs.py @@ -2,7 +2,6 @@ Test cases for tabs. """ -from django.conf import settings from django.core.urlresolvers import reverse from django.http import Http404 from mock import MagicMock, Mock, patch diff --git a/lms/djangoapps/courseware/tests/test_video_mongo.py b/lms/djangoapps/courseware/tests/test_video_mongo.py index 31c008d8f0..540317bbc4 100644 --- a/lms/djangoapps/courseware/tests/test_video_mongo.py +++ b/lms/djangoapps/courseware/tests/test_video_mongo.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- """Video xmodule tests in mongo.""" + import ddt -import itertools import json from collections import OrderedDict from path import Path as path diff --git a/lms/djangoapps/courseware/tests/test_views.py b/lms/djangoapps/courseware/tests/test_views.py index 3606a3be87..5a21d32c4c 100644 --- a/lms/djangoapps/courseware/tests/test_views.py +++ b/lms/djangoapps/courseware/tests/test_views.py @@ -2,7 +2,7 @@ """ Tests courseware views.py """ -import cgi + from urllib import urlencode import ddt import json diff --git a/lms/djangoapps/courseware/user_state_client.py b/lms/djangoapps/courseware/user_state_client.py index b965a15ebe..57d09c1ec7 100644 --- a/lms/djangoapps/courseware/user_state_client.py +++ b/lms/djangoapps/courseware/user_state_client.py @@ -14,7 +14,7 @@ except ImportError: import dogstats_wrapper as dog_stats_api from django.contrib.auth.models import User -from xblock.fields import Scope, ScopeBase +from xblock.fields import Scope from courseware.models import StudentModule, BaseStudentModuleHistory from edx_user_state_client.interface import XBlockUserStateClient, XBlockUserState diff --git a/lms/djangoapps/dashboard/tests/test_sysadmin.py b/lms/djangoapps/dashboard/tests/test_sysadmin.py index a3a954c1d9..6a0d063d0f 100644 --- a/lms/djangoapps/dashboard/tests/test_sysadmin.py +++ b/lms/djangoapps/dashboard/tests/test_sysadmin.py @@ -10,21 +10,16 @@ from util.date_utils import get_time_display, DEFAULT_DATE_TIME_FORMAT from nose.plugins.attrib import attr from django.conf import settings -from django.contrib.auth.hashers import check_password -from django.contrib.auth.models import User from django.core.urlresolvers import reverse from django.test.client import Client from django.test.utils import override_settings from django.utils.timezone import utc as UTC -from django.utils.translation import ugettext as _ import mongoengine from opaque_keys.edx.locations import SlashSeparatedCourseKey from dashboard.models import CourseImportLog -from dashboard.sysadmin import Users from dashboard.git_import import GitImportError from datetime import datetime -from external_auth.models import ExternalAuthMap from student.roles import CourseStaffRole, GlobalStaff from student.tests.factories import UserFactory from xmodule.modulestore.django import modulestore diff --git a/lms/djangoapps/discussion_api/forms.py b/lms/djangoapps/discussion_api/forms.py index 596356472c..ea9486bd3f 100644 --- a/lms/djangoapps/discussion_api/forms.py +++ b/lms/djangoapps/discussion_api/forms.py @@ -8,8 +8,7 @@ from django.forms import ( ChoiceField, Form, IntegerField, - NullBooleanField, - Select) +) from opaque_keys import InvalidKeyError from opaque_keys.edx.locator import CourseLocator diff --git a/lms/djangoapps/django_comment_client/management/commands/get_discussion_link.py b/lms/djangoapps/django_comment_client/management/commands/get_discussion_link.py index 603f0269f9..bd7e6d638c 100644 --- a/lms/djangoapps/django_comment_client/management/commands/get_discussion_link.py +++ b/lms/djangoapps/django_comment_client/management/commands/get_discussion_link.py @@ -1,5 +1,4 @@ from django.core.management.base import BaseCommand, CommandError -from opaque_keys import InvalidKeyError from opaque_keys.edx.keys import CourseKey from courseware.courses import get_course diff --git a/lms/djangoapps/edxnotes/views.py b/lms/djangoapps/edxnotes/views.py index a4d0a5bb1b..ad696ddc69 100644 --- a/lms/djangoapps/edxnotes/views.py +++ b/lms/djangoapps/edxnotes/views.py @@ -4,7 +4,7 @@ Views related to EdxNotes. import json import logging from django.contrib.auth.decorators import login_required -from django.http import HttpResponse, HttpResponseBadRequest, Http404 +from django.http import HttpResponse, Http404 from django.conf import settings from django.core.urlresolvers import reverse from django.views.decorators.http import require_GET diff --git a/lms/djangoapps/instructor/tests/test_enrollment.py b/lms/djangoapps/instructor/tests/test_enrollment.py index 765fb3ca02..02b7348d6c 100644 --- a/lms/djangoapps/instructor/tests/test_enrollment.py +++ b/lms/djangoapps/instructor/tests/test_enrollment.py @@ -15,7 +15,6 @@ from django.utils.translation import override as override_language from nose.plugins.attrib import attr from ccx_keys.locator import CCXLocator from student.tests.factories import UserFactory -from xmodule.modulestore.django import modulestore from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory from lms.djangoapps.ccx.tests.factories import CcxFactory diff --git a/lms/djangoapps/instructor_task/tasks_helper.py b/lms/djangoapps/instructor_task/tasks_helper.py index bd32135472..8e54d77fec 100644 --- a/lms/djangoapps/instructor_task/tasks_helper.py +++ b/lms/djangoapps/instructor_task/tasks_helper.py @@ -18,7 +18,7 @@ from celery import Task, current_task from celery.states import SUCCESS, FAILURE from django.contrib.auth.models import User from django.core.files.storage import DefaultStorage -from django.db import transaction, reset_queries +from django.db import reset_queries from django.db.models import Q import dogstats_wrapper as dog_stats_api from pytz import UTC diff --git a/lms/djangoapps/lms_xblock/test/test_runtime.py b/lms/djangoapps/lms_xblock/test/test_runtime.py index 3483a6de52..dc97754d07 100644 --- a/lms/djangoapps/lms_xblock/test/test_runtime.py +++ b/lms/djangoapps/lms_xblock/test/test_runtime.py @@ -2,7 +2,6 @@ Tests of the LMS XBlock Runtime and associated utilities """ -from django.contrib.auth.models import User from django.conf import settings from ddt import ddt, data from django.test import TestCase diff --git a/lms/djangoapps/lti_provider/models.py b/lms/djangoapps/lti_provider/models.py index a42f686fb1..6af85a67ef 100644 --- a/lms/djangoapps/lti_provider/models.py +++ b/lms/djangoapps/lti_provider/models.py @@ -14,7 +14,7 @@ import logging from xmodule_django.models import CourseKeyField, UsageKeyField -from provider.utils import short_token, long_token +from provider.utils import short_token log = logging.getLogger("edx.lti_provider") diff --git a/lms/djangoapps/mobile_api/course_info/views.py b/lms/djangoapps/mobile_api/course_info/views.py index e9e1bd231e..c5b06dc74c 100644 --- a/lms/djangoapps/mobile_api/course_info/views.py +++ b/lms/djangoapps/mobile_api/course_info/views.py @@ -1,7 +1,7 @@ """ Views for course info API """ -from django.http import Http404 + from rest_framework import generics from rest_framework.response import Response diff --git a/lms/djangoapps/shoppingcart/management/commands/retire_order.py b/lms/djangoapps/shoppingcart/management/commands/retire_order.py index 6ab3a63978..e6539e2c13 100644 --- a/lms/djangoapps/shoppingcart/management/commands/retire_order.py +++ b/lms/djangoapps/shoppingcart/management/commands/retire_order.py @@ -3,7 +3,7 @@ Script for retiring order that went through cybersource but weren't marked as "purchased" in the db """ -from django.core.management.base import BaseCommand, CommandError +from django.core.management.base import BaseCommand from shoppingcart.models import Order from shoppingcart.exceptions import UnexpectedOrderItemStatus, InvalidStatusToRetire diff --git a/lms/djangoapps/survey/tests/test_views.py b/lms/djangoapps/survey/tests/test_views.py index ebd16373ff..3924ae81d5 100644 --- a/lms/djangoapps/survey/tests/test_views.py +++ b/lms/djangoapps/survey/tests/test_views.py @@ -6,7 +6,6 @@ import json from collections import OrderedDict from django.test.client import Client -from django.contrib.auth.models import User from django.core.urlresolvers import reverse from survey.models import SurveyForm, SurveyAnswer diff --git a/lms/djangoapps/teams/management/commands/tests/test_reindex_course_team.py b/lms/djangoapps/teams/management/commands/tests/test_reindex_course_team.py index 49c5f96430..62e28a886c 100644 --- a/lms/djangoapps/teams/management/commands/tests/test_reindex_course_team.py +++ b/lms/djangoapps/teams/management/commands/tests/test_reindex_course_team.py @@ -1,6 +1,6 @@ """ Tests for course_team reindex command """ + import ddt -import mock from mock import patch from django.core.management import call_command, CommandError diff --git a/lms/djangoapps/verify_student/models.py b/lms/djangoapps/verify_student/models.py index c761835db8..a06c360898 100644 --- a/lms/djangoapps/verify_student/models.py +++ b/lms/djangoapps/verify_student/models.py @@ -26,7 +26,7 @@ from django.core.exceptions import ObjectDoesNotExist from django.core.urlresolvers import reverse from django.core.cache import cache from django.dispatch import receiver -from django.db import models, transaction, IntegrityError +from django.db import models, transaction from django.utils.translation import ugettext as _, ugettext_lazy from boto.s3.connection import S3Connection diff --git a/lms/djangoapps/verify_student/views.py b/lms/djangoapps/verify_student/views.py index 81aa0c2487..046d11a684 100644 --- a/lms/djangoapps/verify_student/views.py +++ b/lms/djangoapps/verify_student/views.py @@ -23,7 +23,7 @@ from django.utils.decorators import method_decorator from django.utils.translation import ugettext as _, ugettext_lazy from django.views.decorators.csrf import csrf_exempt from django.views.decorators.http import require_POST -from django.views.generic.base import View, RedirectView +from django.views.generic.base import View import analytics from eventtracking import tracker diff --git a/openedx/core/djangoapps/content/course_overviews/management/commands/generate_course_overview.py b/openedx/core/djangoapps/content/course_overviews/management/commands/generate_course_overview.py index 6fffc27694..9bf02783f2 100644 --- a/openedx/core/djangoapps/content/course_overviews/management/commands/generate_course_overview.py +++ b/openedx/core/djangoapps/content/course_overviews/management/commands/generate_course_overview.py @@ -1,8 +1,8 @@ """ Command to load course overviews. """ + import logging -from optparse import make_option from django.core.management.base import BaseCommand, CommandError from opaque_keys import InvalidKeyError diff --git a/openedx/core/djangoapps/course_groups/models.py b/openedx/core/djangoapps/course_groups/models.py index 7d1c15f303..f7f682b2a4 100644 --- a/openedx/core/djangoapps/course_groups/models.py +++ b/openedx/core/djangoapps/course_groups/models.py @@ -6,7 +6,7 @@ import json import logging from django.contrib.auth.models import User -from django.db import models, transaction, IntegrityError +from django.db import models, transaction from util.db import outer_atomic from django.core.exceptions import ValidationError from django.db.models.signals import pre_delete diff --git a/openedx/core/djangoapps/course_groups/tests/helpers.py b/openedx/core/djangoapps/course_groups/tests/helpers.py index f5d09dfad2..53c07762ab 100644 --- a/openedx/core/djangoapps/course_groups/tests/helpers.py +++ b/openedx/core/djangoapps/course_groups/tests/helpers.py @@ -1,7 +1,7 @@ """ Helper methods for testing cohorts. """ -import factory + from factory import post_generation, Sequence from factory.django import DjangoModelFactory import json diff --git a/openedx/core/djangoapps/credit/serializers.py b/openedx/core/djangoapps/credit/serializers.py index a5d727738d..a2c7fca6a7 100644 --- a/openedx/core/djangoapps/credit/serializers.py +++ b/openedx/core/djangoapps/credit/serializers.py @@ -5,7 +5,6 @@ import datetime import logging from django.conf import settings -from opaque_keys import InvalidKeyError import pytz from rest_framework import serializers from rest_framework.exceptions import PermissionDenied diff --git a/openedx/core/djangoapps/profile_images/views.py b/openedx/core/djangoapps/profile_images/views.py index 7d967254a4..a7dfddc6a4 100644 --- a/openedx/core/djangoapps/profile_images/views.py +++ b/openedx/core/djangoapps/profile_images/views.py @@ -19,7 +19,7 @@ from openedx.core.lib.api.authentication import ( SessionAuthenticationAllowInactiveUser, ) from openedx.core.lib.api.parsers import TypedFileUploadParser -from openedx.core.lib.api.permissions import IsUserInUrl, IsUserInUrlOrStaff +from openedx.core.lib.api.permissions import IsUserInUrl from openedx.core.lib.api.view_utils import DeveloperErrorViewMixin from openedx.core.djangoapps.user_api.accounts.image_helpers import get_profile_image_names, set_has_profile_image from .exceptions import ImageValidationError diff --git a/openedx/core/djangoapps/programs/tests/test_models.py b/openedx/core/djangoapps/programs/tests/test_models.py index 6ea3fcba71..8b2118e662 100644 --- a/openedx/core/djangoapps/programs/tests/test_models.py +++ b/openedx/core/djangoapps/programs/tests/test_models.py @@ -4,7 +4,6 @@ from django.test import TestCase import mock from nose.plugins.attrib import attr -from openedx.core.djangoapps.programs.models import ProgramsApiConfig from openedx.core.djangoapps.programs.tests.mixins import ProgramsApiConfigMixin diff --git a/openedx/core/lib/tests/test_xblock_utils.py b/openedx/core/lib/tests/test_xblock_utils.py index b2d206d7f4..3944191977 100644 --- a/openedx/core/lib/tests/test_xblock_utils.py +++ b/openedx/core/lib/tests/test_xblock_utils.py @@ -9,7 +9,6 @@ import uuid from django.test.client import RequestFactory -from courseware.models import StudentModule # pylint: disable=import-error from lms.djangoapps.lms_xblock.runtime import quote_slashes from xblock.fragment import Fragment from xmodule.modulestore import ModuleStoreEnum @@ -23,7 +22,6 @@ from openedx.core.lib.xblock_utils import ( replace_jump_to_id_urls, replace_course_urls, replace_static_urls, - grade_histogram, sanitize_html_id ) From fac216c35b45f8c5a9d6b307852f7774e9756fba Mon Sep 17 00:00:00 2001 From: Ned Batchelder Date: Fri, 8 Apr 2016 12:05:38 -0400 Subject: [PATCH 2/2] Lower the overall pylint count to 4175 --- scripts/all-tests.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/all-tests.sh b/scripts/all-tests.sh index 44dc7d54de..44ca3607a4 100755 --- a/scripts/all-tests.sh +++ b/scripts/all-tests.sh @@ -11,7 +11,7 @@ set -e ############################################################################### # Violations thresholds for failing the build -export PYLINT_THRESHOLD=4500 +export PYLINT_THRESHOLD=4175 export JSHINT_THRESHOLD=9080 doCheckVars() {