From 142762c1374dbafd8cb1264cd334a9cf0d1d148d Mon Sep 17 00:00:00 2001 From: Ned Batchelder Date: Fri, 14 Jun 2013 15:03:57 -0400 Subject: [PATCH 1/8] Rearrange pylintrc a little bit. --- pylintrc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pylintrc b/pylintrc index d4085379b4..0d4ce31185 100644 --- a/pylintrc +++ b/pylintrc @@ -36,8 +36,9 @@ load-plugins= disable= # Never going to use these # C0301: Line too long -# W0142: Used * or ** magic # W0141: Used builtin function 'map' +# W0142: Used * or ** magic + C0301,W0141,W0142, # Might use these when the code is in better shape # C0302: Too many lines in module @@ -50,7 +51,7 @@ disable= # R0912: Too many branches # R0913: Too many arguments # R0914: Too many local variables - C0301,C0302,W0141,W0142,R0201,R0901,R0902,R0903,R0904,R0911,R0912,R0913,R0914 + C0302,R0201,R0901,R0902,R0903,R0904,R0911,R0912,R0913,R0914 [REPORTS] From c53fff9ff4a12bac48425623a0ff455acaf0dead Mon Sep 17 00:00:00 2001 From: Ned Batchelder Date: Fri, 14 Jun 2013 15:24:29 -0400 Subject: [PATCH 2/8] Tell pylint to shut up about us telling it to shut up. --- pylintrc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pylintrc b/pylintrc index 0d4ce31185..af958e4af4 100644 --- a/pylintrc +++ b/pylintrc @@ -35,10 +35,11 @@ load-plugins= # it should appear only once). disable= # Never going to use these +# I0011: Locally disabling W0232 # C0301: Line too long # W0141: Used builtin function 'map' # W0142: Used * or ** magic - C0301,W0141,W0142, + I0011,C0301,W0141,W0142, # Might use these when the code is in better shape # C0302: Too many lines in module From 181b1e979b22a119220c4e211f86f7f9d4cdf38c Mon Sep 17 00:00:00 2001 From: Ned Batchelder Date: Fri, 14 Jun 2013 13:30:47 -0400 Subject: [PATCH 3/8] Remove unused imports from common, as reported by pylint. --- common/djangoapps/cache_toolbox/core.py | 1 - common/djangoapps/course_groups/cohorts.py | 3 +-- common/djangoapps/course_groups/views.py | 10 ++-------- common/djangoapps/mitxmako/makoloader.py | 1 - common/djangoapps/status/status.py | 1 - .../student/management/commands/6002exportusers.py | 5 ----- .../student/management/commands/6002importusers.py | 6 ------ .../student/management/commands/assigngroups.py | 5 ----- .../management/commands/create_random_users.py | 4 +--- .../student/management/commands/emaillist.py | 5 ----- .../student/management/commands/massemail.py | 5 ----- .../student/management/commands/massemailtxt.py | 3 --- .../student/management/commands/pearson_dump.py | 2 +- .../management/commands/pearson_import_conf_zip.py | 5 +---- .../management/commands/tests/test_pearson.py | 2 +- .../student/management/commands/userinfo.py | 5 ----- common/djangoapps/student/views.py | 8 ++------ common/djangoapps/terrain/browser.py | 6 +++--- common/djangoapps/terrain/course_helpers.py | 3 +-- common/djangoapps/terrain/steps.py | 2 +- common/djangoapps/track/middleware.py | 2 -- common/djangoapps/util/models.py | 2 -- common/djangoapps/util/tests/test_memcache.py | 1 - common/djangoapps/util/tests/test_submit_feedback.py | 1 - common/djangoapps/util/views.py | 12 ++---------- common/lib/capa/capa/checker.py | 1 - common/lib/capa/capa/customrender.py | 2 -- common/lib/capa/capa/responsetypes.py | 1 - common/lib/capa/capa/tests/test_html_render.py | 1 - common/lib/capa/capa/util.py | 2 +- common/lib/chem/chem/chemcalc.py | 11 +---------- common/lib/symmath/symmath/formula.py | 4 +--- common/lib/symmath/symmath/symmath_check.py | 4 ---- .../xmodule/xmodule/modulestore/tests/factories.py | 1 - .../xmodule/modulestore/tests/test_modulestore.py | 4 ++-- .../xmodule/xmodule/modulestore/tests/test_mongo.py | 1 - .../combined_open_ended_modulev1.py | 3 --- .../grading_service_module.py | 1 - .../open_ended_image_submission.py | 2 -- .../open_ended_grading_classes/open_ended_module.py | 2 -- .../open_ended_grading_classes/openendedchild.py | 6 ------ common/lib/xmodule/xmodule/progress.py | 1 - common/lib/xmodule/xmodule/schematic_module.py | 1 - common/lib/xmodule/xmodule/template_module.py | 1 - common/lib/xmodule/xmodule/tests/test_html_module.py | 1 - .../lib/xmodule/xmodule/tests/test_peer_grading.py | 4 ---- .../xmodule/xmodule/tests/test_randomize_module.py | 10 +--------- common/lib/xmodule/xmodule/tests/test_stringify.py | 2 +- .../xmodule/xmodule/tests/test_util_open_ended.py | 2 +- common/lib/xmodule/xmodule/timelimit_module.py | 1 - 50 files changed, 24 insertions(+), 145 deletions(-) diff --git a/common/djangoapps/cache_toolbox/core.py b/common/djangoapps/cache_toolbox/core.py index a9c7002aa6..9a7be940b8 100644 --- a/common/djangoapps/cache_toolbox/core.py +++ b/common/djangoapps/cache_toolbox/core.py @@ -12,7 +12,6 @@ from django.core.cache import cache from django.db import DEFAULT_DB_ALIAS from . import app_settings -from xmodule.contentstore.content import StaticContent def get_instance(model, instance_or_pk, timeout=None, using=None): diff --git a/common/djangoapps/course_groups/cohorts.py b/common/djangoapps/course_groups/cohorts.py index 7924012bfe..d2c7e3a782 100644 --- a/common/djangoapps/course_groups/cohorts.py +++ b/common/djangoapps/course_groups/cohorts.py @@ -3,7 +3,6 @@ This file contains the logic for cohort groups, as exposed internally to the forums, and to the cohort admin views. """ -from django.contrib.auth.models import User from django.http import Http404 import logging import random @@ -27,7 +26,7 @@ def local_random(): """ # ironic, isn't it? global _local_random - + if _local_random is None: _local_random = random.Random() diff --git a/common/djangoapps/course_groups/views.py b/common/djangoapps/course_groups/views.py index 6d5ac43fb0..764f6c301d 100644 --- a/common/djangoapps/course_groups/views.py +++ b/common/djangoapps/course_groups/views.py @@ -1,24 +1,18 @@ from django_future.csrf import ensure_csrf_cookie -from django.contrib.auth.decorators import login_required from django.views.decorators.http import require_POST from django.contrib.auth.models import User -from django.core.context_processors import csrf from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger from django.core.urlresolvers import reverse -from django.http import HttpResponse, HttpResponseForbidden, Http404 -from django.shortcuts import redirect +from django.http import HttpResponse import json import logging import re from courseware.courses import get_course_with_access -from mitxmako.shortcuts import render_to_response, render_to_string +from mitxmako.shortcuts import render_to_response -from .models import CourseUserGroup from . import cohorts -import track.views - log = logging.getLogger(__name__) diff --git a/common/djangoapps/mitxmako/makoloader.py b/common/djangoapps/mitxmako/makoloader.py index 6b6b31d464..06ae2219e6 100644 --- a/common/djangoapps/mitxmako/makoloader.py +++ b/common/djangoapps/mitxmako/makoloader.py @@ -7,7 +7,6 @@ from django.template.loaders.filesystem import Loader as FilesystemLoader from django.template.loaders.app_directories import Loader as AppDirectoriesLoader from mitxmako.template import Template -import mitxmako.middleware import tempdir diff --git a/common/djangoapps/status/status.py b/common/djangoapps/status/status.py index deacd9c631..b3ffd6a84c 100644 --- a/common/djangoapps/status/status.py +++ b/common/djangoapps/status/status.py @@ -6,7 +6,6 @@ from django.conf import settings import json import logging import os -import sys log = logging.getLogger(__name__) diff --git a/common/djangoapps/student/management/commands/6002exportusers.py b/common/djangoapps/student/management/commands/6002exportusers.py index 31d8092d3f..a92bb0a60c 100644 --- a/common/djangoapps/student/management/commands/6002exportusers.py +++ b/common/djangoapps/student/management/commands/6002exportusers.py @@ -11,12 +11,7 @@ import datetime import json -import os.path - -from lxml import etree - from django.core.management.base import BaseCommand -from django.conf import settings from django.contrib.auth.models import User from student.models import UserProfile diff --git a/common/djangoapps/student/management/commands/6002importusers.py b/common/djangoapps/student/management/commands/6002importusers.py index 64be84d910..1f98bd7522 100644 --- a/common/djangoapps/student/management/commands/6002importusers.py +++ b/common/djangoapps/student/management/commands/6002importusers.py @@ -3,17 +3,11 @@ ## See export for more info -import datetime import json import dateutil.parser -import os.path - -from lxml import etree - from django.core.management.base import BaseCommand -from django.conf import settings from django.contrib.auth.models import User from student.models import UserProfile diff --git a/common/djangoapps/student/management/commands/assigngroups.py b/common/djangoapps/student/management/commands/assigngroups.py index 5269c8690e..3e36bf3129 100644 --- a/common/djangoapps/student/management/commands/assigngroups.py +++ b/common/djangoapps/student/management/commands/assigngroups.py @@ -1,9 +1,4 @@ -import os.path - -from lxml import etree - from django.core.management.base import BaseCommand -from django.conf import settings from django.contrib.auth.models import User import mitxmako.middleware as middleware diff --git a/common/djangoapps/student/management/commands/create_random_users.py b/common/djangoapps/student/management/commands/create_random_users.py index 70374d02f2..3000c86601 100644 --- a/common/djangoapps/student/management/commands/create_random_users.py +++ b/common/djangoapps/student/management/commands/create_random_users.py @@ -2,9 +2,7 @@ ## A script to create some dummy users from django.core.management.base import BaseCommand -from django.conf import settings -from django.contrib.auth.models import User -from student.models import UserProfile, CourseEnrollment +from student.models import CourseEnrollment from student.views import _do_create_account, get_random_post_override diff --git a/common/djangoapps/student/management/commands/emaillist.py b/common/djangoapps/student/management/commands/emaillist.py index 4011c41bd2..d3911927ac 100644 --- a/common/djangoapps/student/management/commands/emaillist.py +++ b/common/djangoapps/student/management/commands/emaillist.py @@ -1,9 +1,4 @@ -import os.path - -from lxml import etree - from django.core.management.base import BaseCommand -from django.conf import settings from django.contrib.auth.models import User import mitxmako.middleware as middleware diff --git a/common/djangoapps/student/management/commands/massemail.py b/common/djangoapps/student/management/commands/massemail.py index c6f6e5f6d4..1bb65fd169 100644 --- a/common/djangoapps/student/management/commands/massemail.py +++ b/common/djangoapps/student/management/commands/massemail.py @@ -1,9 +1,4 @@ -import os.path - -from lxml import etree - from django.core.management.base import BaseCommand -from django.conf import settings from django.contrib.auth.models import User import mitxmako.middleware as middleware diff --git a/common/djangoapps/student/management/commands/massemailtxt.py b/common/djangoapps/student/management/commands/massemailtxt.py index 4ea75f972b..fec354e974 100644 --- a/common/djangoapps/student/management/commands/massemailtxt.py +++ b/common/djangoapps/student/management/commands/massemailtxt.py @@ -1,11 +1,8 @@ import os.path import time -from lxml import etree - from django.core.management.base import BaseCommand from django.conf import settings -from django.contrib.auth.models import User import mitxmako.middleware as middleware diff --git a/common/djangoapps/student/management/commands/pearson_dump.py b/common/djangoapps/student/management/commands/pearson_dump.py index 2aade8cf5f..0c9e215f77 100644 --- a/common/djangoapps/student/management/commands/pearson_dump.py +++ b/common/djangoapps/student/management/commands/pearson_dump.py @@ -2,7 +2,7 @@ from optparse import make_option from json import dump from datetime import datetime -from django.core.management.base import BaseCommand, CommandError +from django.core.management.base import BaseCommand from student.models import TestCenterRegistration diff --git a/common/djangoapps/student/management/commands/pearson_import_conf_zip.py b/common/djangoapps/student/management/commands/pearson_import_conf_zip.py index 2339383719..1e06a0931a 100644 --- a/common/djangoapps/student/management/commands/pearson_import_conf_zip.py +++ b/common/djangoapps/student/management/commands/pearson_import_conf_zip.py @@ -3,11 +3,8 @@ import csv from zipfile import ZipFile, is_zipfile from time import strptime, strftime -from collections import OrderedDict from datetime import datetime -from os.path import isdir -from optparse import make_option -from dogapi import dog_http_api, dog_stats_api +from dogapi import dog_http_api from django.core.management.base import BaseCommand, CommandError from django.conf import settings diff --git a/common/djangoapps/student/management/commands/tests/test_pearson.py b/common/djangoapps/student/management/commands/tests/test_pearson.py index 65d628fba0..ca6e20673b 100644 --- a/common/djangoapps/student/management/commands/tests/test_pearson.py +++ b/common/djangoapps/student/management/commands/tests/test_pearson.py @@ -14,7 +14,7 @@ from django.test import TestCase from django.core.management import call_command from nose.plugins.skip import SkipTest -from student.models import User, TestCenterRegistration, TestCenterUser, get_testcenter_registration +from student.models import User, TestCenterUser, get_testcenter_registration log = logging.getLogger(__name__) diff --git a/common/djangoapps/student/management/commands/userinfo.py b/common/djangoapps/student/management/commands/userinfo.py index e458995284..5467db1733 100644 --- a/common/djangoapps/student/management/commands/userinfo.py +++ b/common/djangoapps/student/management/commands/userinfo.py @@ -1,9 +1,4 @@ -import os.path - -from lxml import etree - from django.core.management.base import BaseCommand -from django.conf import settings from django.contrib.auth.models import User import mitxmako.middleware as middleware diff --git a/common/djangoapps/student/views.py b/common/djangoapps/student/views.py index f129f1b4b1..de3e52b080 100644 --- a/common/djangoapps/student/views.py +++ b/common/djangoapps/student/views.py @@ -4,7 +4,6 @@ import json import logging import random import string -import sys import urllib import uuid import time @@ -20,9 +19,9 @@ from django.core.mail import send_mail from django.core.urlresolvers import reverse from django.core.validators import validate_email, validate_slug, ValidationError from django.db import IntegrityError, transaction -from django.http import HttpResponse, HttpResponseBadRequest, HttpResponseForbidden, HttpResponseNotAllowed, HttpResponseRedirect, Http404 +from django.http import HttpResponse, HttpResponseBadRequest, HttpResponseForbidden, HttpResponseNotAllowed, Http404 from django.shortcuts import redirect -from django_future.csrf import ensure_csrf_cookie, csrf_exempt +from django_future.csrf import ensure_csrf_cookie from django.utils.http import cookie_date from mitxmako.shortcuts import render_to_response, render_to_string @@ -39,14 +38,11 @@ from certificates.models import CertificateStatuses, certificate_status_for_stud from xmodule.course_module import CourseDescriptor from xmodule.modulestore.exceptions import ItemNotFoundError from xmodule.modulestore.django import modulestore -from xmodule.modulestore import Location from collections import namedtuple from courseware.courses import get_courses, sort_by_announcement from courseware.access import has_access -from courseware.views import get_module_for_descriptor, jump_to -from courseware.model_data import ModelDataCache from statsd import statsd from pytz import UTC diff --git a/common/djangoapps/terrain/browser.py b/common/djangoapps/terrain/browser.py index d2a9480b35..d237edc4b7 100644 --- a/common/djangoapps/terrain/browser.py +++ b/common/djangoapps/terrain/browser.py @@ -4,7 +4,6 @@ Browser set up for acceptance tests. #pylint: disable=E1101 #pylint: disable=W0613 -#pylint: disable=W0611 from lettuce import before, after, world from splinter.browser import Browser @@ -15,8 +14,9 @@ from selenium.common.exceptions import WebDriverException # Let the LMS and CMS do their one-time setup # For example, setting up mongo caches -from lms import one_time_startup -from cms import one_time_startup +# These names aren't used, but do important work on import. +from lms import one_time_startup # pylint: disable=W0611 +from cms import one_time_startup # pylint: disable=W0611 # There is an import issue when using django-staticfiles with lettuce # Lettuce assumes that we are using django.contrib.staticfiles, diff --git a/common/djangoapps/terrain/course_helpers.py b/common/djangoapps/terrain/course_helpers.py index fc666d7904..fbc9409e7b 100644 --- a/common/djangoapps/terrain/course_helpers.py +++ b/common/djangoapps/terrain/course_helpers.py @@ -1,7 +1,7 @@ # pylint: disable=C0111 # pylint: disable=W0621 -from lettuce import world, step +from lettuce import world from .factories import * from django.conf import settings from django.http import HttpRequest @@ -15,7 +15,6 @@ from xmodule.templates import update_templates from bs4 import BeautifulSoup import os.path from urllib import quote_plus -from lettuce.django import django_url @world.absorb diff --git a/common/djangoapps/terrain/steps.py b/common/djangoapps/terrain/steps.py index 6e512982b7..f31be894f9 100644 --- a/common/djangoapps/terrain/steps.py +++ b/common/djangoapps/terrain/steps.py @@ -15,7 +15,7 @@ from lettuce import world, step from .course_helpers import * from .ui_helpers import * from lettuce.django import django_url -from nose.tools import assert_equals, assert_in +from nose.tools import assert_equals from logging import getLogger logger = getLogger(__name__) diff --git a/common/djangoapps/track/middleware.py b/common/djangoapps/track/middleware.py index 52d914aeef..7fc02d9969 100644 --- a/common/djangoapps/track/middleware.py +++ b/common/djangoapps/track/middleware.py @@ -1,7 +1,5 @@ import json -from django.conf import settings - import views diff --git a/common/djangoapps/util/models.py b/common/djangoapps/util/models.py index 71a8362390..6b20219993 100644 --- a/common/djangoapps/util/models.py +++ b/common/djangoapps/util/models.py @@ -1,3 +1 @@ -from django.db import models - # Create your models here. diff --git a/common/djangoapps/util/tests/test_memcache.py b/common/djangoapps/util/tests/test_memcache.py index de8d352c38..60b3a0d0cc 100644 --- a/common/djangoapps/util/tests/test_memcache.py +++ b/common/djangoapps/util/tests/test_memcache.py @@ -4,7 +4,6 @@ Tests for memcache in util app from django.test import TestCase from django.core.cache import get_cache -from django.conf import settings from util.memcache import safe_key diff --git a/common/djangoapps/util/tests/test_submit_feedback.py b/common/djangoapps/util/tests/test_submit_feedback.py index b66d3d642b..6461ffa8b7 100644 --- a/common/djangoapps/util/tests/test_submit_feedback.py +++ b/common/djangoapps/util/tests/test_submit_feedback.py @@ -1,6 +1,5 @@ """Tests for the Zendesk""" -from django.conf import settings from django.contrib.auth.models import AnonymousUser from django.http import Http404 from django.test import TestCase diff --git a/common/djangoapps/util/views.py b/common/djangoapps/util/views.py index aa592d25e8..851202caec 100644 --- a/common/djangoapps/util/views.py +++ b/common/djangoapps/util/views.py @@ -1,20 +1,12 @@ -import datetime import json import logging -import pprint import sys from django.conf import settings -from django.contrib.auth.models import User -from django.core.context_processors import csrf -from django.core.mail import send_mail from django.core.validators import ValidationError, validate_email -from django.http import Http404, HttpResponse, HttpResponseBadRequest, HttpResponseNotAllowed, HttpResponseServerError -from django.shortcuts import redirect -from django_future.csrf import ensure_csrf_cookie +from django.http import Http404, HttpResponse, HttpResponseNotAllowed from dogapi import dog_stats_api -from mitxmako.shortcuts import render_to_response, render_to_string -from urllib import urlencode +from mitxmako.shortcuts import render_to_response import zendesk import calc diff --git a/common/lib/capa/capa/checker.py b/common/lib/capa/capa/checker.py index 15358aac9e..87cf68d230 100755 --- a/common/lib/capa/capa/checker.py +++ b/common/lib/capa/capa/checker.py @@ -10,7 +10,6 @@ import sys from path import path from cStringIO import StringIO -from collections import defaultdict from .calc import UndefinedVariable from .capa_problem import LoncapaProblem diff --git a/common/lib/capa/capa/customrender.py b/common/lib/capa/capa/customrender.py index 60d3ce578b..9d7ff719ac 100644 --- a/common/lib/capa/capa/customrender.py +++ b/common/lib/capa/capa/customrender.py @@ -10,8 +10,6 @@ from .registry import TagRegistry import logging import re -import shlex # for splitting quoted strings -import json from lxml import etree import xml.sax.saxutils as saxutils diff --git a/common/lib/capa/capa/responsetypes.py b/common/lib/capa/capa/responsetypes.py index 80227490da..be70e3866c 100644 --- a/common/lib/capa/capa/responsetypes.py +++ b/common/lib/capa/capa/responsetypes.py @@ -11,7 +11,6 @@ Used by capa_problem.py # standard library imports import abc import cgi -import hashlib import inspect import json import logging diff --git a/common/lib/capa/capa/tests/test_html_render.py b/common/lib/capa/capa/tests/test_html_render.py index 62605b48f5..9bc326d7b9 100644 --- a/common/lib/capa/capa/tests/test_html_render.py +++ b/common/lib/capa/capa/tests/test_html_render.py @@ -2,7 +2,6 @@ import unittest from lxml import etree import os import textwrap -import json import mock diff --git a/common/lib/capa/capa/util.py b/common/lib/capa/capa/util.py index ec43da6093..433e99171d 100644 --- a/common/lib/capa/capa/util.py +++ b/common/lib/capa/capa/util.py @@ -1,4 +1,4 @@ -from calc import evaluator, UndefinedVariable +from calc import evaluator from cmath import isinf #----------------------------------------------------------------------------- diff --git a/common/lib/chem/chem/chemcalc.py b/common/lib/chem/chem/chemcalc.py index 5b80005044..612e63c0f0 100644 --- a/common/lib/chem/chem/chemcalc.py +++ b/common/lib/chem/chem/chemcalc.py @@ -1,16 +1,7 @@ from __future__ import division -import copy from fractions import Fraction -import logging -import math -import operator -import re -import numpy -import numbers -import scipy.constants -from pyparsing import (Literal, Keyword, Word, nums, StringEnd, Optional, - Forward, OneOrMore, ParseException) +from pyparsing import (Literal, StringEnd, OneOrMore, ParseException) import nltk from nltk.tree import Tree diff --git a/common/lib/symmath/symmath/formula.py b/common/lib/symmath/symmath/formula.py index 8369baa27c..a926d9ae45 100644 --- a/common/lib/symmath/symmath/formula.py +++ b/common/lib/symmath/symmath/formula.py @@ -10,7 +10,6 @@ # Provides sympy representation. import os -import sys import string import re import logging @@ -25,8 +24,7 @@ from sympy.physics.quantum.state import * # from sympy.core.operations import LatticeOp # import sympy.physics.quantum.qubit -import urllib -from xml.sax.saxutils import escape, unescape +from xml.sax.saxutils import unescape import sympy import unicodedata from lxml import etree diff --git a/common/lib/symmath/symmath/symmath_check.py b/common/lib/symmath/symmath/symmath_check.py index 65a17883f5..3f09ebf659 100644 --- a/common/lib/symmath/symmath/symmath_check.py +++ b/common/lib/symmath/symmath/symmath_check.py @@ -8,10 +8,6 @@ # # Takes in math expressions given as Presentation MathML (from ASCIIMathML), converts to Content MathML using SnuggleTeX -import os -import sys -import string -import re import traceback from .formula import * import logging diff --git a/common/lib/xmodule/xmodule/modulestore/tests/factories.py b/common/lib/xmodule/xmodule/modulestore/tests/factories.py index 99c5ec2c91..0a62849d8d 100644 --- a/common/lib/xmodule/xmodule/modulestore/tests/factories.py +++ b/common/lib/xmodule/xmodule/modulestore/tests/factories.py @@ -1,5 +1,4 @@ from factory import Factory, lazy_attribute_sequence, lazy_attribute -from time import gmtime from uuid import uuid4 from xmodule.modulestore import Location from xmodule.modulestore.django import modulestore diff --git a/common/lib/xmodule/xmodule/modulestore/tests/test_modulestore.py b/common/lib/xmodule/xmodule/modulestore/tests/test_modulestore.py index 469eedac05..1e2035075a 100644 --- a/common/lib/xmodule/xmodule/modulestore/tests/test_modulestore.py +++ b/common/lib/xmodule/xmodule/modulestore/tests/test_modulestore.py @@ -1,6 +1,6 @@ -from nose.tools import assert_equals, assert_raises, assert_not_equals, with_setup +from nose.tools import assert_equals, assert_raises -from xmodule.modulestore.exceptions import ItemNotFoundError, NoPathToItem +from xmodule.modulestore.exceptions import ItemNotFoundError from xmodule.modulestore.search import path_to_location diff --git a/common/lib/xmodule/xmodule/modulestore/tests/test_mongo.py b/common/lib/xmodule/xmodule/modulestore/tests/test_mongo.py index 07e6124537..c5ef0d751a 100644 --- a/common/lib/xmodule/xmodule/modulestore/tests/test_mongo.py +++ b/common/lib/xmodule/xmodule/modulestore/tests/test_mongo.py @@ -1,6 +1,5 @@ import pymongo -from mock import Mock from nose.tools import assert_equals, assert_raises, assert_not_equals, assert_false from pprint import pprint diff --git a/common/lib/xmodule/xmodule/open_ended_grading_classes/combined_open_ended_modulev1.py b/common/lib/xmodule/xmodule/open_ended_grading_classes/combined_open_ended_modulev1.py index 01be4c61ab..9fc438d4c0 100644 --- a/common/lib/xmodule/xmodule/open_ended_grading_classes/combined_open_ended_modulev1.py +++ b/common/lib/xmodule/xmodule/open_ended_grading_classes/combined_open_ended_modulev1.py @@ -1,13 +1,10 @@ import json import logging from lxml import etree -from lxml.html import rewrite_links from xmodule.timeinfo import TimeInfo from xmodule.capa_module import ComplexEncoder -from xmodule.editing_module import EditingDescriptor from xmodule.progress import Progress from xmodule.stringify import stringify_children -from xmodule.xml_module import XmlDescriptor import self_assessment_module import open_ended_module from .combined_open_ended_rubric import CombinedOpenEndedRubric, GRADER_TYPE_IMAGE_DICT, HUMAN_GRADER_TYPE, LEGEND_LIST diff --git a/common/lib/xmodule/xmodule/open_ended_grading_classes/grading_service_module.py b/common/lib/xmodule/xmodule/open_ended_grading_classes/grading_service_module.py index 3e3f943cd7..6857876703 100644 --- a/common/lib/xmodule/xmodule/open_ended_grading_classes/grading_service_module.py +++ b/common/lib/xmodule/xmodule/open_ended_grading_classes/grading_service_module.py @@ -3,7 +3,6 @@ import json import logging import requests from requests.exceptions import RequestException, ConnectionError, HTTPError -import sys from .combined_open_ended_rubric import CombinedOpenEndedRubric from lxml import etree diff --git a/common/lib/xmodule/xmodule/open_ended_grading_classes/open_ended_image_submission.py b/common/lib/xmodule/xmodule/open_ended_grading_classes/open_ended_image_submission.py index 2eb9502269..ea5c3b3527 100644 --- a/common/lib/xmodule/xmodule/open_ended_grading_classes/open_ended_image_submission.py +++ b/common/lib/xmodule/xmodule/open_ended_grading_classes/open_ended_image_submission.py @@ -14,9 +14,7 @@ from urlparse import urlparse import requests from boto.s3.connection import S3Connection from boto.s3.key import Key -import pickle import logging -import re log = logging.getLogger(__name__) diff --git a/common/lib/xmodule/xmodule/open_ended_grading_classes/open_ended_module.py b/common/lib/xmodule/xmodule/open_ended_grading_classes/open_ended_module.py index 1e5b1b233b..2ac55a8318 100644 --- a/common/lib/xmodule/xmodule/open_ended_grading_classes/open_ended_module.py +++ b/common/lib/xmodule/xmodule/open_ended_grading_classes/open_ended_module.py @@ -11,10 +11,8 @@ from lxml import etree import capa.xqueue_interface as xqueue_interface from xmodule.capa_module import ComplexEncoder -from xmodule.editing_module import EditingDescriptor from xmodule.progress import Progress from xmodule.stringify import stringify_children -from xmodule.xml_module import XmlDescriptor from capa.util import * import openendedchild diff --git a/common/lib/xmodule/xmodule/open_ended_grading_classes/openendedchild.py b/common/lib/xmodule/xmodule/open_ended_grading_classes/openendedchild.py index b5d4e1b676..4f524d2cd7 100644 --- a/common/lib/xmodule/xmodule/open_ended_grading_classes/openendedchild.py +++ b/common/lib/xmodule/xmodule/open_ended_grading_classes/openendedchild.py @@ -3,14 +3,8 @@ import logging from lxml.html.clean import Cleaner, autolink_html import re -from xmodule.capa_module import ComplexEncoder import open_ended_image_submission -from xmodule.editing_module import EditingDescriptor -from xmodule.html_checker import check_html from xmodule.progress import Progress -from xmodule.stringify import stringify_children -from xmodule.xml_module import XmlDescriptor -from xmodule.modulestore import Location from capa.util import * from .peer_grading_service import PeerGradingService, MockPeerGradingService import controller_query_service diff --git a/common/lib/xmodule/xmodule/progress.py b/common/lib/xmodule/xmodule/progress.py index 7adbb02646..bad5105fd0 100644 --- a/common/lib/xmodule/xmodule/progress.py +++ b/common/lib/xmodule/xmodule/progress.py @@ -13,7 +13,6 @@ For most subclassing needs, you should only need to reimplement frac() and __str__(). ''' -from collections import namedtuple import numbers diff --git a/common/lib/xmodule/xmodule/schematic_module.py b/common/lib/xmodule/xmodule/schematic_module.py index d15d629c24..83bcc5351d 100644 --- a/common/lib/xmodule/xmodule/schematic_module.py +++ b/common/lib/xmodule/xmodule/schematic_module.py @@ -1,4 +1,3 @@ -import json from .x_module import XModule, XModuleDescriptor diff --git a/common/lib/xmodule/xmodule/template_module.py b/common/lib/xmodule/xmodule/template_module.py index 9a9666c0b6..bf8f616913 100644 --- a/common/lib/xmodule/xmodule/template_module.py +++ b/common/lib/xmodule/xmodule/template_module.py @@ -3,7 +3,6 @@ from xmodule.raw_module import RawDescriptor from lxml import etree from mako.template import Template from xmodule.modulestore.django import modulestore -import logging class CustomTagModule(XModule): diff --git a/common/lib/xmodule/xmodule/tests/test_html_module.py b/common/lib/xmodule/xmodule/tests/test_html_module.py index e0a49ed98f..4fe0242378 100644 --- a/common/lib/xmodule/xmodule/tests/test_html_module.py +++ b/common/lib/xmodule/xmodule/tests/test_html_module.py @@ -3,7 +3,6 @@ import unittest from mock import Mock from xmodule.html_module import HtmlModule -from xmodule.modulestore import Location from . import get_test_system diff --git a/common/lib/xmodule/xmodule/tests/test_peer_grading.py b/common/lib/xmodule/xmodule/tests/test_peer_grading.py index 3e1a578118..c386f77e9b 100644 --- a/common/lib/xmodule/xmodule/tests/test_peer_grading.py +++ b/common/lib/xmodule/xmodule/tests/test_peer_grading.py @@ -2,10 +2,6 @@ import unittest from xmodule.modulestore import Location from .import get_test_system from test_util_open_ended import MockQueryDict, DummyModulestore -import json - -from xmodule.peer_grading_module import PeerGradingModule, PeerGradingDescriptor -from xmodule.open_ended_grading_classes.grading_service_module import GradingServiceError import logging diff --git a/common/lib/xmodule/xmodule/tests/test_randomize_module.py b/common/lib/xmodule/xmodule/tests/test_randomize_module.py index 81935c4013..81ba45b56c 100644 --- a/common/lib/xmodule/xmodule/tests/test_randomize_module.py +++ b/common/lib/xmodule/xmodule/tests/test_randomize_module.py @@ -1,11 +1,6 @@ import unittest -from time import strptime -from fs.memoryfs import MemoryFS - -from mock import Mock, patch - -from xmodule.modulestore.xml import ImportSystem, XMLModuleStore +from .test_course_module import DummySystem as DummyImportSystem ORG = 'test_org' COURSE = 'test_course' @@ -13,9 +8,6 @@ COURSE = 'test_course' START = '2013-01-01T01:00:00' -from .test_course_module import DummySystem as DummyImportSystem - - class RandomizeModuleTestCase(unittest.TestCase): """Make sure the randomize module works""" @staticmethod diff --git a/common/lib/xmodule/xmodule/tests/test_stringify.py b/common/lib/xmodule/xmodule/tests/test_stringify.py index e44b93b0b8..6c2e44eed5 100644 --- a/common/lib/xmodule/xmodule/tests/test_stringify.py +++ b/common/lib/xmodule/xmodule/tests/test_stringify.py @@ -1,4 +1,4 @@ -from nose.tools import assert_equals, assert_true, assert_false +from nose.tools import assert_equals from lxml import etree from xmodule.stringify import stringify_children diff --git a/common/lib/xmodule/xmodule/tests/test_util_open_ended.py b/common/lib/xmodule/xmodule/tests/test_util_open_ended.py index 9dbb17ae2f..63fb4631c9 100644 --- a/common/lib/xmodule/xmodule/tests/test_util_open_ended.py +++ b/common/lib/xmodule/xmodule/tests/test_util_open_ended.py @@ -1,6 +1,6 @@ from .import get_test_system from xmodule.modulestore import Location -from xmodule.modulestore.xml import ImportSystem, XMLModuleStore +from xmodule.modulestore.xml import XMLModuleStore from xmodule.tests.test_export import DATA_DIR OPEN_ENDED_GRADING_INTERFACE = { diff --git a/common/lib/xmodule/xmodule/timelimit_module.py b/common/lib/xmodule/xmodule/timelimit_module.py index 6be14e7574..9446176f01 100644 --- a/common/lib/xmodule/xmodule/timelimit_module.py +++ b/common/lib/xmodule/xmodule/timelimit_module.py @@ -1,4 +1,3 @@ -import json import logging from lxml import etree From df6d3f9b2f9f9023b4f2710c8c1ee5c05aeef9b1 Mon Sep 17 00:00:00 2001 From: Ned Batchelder Date: Mon, 17 Jun 2013 20:43:18 -0400 Subject: [PATCH 4/8] Fix strings that should be raw. --- cms/djangoapps/models/settings/course_details.py | 4 ++-- common/djangoapps/student/management/commands/set_staff.py | 2 +- common/djangoapps/student/views.py | 6 +++--- common/djangoapps/terrain/steps.py | 2 +- common/lib/capa/capa/capa_problem.py | 4 ++-- common/lib/capa/capa/customrender.py | 4 ++-- common/lib/capa/capa/inputtypes.py | 2 +- common/lib/capa/capa/responsetypes.py | 5 ++--- common/lib/symmath/symmath/formula.py | 4 ++-- common/lib/xmodule/xmodule/modulestore/xml.py | 2 +- common/lib/xmodule/xmodule/tests/test_stringify.py | 2 +- lms/djangoapps/course_wiki/views.py | 2 +- lms/djangoapps/foldit/views.py | 2 +- 13 files changed, 20 insertions(+), 21 deletions(-) diff --git a/cms/djangoapps/models/settings/course_details.py b/cms/djangoapps/models/settings/course_details.py index 3f0c87917a..884a4e4fef 100644 --- a/cms/djangoapps/models/settings/course_details.py +++ b/cms/djangoapps/models/settings/course_details.py @@ -153,9 +153,9 @@ class CourseDetails(object): if not raw_video: return None - keystring_matcher = re.search('(?<=embed/)[a-zA-Z0-9_-]+', raw_video) + keystring_matcher = re.search(r'(?<=embed/)[a-zA-Z0-9_-]+', raw_video) if keystring_matcher is None: - keystring_matcher = re.search(' - problem_text = re.sub("startouttext\s*/", "text", problem_text) - problem_text = re.sub("endouttext\s*/", "/text", problem_text) + problem_text = re.sub(r"startouttext\s*/", "text", problem_text) + problem_text = re.sub(r"endouttext\s*/", "/text", problem_text) self.problem_text = problem_text # parse problem XML file into an element tree diff --git a/common/lib/capa/capa/customrender.py b/common/lib/capa/capa/customrender.py index 9d7ff719ac..f7d586c9d5 100644 --- a/common/lib/capa/capa/customrender.py +++ b/common/lib/capa/capa/customrender.py @@ -26,7 +26,7 @@ class MathRenderer(object): tags = ['math'] def __init__(self, system, xml): - ''' + r''' Render math using latex-like formatting. Examples: @@ -41,7 +41,7 @@ class MathRenderer(object): self.system = system self.xml = xml - mathstr = re.sub('\$(.*)\$', r'[mathjaxinline]\1[/mathjaxinline]', xml.text) + mathstr = re.sub(r'\$(.*)\$', r'[mathjaxinline]\1[/mathjaxinline]', xml.text) mtag = 'mathjax' if not r'\displaystyle' in mathstr: mtag += 'inline' diff --git a/common/lib/capa/capa/inputtypes.py b/common/lib/capa/capa/inputtypes.py index 446b832dd7..f026568da1 100644 --- a/common/lib/capa/capa/inputtypes.py +++ b/common/lib/capa/capa/inputtypes.py @@ -856,7 +856,7 @@ class ImageInput(InputTypeBase): """ if value is of the form [x,y] then parse it and send along coordinates of previous answer """ - m = re.match('\[([0-9]+),([0-9]+)]', + m = re.match(r'\[([0-9]+),([0-9]+)]', self.value.strip().replace(' ', '')) if m: # Note: we subtract 15 to compensate for the size of the dot on the screen. diff --git a/common/lib/capa/capa/responsetypes.py b/common/lib/capa/capa/responsetypes.py index be70e3866c..97319bdb9e 100644 --- a/common/lib/capa/capa/responsetypes.py +++ b/common/lib/capa/capa/responsetypes.py @@ -1902,8 +1902,7 @@ class ImageResponse(LoncapaResponse): if not given: # No answer to parse. Mark as incorrect and move on continue # parse given answer - m = re.match( - '\[([0-9]+),([0-9]+)]', given.strip().replace(' ', '')) + m = re.match(r'\[([0-9]+),([0-9]+)]', given.strip().replace(' ', '')) if not m: raise Exception('[capamodule.capa.responsetypes.imageinput] ' 'error grading %s (input=%s)' % (aid, given)) @@ -1918,7 +1917,7 @@ class ImageResponse(LoncapaResponse): # parse expected answer # TODO: Compile regexp on file load m = re.match( - '[\(\[]([0-9]+),([0-9]+)[\)\]]-[\(\[]([0-9]+),([0-9]+)[\)\]]', + r'[\(\[]([0-9]+),([0-9]+)[\)\]]-[\(\[]([0-9]+),([0-9]+)[\)\]]', solution_rectangle.strip().replace(' ', '')) if not m: msg = 'Error in problem specification! cannot parse rectangle in %s' % ( diff --git a/common/lib/symmath/symmath/formula.py b/common/lib/symmath/symmath/formula.py index a926d9ae45..ca4e20ace3 100644 --- a/common/lib/symmath/symmath/formula.py +++ b/common/lib/symmath/symmath/formula.py @@ -50,7 +50,7 @@ class dot(sympy.operations.LatticeOp): # my dot product def _print_dot(self, expr): - return '{((%s) \cdot (%s))}' % (expr.args[0], expr.args[1]) + return r'{((%s) \cdot (%s))}' % (expr.args[0], expr.args[1]) LatexPrinter._print_dot = _print_dot @@ -202,7 +202,7 @@ class formula(object): return xml def preprocess_pmathml(self, xml): - ''' + r''' Pre-process presentation MathML from ASCIIMathML to make it more acceptable for SnuggleTeX, and also to accomodate some sympy conventions (eg hat(i) for \hat{i}). diff --git a/common/lib/xmodule/xmodule/modulestore/xml.py b/common/lib/xmodule/xmodule/modulestore/xml.py index a704fc2ae8..ef5fa617de 100644 --- a/common/lib/xmodule/xmodule/modulestore/xml.py +++ b/common/lib/xmodule/xmodule/modulestore/xml.py @@ -38,7 +38,7 @@ log = logging.getLogger(__name__) # into the cms from xml def clean_out_mako_templating(xml_string): xml_string = xml_string.replace('%include', 'include') - xml_string = re.sub("(?m)^\s*%.*$", '', xml_string) + xml_string = re.sub(r"(?m)^\s*%.*$", '', xml_string) return xml_string diff --git a/common/lib/xmodule/xmodule/tests/test_stringify.py b/common/lib/xmodule/xmodule/tests/test_stringify.py index 6c2e44eed5..49852ee233 100644 --- a/common/lib/xmodule/xmodule/tests/test_stringify.py +++ b/common/lib/xmodule/xmodule/tests/test_stringify.py @@ -12,7 +12,7 @@ def test_stringify(): def test_stringify_again(): - html = """A voltage source is non-linear! + html = r"""A voltage source is non-linear!
\(V=V_C\) diff --git a/lms/djangoapps/course_wiki/views.py b/lms/djangoapps/course_wiki/views.py index 6ab106ed70..74ef7d4a74 100644 --- a/lms/djangoapps/course_wiki/views.py +++ b/lms/djangoapps/course_wiki/views.py @@ -49,7 +49,7 @@ def course_wiki_redirect(request, course_id): if not course_slug: log.exception("This course is improperly configured. The slug cannot be empty.") valid_slug = False - if re.match('^[-\w\.]+$', course_slug) is None: + if re.match(r'^[-\w\.]+$', course_slug) is None: log.exception("This course is improperly configured. The slug can only contain letters, numbers, periods or hyphens.") valid_slug = False diff --git a/lms/djangoapps/foldit/views.py b/lms/djangoapps/foldit/views.py index da361a2a82..76d9bfff98 100644 --- a/lms/djangoapps/foldit/views.py +++ b/lms/djangoapps/foldit/views.py @@ -46,7 +46,7 @@ def foldit_ops(request): # To allow for fixes without breaking this, the regex should only # match unquoted strings, a = re.compile(r':([a-zA-Z]*),') - puzzle_scores_json = re.sub(a, ':"\g<1>",', puzzle_scores_json) + puzzle_scores_json = re.sub(a, r':"\g<1>",', puzzle_scores_json) puzzle_scores = json.loads(puzzle_scores_json) responses.append(save_scores(request.user, puzzle_scores)) From 61b53713d2e1d40b6f15a2a51c6dd8e303f04e27 Mon Sep 17 00:00:00 2001 From: Ned Batchelder Date: Tue, 18 Jun 2013 22:29:53 -0400 Subject: [PATCH 5/8] Remove unused imports from lms, as detected by pylint. --- lms/djangoapps/circuit/models.py | 3 --- lms/djangoapps/circuit/views.py | 5 +---- lms/djangoapps/courseware/access.py | 1 - lms/djangoapps/courseware/courses.py | 6 ------ .../courseware/management/commands/clean_xml.py | 3 --- .../courseware/management/commands/metadata_to_json.py | 1 - lms/djangoapps/courseware/module_render.py | 1 - lms/djangoapps/courseware/tabs.py | 7 ------- lms/djangoapps/courseware/tests/test_access.py | 2 +- lms/djangoapps/courseware/tests/test_masquerade.py | 2 +- lms/djangoapps/courseware/tests/test_module_render.py | 1 - lms/djangoapps/dashboard/models.py | 2 -- lms/djangoapps/dashboard/views.py | 5 +---- lms/djangoapps/debug/models.py | 2 -- lms/djangoapps/debug/views.py | 2 +- lms/djangoapps/django_comment_client/helpers.py | 3 --- .../management/commands/show_permissions.py | 1 - lms/djangoapps/django_comment_client/mustache_helpers.py | 1 - lms/djangoapps/django_comment_client/permissions.py | 5 ----- lms/djangoapps/django_comment_client/tests/test_models.py | 3 +-- lms/djangoapps/foldit/models.py | 3 --- lms/djangoapps/foldit/tests.py | 1 - .../instructor/management/commands/compute_grades.py | 8 -------- lms/djangoapps/instructor/offline_gradecalc.py | 6 +----- lms/djangoapps/instructor/tests/test_enrollment.py | 1 - lms/djangoapps/instructor/tests/test_gradebook.py | 4 +--- lms/djangoapps/instructor/tests/test_xss.py | 1 - lms/djangoapps/instructor_task/tests/test_integration.py | 1 - lms/djangoapps/instructor_task/tests/test_tasks.py | 2 +- .../management/commands/generate_serial_numbers.py | 2 -- .../licenses/management/commands/import_serial_numbers.py | 1 - .../lms_migration/management/commands/create_groups.py | 5 +---- .../lms_migration/management/commands/create_user.py | 1 - .../management/commands/manage_course_groups.py | 8 -------- lms/djangoapps/lms_migration/migrate.py | 1 - lms/djangoapps/notes/tests.py | 2 -- lms/djangoapps/notes/views.py | 1 - lms/djangoapps/open_ended_grading/staff_grading.py | 1 - lms/djangoapps/open_ended_grading/tests.py | 1 - lms/djangoapps/open_ended_grading/views.py | 1 - .../management/commands/init_psychometrics.py | 4 ---- lms/djangoapps/static_template_view/models.py | 2 -- lms/djangoapps/staticbook/models.py | 2 -- lms/djangoapps/staticbook/views.py | 1 - lms/envs/common.py | 2 +- lms/envs/dev_edx4edx.py | 1 - lms/envs/dev_ike.py | 1 - lms/lib/comment_client/comment_client.py | 2 ++ lms/lib/perfstats/models.py | 2 -- lms/one_time_startup.py | 3 +-- lms/urls.py | 3 ++- 51 files changed, 16 insertions(+), 114 deletions(-) diff --git a/lms/djangoapps/circuit/models.py b/lms/djangoapps/circuit/models.py index 21a70bcb25..8da678f08a 100644 --- a/lms/djangoapps/circuit/models.py +++ b/lms/djangoapps/circuit/models.py @@ -1,7 +1,4 @@ -import uuid - from django.db import models -from django.contrib.auth.models import User class ServerCircuit(models.Model): diff --git a/lms/djangoapps/circuit/views.py b/lms/djangoapps/circuit/views.py index 40a31a2e3a..cc85c2a452 100644 --- a/lms/djangoapps/circuit/views.py +++ b/lms/djangoapps/circuit/views.py @@ -1,13 +1,10 @@ import json -import os import xml.etree.ElementTree -from django.conf import settings from django.http import Http404 from django.http import HttpResponse -from django.shortcuts import redirect -from mitxmako.shortcuts import render_to_response, render_to_string +from mitxmako.shortcuts import render_to_response from .models import ServerCircuit diff --git a/lms/djangoapps/courseware/access.py b/lms/djangoapps/courseware/access.py index 07987a8edf..e25f44b939 100644 --- a/lms/djangoapps/courseware/access.py +++ b/lms/djangoapps/courseware/access.py @@ -2,7 +2,6 @@ Ideally, it will be the only place that needs to know about any special settings like DISABLE_START_DATES""" import logging -import time from datetime import datetime, timedelta from functools import partial diff --git a/lms/djangoapps/courseware/courses.py b/lms/djangoapps/courseware/courses.py index 3e1162bc03..71c9630964 100644 --- a/lms/djangoapps/courseware/courses.py +++ b/lms/djangoapps/courseware/courses.py @@ -1,14 +1,9 @@ from collections import defaultdict from fs.errors import ResourceNotFoundError -from functools import wraps import logging import inspect -from lxml.html import rewrite_links - from path import path -from django.conf import settings -from django.core.urlresolvers import reverse from django.http import Http404 from .module_render import get_module @@ -18,7 +13,6 @@ from xmodule.modulestore.django import modulestore from xmodule.contentstore.content import StaticContent from xmodule.modulestore.xml import XMLModuleStore from xmodule.modulestore.exceptions import ItemNotFoundError -from xmodule.x_module import XModule from courseware.model_data import ModelDataCache from static_replace import replace_static_urls from courseware.access import has_access diff --git a/lms/djangoapps/courseware/management/commands/clean_xml.py b/lms/djangoapps/courseware/management/commands/clean_xml.py index 1989361b85..45674f66e0 100644 --- a/lms/djangoapps/courseware/management/commands/clean_xml.py +++ b/lms/djangoapps/courseware/management/commands/clean_xml.py @@ -2,15 +2,12 @@ import os import sys import traceback -from filecmp import dircmp from fs.osfs import OSFS from path import path -from lxml import etree from django.core.management.base import BaseCommand from xmodule.modulestore.xml import XMLModuleStore -from xmodule.errortracker import make_error_tracker def traverse_tree(course): diff --git a/lms/djangoapps/courseware/management/commands/metadata_to_json.py b/lms/djangoapps/courseware/management/commands/metadata_to_json.py index 58d087c316..a910db7028 100644 --- a/lms/djangoapps/courseware/management/commands/metadata_to_json.py +++ b/lms/djangoapps/courseware/management/commands/metadata_to_json.py @@ -2,7 +2,6 @@ A script to walk a course xml tree, generate a dictionary of all the metadata, and print it out as a json dict. """ -import os import sys import json diff --git a/lms/djangoapps/courseware/module_render.py b/lms/djangoapps/courseware/module_render.py index ab0306ed2e..3ffb1d1b1d 100644 --- a/lms/djangoapps/courseware/module_render.py +++ b/lms/djangoapps/courseware/module_render.py @@ -1,6 +1,5 @@ import json import logging -import pyparsing import re import sys import static_replace diff --git a/lms/djangoapps/courseware/tabs.py b/lms/djangoapps/courseware/tabs.py index 42b1c05743..149542c344 100644 --- a/lms/djangoapps/courseware/tabs.py +++ b/lms/djangoapps/courseware/tabs.py @@ -11,23 +11,16 @@ actually generates the CourseTab. from collections import namedtuple import logging -import json from django.conf import settings from django.core.urlresolvers import reverse -from fs.errors import ResourceNotFoundError - from courseware.access import has_access -from lxml.html import rewrite_links from .module_render import get_module from courseware.access import has_access from xmodule.modulestore import Location from xmodule.modulestore.django import modulestore -from xmodule.modulestore.xml import XMLModuleStore -from xmodule.x_module import XModule -from student.models import unique_id_for_user from courseware.model_data import ModelDataCache from open_ended_grading import open_ended_notifications diff --git a/lms/djangoapps/courseware/tests/test_access.py b/lms/djangoapps/courseware/tests/test_access.py index 34d064971f..f93fa0d659 100644 --- a/lms/djangoapps/courseware/tests/test_access.py +++ b/lms/djangoapps/courseware/tests/test_access.py @@ -1,4 +1,4 @@ -from mock import Mock, patch +from mock import Mock from django.test import TestCase diff --git a/lms/djangoapps/courseware/tests/test_masquerade.py b/lms/djangoapps/courseware/tests/test_masquerade.py index f9ddf88b5f..47d437a316 100644 --- a/lms/djangoapps/courseware/tests/test_masquerade.py +++ b/lms/djangoapps/courseware/tests/test_masquerade.py @@ -12,7 +12,7 @@ from django.test.utils import override_settings from django.core.urlresolvers import reverse -from django.contrib.auth.models import User, Group +from django.contrib.auth.models import Group from courseware.access import _course_staff_group_name from courseware.tests.tests import LoginEnrollmentTestCase, TEST_DATA_XML_MODULESTORE, get_user from xmodule.modulestore.django import modulestore diff --git a/lms/djangoapps/courseware/tests/test_module_render.py b/lms/djangoapps/courseware/tests/test_module_render.py index 94ab4b7e94..775b6ff0fc 100644 --- a/lms/djangoapps/courseware/tests/test_module_render.py +++ b/lms/djangoapps/courseware/tests/test_module_render.py @@ -8,7 +8,6 @@ from django.test import TestCase from django.test.client import RequestFactory from django.test.utils import override_settings -from xmodule.modulestore.exceptions import ItemNotFoundError from xmodule.modulestore.django import modulestore import courseware.module_render as render from courseware.tests.tests import LoginEnrollmentTestCase diff --git a/lms/djangoapps/dashboard/models.py b/lms/djangoapps/dashboard/models.py index 71a8362390..6b20219993 100644 --- a/lms/djangoapps/dashboard/models.py +++ b/lms/djangoapps/dashboard/models.py @@ -1,3 +1 @@ -from django.db import models - # Create your models here. diff --git a/lms/djangoapps/dashboard/views.py b/lms/djangoapps/dashboard/views.py index 266e769db5..e04588fff4 100644 --- a/lms/djangoapps/dashboard/views.py +++ b/lms/djangoapps/dashboard/views.py @@ -1,11 +1,8 @@ -# Create your views here. -import json -from datetime import datetime from django.http import Http404 from mitxmako.shortcuts import render_to_response from django.db import connection -from student.models import CourseEnrollment, CourseEnrollmentAllowed +from student.models import CourseEnrollment from django.contrib.auth.models import User diff --git a/lms/djangoapps/debug/models.py b/lms/djangoapps/debug/models.py index 71a8362390..6b20219993 100644 --- a/lms/djangoapps/debug/models.py +++ b/lms/djangoapps/debug/models.py @@ -1,3 +1 @@ -from django.db import models - # Create your models here. diff --git a/lms/djangoapps/debug/views.py b/lms/djangoapps/debug/views.py index c1d4155fdd..317ebcada9 100644 --- a/lms/djangoapps/debug/views.py +++ b/lms/djangoapps/debug/views.py @@ -5,7 +5,7 @@ import traceback from django.http import Http404 from django.contrib.auth.decorators import login_required -from django_future.csrf import ensure_csrf_cookie, csrf_exempt +from django_future.csrf import ensure_csrf_cookie from mitxmako.shortcuts import render_to_response from codejail.safe_exec import safe_exec diff --git a/lms/djangoapps/django_comment_client/helpers.py b/lms/djangoapps/django_comment_client/helpers.py index fbe7a2401b..a8a51ad95c 100644 --- a/lms/djangoapps/django_comment_client/helpers.py +++ b/lms/djangoapps/django_comment_client/helpers.py @@ -1,8 +1,5 @@ -from django.core.urlresolvers import reverse from django.conf import settings -from mitxmako.shortcuts import render_to_string from .mustache_helpers import mustache_helpers -from django.core.urlresolvers import reverse from functools import partial from .utils import * diff --git a/lms/djangoapps/django_comment_client/management/commands/show_permissions.py b/lms/djangoapps/django_comment_client/management/commands/show_permissions.py index 67fc29ea97..f24f183193 100644 --- a/lms/djangoapps/django_comment_client/management/commands/show_permissions.py +++ b/lms/djangoapps/django_comment_client/management/commands/show_permissions.py @@ -1,5 +1,4 @@ from django.core.management.base import BaseCommand, CommandError -from django_comment_common.models import Permission, Role from django.contrib.auth.models import User diff --git a/lms/djangoapps/django_comment_client/mustache_helpers.py b/lms/djangoapps/django_comment_client/mustache_helpers.py index 5743dba9cb..adaf26c9e0 100644 --- a/lms/djangoapps/django_comment_client/mustache_helpers.py +++ b/lms/djangoapps/django_comment_client/mustache_helpers.py @@ -1,7 +1,6 @@ from .utils import url_for_tags as _url_for_tags import django.core.urlresolvers as urlresolvers -import urllib import sys import inspect diff --git a/lms/djangoapps/django_comment_client/permissions.py b/lms/djangoapps/django_comment_client/permissions.py index 1a523a170a..b868d46e36 100644 --- a/lms/djangoapps/django_comment_client/permissions.py +++ b/lms/djangoapps/django_comment_client/permissions.py @@ -1,8 +1,3 @@ -from django_comment_common.models import Role, Permission -from django.db.models.signals import post_save -from django.dispatch import receiver -from student.models import CourseEnrollment - import logging from util.cache import cache from django.core import cache diff --git a/lms/djangoapps/django_comment_client/tests/test_models.py b/lms/djangoapps/django_comment_client/tests/test_models.py index e45c883931..6d46df113a 100644 --- a/lms/djangoapps/django_comment_client/tests/test_models.py +++ b/lms/djangoapps/django_comment_client/tests/test_models.py @@ -1,5 +1,4 @@ import django_comment_common.models as models -import django_comment_client.permissions as permissions from django.test import TestCase @@ -44,7 +43,7 @@ class RoleClassTestCase(TestCase): class PermissionClassTestCase(TestCase): def setUp(self): - self.permission = permissions.Permission.objects.get_or_create(name="test")[0] + self.permission = models.Permission.objects.get_or_create(name="test")[0] def testUnicode(self): self.assertEqual(str(self.permission), "test") diff --git a/lms/djangoapps/foldit/models.py b/lms/djangoapps/foldit/models.py index 0dce956756..c0ef553d7e 100644 --- a/lms/djangoapps/foldit/models.py +++ b/lms/djangoapps/foldit/models.py @@ -1,11 +1,8 @@ import logging -from django.conf import settings from django.contrib.auth.models import User from django.db import models -from student.models import unique_id_for_user - log = logging.getLogger(__name__) diff --git a/lms/djangoapps/foldit/tests.py b/lms/djangoapps/foldit/tests.py index 9928f596be..0c55049cb6 100644 --- a/lms/djangoapps/foldit/tests.py +++ b/lms/djangoapps/foldit/tests.py @@ -5,7 +5,6 @@ from functools import partial from django.contrib.auth.models import User from django.test import TestCase from django.test.client import RequestFactory -from django.conf import settings from django.core.urlresolvers import reverse from foldit.views import foldit_ops, verify_code diff --git a/lms/djangoapps/instructor/management/commands/compute_grades.py b/lms/djangoapps/instructor/management/commands/compute_grades.py index 92db04f09a..4518450e39 100644 --- a/lms/djangoapps/instructor/management/commands/compute_grades.py +++ b/lms/djangoapps/instructor/management/commands/compute_grades.py @@ -3,18 +3,10 @@ # django management command: dump grades to csv files # for use by batch processes -import os -import sys -import string -import datetime -import json - -#import student.models from instructor.offline_gradecalc import * from courseware.courses import get_course_by_id from xmodule.modulestore.django import modulestore -from django.conf import settings from django.core.management.base import BaseCommand diff --git a/lms/djangoapps/instructor/offline_gradecalc.py b/lms/djangoapps/instructor/offline_gradecalc.py index 8182c4e58a..fe5b95c3b9 100644 --- a/lms/djangoapps/instructor/offline_gradecalc.py +++ b/lms/djangoapps/instructor/offline_gradecalc.py @@ -6,16 +6,12 @@ # The grades are stored in the OfflineComputedGrade table of the courseware model. import json -import logging import time -import courseware.models - -from collections import namedtuple from json import JSONEncoder from courseware import grades, models from courseware.courses import get_course_by_id -from django.contrib.auth.models import User, Group +from django.contrib.auth.models import User class MyEncoder(JSONEncoder): diff --git a/lms/djangoapps/instructor/tests/test_enrollment.py b/lms/djangoapps/instructor/tests/test_enrollment.py index ce5f2d2e50..3ce82b700b 100644 --- a/lms/djangoapps/instructor/tests/test_enrollment.py +++ b/lms/djangoapps/instructor/tests/test_enrollment.py @@ -9,7 +9,6 @@ from django.core.urlresolvers import reverse from courseware.access import _course_staff_group_name from courseware.tests.tests import LoginEnrollmentTestCase, TEST_DATA_XML_MODULESTORE, get_user from xmodule.modulestore.django import modulestore -import xmodule.modulestore.django from student.models import CourseEnrollment, CourseEnrollmentAllowed from instructor.views import get_and_clean_student_list diff --git a/lms/djangoapps/instructor/tests/test_gradebook.py b/lms/djangoapps/instructor/tests/test_gradebook.py index 4b1d22b594..3d0a1b09b8 100644 --- a/lms/djangoapps/instructor/tests/test_gradebook.py +++ b/lms/djangoapps/instructor/tests/test_gradebook.py @@ -2,13 +2,11 @@ Tests of the instructor dashboard gradebook """ -from django.test import TestCase from django.test.utils import override_settings from django.core.urlresolvers import reverse from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory -from student.tests.factories import UserFactory, CourseEnrollmentFactory, UserProfileFactory, AdminFactory +from student.tests.factories import UserFactory, CourseEnrollmentFactory, AdminFactory from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase -from mock import patch, DEFAULT from courseware.tests.tests import TEST_DATA_MONGO_MODULESTORE from capa.tests.response_xml_factory import StringResponseXMLFactory from courseware.tests.factories import StudentModuleFactory diff --git a/lms/djangoapps/instructor/tests/test_xss.py b/lms/djangoapps/instructor/tests/test_xss.py index d6b8adc908..87bd2ee16b 100644 --- a/lms/djangoapps/instructor/tests/test_xss.py +++ b/lms/djangoapps/instructor/tests/test_xss.py @@ -3,7 +3,6 @@ Tests of various instructor dashboard features that include lists of students """ from django.conf import settings -from django.test import TestCase from django.test.client import RequestFactory from django.test.utils import override_settings from markupsafe import escape diff --git a/lms/djangoapps/instructor_task/tests/test_integration.py b/lms/djangoapps/instructor_task/tests/test_integration.py index d7a81a5b39..5a17e32329 100644 --- a/lms/djangoapps/instructor_task/tests/test_integration.py +++ b/lms/djangoapps/instructor_task/tests/test_integration.py @@ -17,7 +17,6 @@ from django.core.urlresolvers import reverse from capa.tests.response_xml_factory import (CodeResponseXMLFactory, CustomResponseXMLFactory) from xmodule.modulestore.tests.factories import ItemFactory -from xmodule.modulestore.exceptions import ItemNotFoundError from courseware.model_data import StudentModule diff --git a/lms/djangoapps/instructor_task/tests/test_tasks.py b/lms/djangoapps/instructor_task/tests/test_tasks.py index 9eb81a98c9..c59a7065ae 100644 --- a/lms/djangoapps/instructor_task/tests/test_tasks.py +++ b/lms/djangoapps/instructor_task/tests/test_tasks.py @@ -19,7 +19,7 @@ from courseware.tests.factories import StudentModuleFactory from student.tests.factories import UserFactory from instructor_task.models import InstructorTask -from instructor_task.tests.test_base import InstructorTaskModuleTestCase, TEST_COURSE_ORG, TEST_COURSE_NUMBER +from instructor_task.tests.test_base import InstructorTaskModuleTestCase from instructor_task.tests.factories import InstructorTaskFactory from instructor_task.tasks import rescore_problem, reset_problem_attempts, delete_problem_state from instructor_task.tasks_helper import UpdateProblemModuleStateError, update_problem_module_state diff --git a/lms/djangoapps/licenses/management/commands/generate_serial_numbers.py b/lms/djangoapps/licenses/management/commands/generate_serial_numbers.py index 7c6b0d310e..4409f1cb45 100644 --- a/lms/djangoapps/licenses/management/commands/generate_serial_numbers.py +++ b/lms/djangoapps/licenses/management/commands/generate_serial_numbers.py @@ -1,6 +1,4 @@ -import os.path from uuid import uuid4 -from optparse import make_option from django.utils.html import escape from django.core.management.base import BaseCommand, CommandError diff --git a/lms/djangoapps/licenses/management/commands/import_serial_numbers.py b/lms/djangoapps/licenses/management/commands/import_serial_numbers.py index a3a8c0bad1..0a08ea83d3 100644 --- a/lms/djangoapps/licenses/management/commands/import_serial_numbers.py +++ b/lms/djangoapps/licenses/management/commands/import_serial_numbers.py @@ -1,5 +1,4 @@ import os.path -from optparse import make_option from django.utils.html import escape from django.core.management.base import BaseCommand, CommandError diff --git a/lms/djangoapps/lms_migration/management/commands/create_groups.py b/lms/djangoapps/lms_migration/management/commands/create_groups.py index 95c9e4238b..6cdc032278 100644 --- a/lms/djangoapps/lms_migration/management/commands/create_groups.py +++ b/lms/djangoapps/lms_migration/management/commands/create_groups.py @@ -5,13 +5,10 @@ # Create all staff_* groups for classes in data directory. import os -import sys -import string -import re from django.core.management.base import BaseCommand from django.conf import settings -from django.contrib.auth.models import User, Group +from django.contrib.auth.models import Group from path import path from lxml import etree diff --git a/lms/djangoapps/lms_migration/management/commands/create_user.py b/lms/djangoapps/lms_migration/management/commands/create_user.py index ca0e1a756f..87abf4f73a 100644 --- a/lms/djangoapps/lms_migration/management/commands/create_user.py +++ b/lms/djangoapps/lms_migration/management/commands/create_user.py @@ -7,7 +7,6 @@ import os import sys import string -import re import datetime from getpass import getpass import json diff --git a/lms/djangoapps/lms_migration/management/commands/manage_course_groups.py b/lms/djangoapps/lms_migration/management/commands/manage_course_groups.py index b63ef7859b..3c87762624 100644 --- a/lms/djangoapps/lms_migration/management/commands/manage_course_groups.py +++ b/lms/djangoapps/lms_migration/management/commands/manage_course_groups.py @@ -4,17 +4,9 @@ # # interactively list and edit membership in course staff and instructor groups -import os -import sys -import string import re -import datetime -from getpass import getpass -import json -import readline from django.core.management.base import BaseCommand -from django.conf import settings from django.contrib.auth.models import User, Group #----------------------------------------------------------------------------- diff --git a/lms/djangoapps/lms_migration/migrate.py b/lms/djangoapps/lms_migration/migrate.py index a677383035..3768b557ed 100644 --- a/lms/djangoapps/lms_migration/migrate.py +++ b/lms/djangoapps/lms_migration/migrate.py @@ -5,7 +5,6 @@ import json import logging import os -from pprint import pprint import xmodule.modulestore.django as xmodule_django from xmodule.modulestore.django import modulestore diff --git a/lms/djangoapps/notes/tests.py b/lms/djangoapps/notes/tests.py index a7609b91ac..21b5cd7b36 100644 --- a/lms/djangoapps/notes/tests.py +++ b/lms/djangoapps/notes/tests.py @@ -9,9 +9,7 @@ from django.contrib.auth.models import User from django.core.exceptions import ValidationError import collections -import unittest import json -import logging from . import utils, api, models diff --git a/lms/djangoapps/notes/views.py b/lms/djangoapps/notes/views.py index 654d7fb31d..01671b7ccd 100644 --- a/lms/djangoapps/notes/views.py +++ b/lms/djangoapps/notes/views.py @@ -4,7 +4,6 @@ from mitxmako.shortcuts import render_to_response from courseware.courses import get_course_with_access from notes.models import Note from notes.utils import notes_enabled_for_course -import json @login_required diff --git a/lms/djangoapps/open_ended_grading/staff_grading.py b/lms/djangoapps/open_ended_grading/staff_grading.py index fad5268294..3ea55f1df0 100644 --- a/lms/djangoapps/open_ended_grading/staff_grading.py +++ b/lms/djangoapps/open_ended_grading/staff_grading.py @@ -5,7 +5,6 @@ LMS part of instructor grading: - calls the instructor grading service """ -import json import logging log = logging.getLogger(__name__) diff --git a/lms/djangoapps/open_ended_grading/tests.py b/lms/djangoapps/open_ended_grading/tests.py index 3b6c992881..99b8b1a929 100644 --- a/lms/djangoapps/open_ended_grading/tests.py +++ b/lms/djangoapps/open_ended_grading/tests.py @@ -9,7 +9,6 @@ from mock import MagicMock, patch, Mock from django.core.urlresolvers import reverse from django.contrib.auth.models import Group -from django.http import HttpResponse from django.conf import settings from mitxmako.shortcuts import render_to_string diff --git a/lms/djangoapps/open_ended_grading/views.py b/lms/djangoapps/open_ended_grading/views.py index a914e434a9..7cf5aaf024 100644 --- a/lms/djangoapps/open_ended_grading/views.py +++ b/lms/djangoapps/open_ended_grading/views.py @@ -1,7 +1,6 @@ # Grading Views import logging -import urllib from django.conf import settings from django.views.decorators.cache import cache_control diff --git a/lms/djangoapps/psychometrics/management/commands/init_psychometrics.py b/lms/djangoapps/psychometrics/management/commands/init_psychometrics.py index 53f6e17e9d..87e62f4a2c 100644 --- a/lms/djangoapps/psychometrics/management/commands/init_psychometrics.py +++ b/lms/djangoapps/psychometrics/management/commands/init_psychometrics.py @@ -2,10 +2,6 @@ # # generate pyschometrics data from tracking logs and student module data -import os -import sys -import string -import datetime import json from courseware.models import * diff --git a/lms/djangoapps/static_template_view/models.py b/lms/djangoapps/static_template_view/models.py index 71a8362390..6b20219993 100644 --- a/lms/djangoapps/static_template_view/models.py +++ b/lms/djangoapps/static_template_view/models.py @@ -1,3 +1 @@ -from django.db import models - # Create your models here. diff --git a/lms/djangoapps/staticbook/models.py b/lms/djangoapps/staticbook/models.py index 71a8362390..6b20219993 100644 --- a/lms/djangoapps/staticbook/models.py +++ b/lms/djangoapps/staticbook/models.py @@ -1,3 +1 @@ -from django.db import models - # Create your models here. diff --git a/lms/djangoapps/staticbook/views.py b/lms/djangoapps/staticbook/views.py index 6d3dcbd5ca..fcfba9e22c 100644 --- a/lms/djangoapps/staticbook/views.py +++ b/lms/djangoapps/staticbook/views.py @@ -1,6 +1,5 @@ from django.contrib.auth.decorators import login_required from django.http import Http404 -from django.core.urlresolvers import reverse from mitxmako.shortcuts import render_to_response from courseware.access import has_access diff --git a/lms/envs/common.py b/lms/envs/common.py index cc45739562..0eb931e308 100644 --- a/lms/envs/common.py +++ b/lms/envs/common.py @@ -305,7 +305,7 @@ COURSES_WITH_UNSAFE_CODE = [] ############################ SIGNAL HANDLERS ################################ # This is imported to register the exception signal handling that logs exceptions -import monitoring.exceptions # noqa +import monitoring.exceptions # noqa # pylint: disable=W0611 ############################### DJANGO BUILT-INS ############################### # Change DEBUG/TEMPLATE_DEBUG in your environment settings files, not here diff --git a/lms/envs/dev_edx4edx.py b/lms/envs/dev_edx4edx.py index c90f369bc6..13a66ed1e8 100644 --- a/lms/envs/dev_edx4edx.py +++ b/lms/envs/dev_edx4edx.py @@ -18,7 +18,6 @@ if 'eecs1' in socket.gethostname(): MITX_ROOT_URL = '/mitx2' from .common import * -from logsettings import get_logger_config from .dev import * if 'eecs1' in socket.gethostname(): diff --git a/lms/envs/dev_ike.py b/lms/envs/dev_ike.py index 3f54b11d1e..50bbfff096 100644 --- a/lms/envs/dev_ike.py +++ b/lms/envs/dev_ike.py @@ -13,7 +13,6 @@ sessions. Assumes structure: # pylint: disable=W0401, W0614 from .common import * -from logsettings import get_logger_config from .dev import * import socket diff --git a/lms/lib/comment_client/comment_client.py b/lms/lib/comment_client/comment_client.py index 9b1a0baee2..d91c5ea47f 100644 --- a/lms/lib/comment_client/comment_client.py +++ b/lms/lib/comment_client/comment_client.py @@ -1,3 +1,5 @@ +# Import other classes here so they can be imported from here. +# pylint: disable=W0611 from .comment import Comment from .thread import Thread from .user import User diff --git a/lms/lib/perfstats/models.py b/lms/lib/perfstats/models.py index 71a8362390..6b20219993 100644 --- a/lms/lib/perfstats/models.py +++ b/lms/lib/perfstats/models.py @@ -1,3 +1 @@ -from django.db import models - # Create your models here. diff --git a/lms/one_time_startup.py b/lms/one_time_startup.py index e1b1f79444..e10ec06685 100644 --- a/lms/one_time_startup.py +++ b/lms/one_time_startup.py @@ -1,10 +1,9 @@ -import logging from dogapi import dog_http_api, dog_stats_api from django.conf import settings from xmodule.modulestore.django import modulestore from request_cache.middleware import RequestCache -from django.core.cache import get_cache, InvalidCacheBackendError +from django.core.cache import get_cache cache = get_cache('mongo_metadata_inheritance') for store_name in settings.MODULESTORE: diff --git a/lms/urls.py b/lms/urls.py index 1d34ebf3af..80f1224837 100644 --- a/lms/urls.py +++ b/lms/urls.py @@ -3,7 +3,8 @@ from django.conf.urls import patterns, include, url from django.contrib import admin from django.conf.urls.static import static -from . import one_time_startup +# Not used, the work is done in the imported module. +from . import one_time_startup # pylint: disable=W0611 import django.contrib.auth.views From 645d847bb116eeb273423852a2814891e3d4b66a Mon Sep 17 00:00:00 2001 From: Ned Batchelder Date: Wed, 19 Jun 2013 12:42:13 -0400 Subject: [PATCH 6/8] Remove unused imports from cms, as detected by pylint. --- cms/djangoapps/contentstore/tests/test_item.py | 1 - cms/djangoapps/models/settings/course_metadata.py | 1 - cms/envs/common.py | 4 ++-- cms/envs/dev_ike.py | 2 -- cms/urls.py | 3 +++ 5 files changed, 5 insertions(+), 6 deletions(-) diff --git a/cms/djangoapps/contentstore/tests/test_item.py b/cms/djangoapps/contentstore/tests/test_item.py index 07264cdc30..1831a5769a 100644 --- a/cms/djangoapps/contentstore/tests/test_item.py +++ b/cms/djangoapps/contentstore/tests/test_item.py @@ -1,4 +1,3 @@ -from contentstore.utils import get_modulestore, get_url_reverse from contentstore.tests.test_course_settings import CourseTestCase from xmodule.modulestore.tests.factories import CourseFactory from django.core.urlresolvers import reverse diff --git a/cms/djangoapps/models/settings/course_metadata.py b/cms/djangoapps/models/settings/course_metadata.py index 708e79f0a3..937ba56f69 100644 --- a/cms/djangoapps/models/settings/course_metadata.py +++ b/cms/djangoapps/models/settings/course_metadata.py @@ -1,6 +1,5 @@ from xmodule.modulestore import Location from contentstore.utils import get_modulestore -from xmodule.x_module import XModuleDescriptor from xmodule.modulestore.inheritance import own_metadata from xblock.core import Scope from xmodule.course_module import CourseDescriptor diff --git a/cms/envs/common.py b/cms/envs/common.py index d7c9e6bb90..da3f39ea49 100644 --- a/cms/envs/common.py +++ b/cms/envs/common.py @@ -21,7 +21,7 @@ Longer TODO: # We intentionally define lots of variables that aren't used, and # want to import all variables from base settings files -# pylint: disable=W0401, W0614 +# pylint: disable=W0401, W0611, W0614 import sys import lms.envs.common @@ -155,7 +155,7 @@ MIDDLEWARE_CLASSES = ( ############################ SIGNAL HANDLERS ################################ # This is imported to register the exception signal handling that logs exceptions -import monitoring.exceptions # noqa +import monitoring.exceptions # noqa # pylint: disable=W0611 ############################ DJANGO_BUILTINS ################################ # Change DEBUG/TEMPLATE_DEBUG in your environment settings files, not here diff --git a/cms/envs/dev_ike.py b/cms/envs/dev_ike.py index 0c798b68aa..6e67f78f36 100644 --- a/cms/envs/dev_ike.py +++ b/cms/envs/dev_ike.py @@ -7,9 +7,7 @@ # FORCE_SCRIPT_NAME = '/cms' from .common import * -from logsettings import get_logger_config from .dev import * -import socket MITX_FEATURES['AUTH_USE_MIT_CERTIFICATES'] = True diff --git a/cms/urls.py b/cms/urls.py index a9a7f0a68a..d04c311161 100644 --- a/cms/urls.py +++ b/cms/urls.py @@ -1,5 +1,8 @@ from django.conf import settings from django.conf.urls import patterns, include, url + +# Import this file so it can do its work, even though we don't use the name. +# pylint: disable=W0611 from . import one_time_startup # Uncomment the next two lines to enable the admin: From bc2f7b96eccb638844d9e3488525c9e71e6126f4 Mon Sep 17 00:00:00 2001 From: Ned Batchelder Date: Wed, 19 Jun 2013 22:31:05 -0400 Subject: [PATCH 7/8] Remove a redundant pylint suppression. --- cms/envs/common.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cms/envs/common.py b/cms/envs/common.py index da3f39ea49..7f4c106e6d 100644 --- a/cms/envs/common.py +++ b/cms/envs/common.py @@ -155,7 +155,7 @@ MIDDLEWARE_CLASSES = ( ############################ SIGNAL HANDLERS ################################ # This is imported to register the exception signal handling that logs exceptions -import monitoring.exceptions # noqa # pylint: disable=W0611 +import monitoring.exceptions # noqa ############################ DJANGO_BUILTINS ################################ # Change DEBUG/TEMPLATE_DEBUG in your environment settings files, not here From e775852ee4c6c4ea8c5f5660b44b9b50f5cba8d6 Mon Sep 17 00:00:00 2001 From: Ned Batchelder Date: Wed, 19 Jun 2013 22:44:55 -0400 Subject: [PATCH 8/8] Make lms and cms more similar. --- lms/envs/common.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lms/envs/common.py b/lms/envs/common.py index 0eb931e308..f9bfa878dd 100644 --- a/lms/envs/common.py +++ b/lms/envs/common.py @@ -21,7 +21,7 @@ Longer TODO: # We intentionally define lots of variables that aren't used, and # want to import all variables from base settings files -# pylint: disable=W0401, W0614 +# pylint: disable=W0401, W0611, W0614 import sys import os @@ -305,7 +305,7 @@ COURSES_WITH_UNSAFE_CODE = [] ############################ SIGNAL HANDLERS ################################ # This is imported to register the exception signal handling that logs exceptions -import monitoring.exceptions # noqa # pylint: disable=W0611 +import monitoring.exceptions # noqa ############################### DJANGO BUILT-INS ############################### # Change DEBUG/TEMPLATE_DEBUG in your environment settings files, not here