Commit fd0e389c by Sarina Canelake

Merge pull request #7063 from stvstnfrd/pylint/medium

Fix Pylint violations (medium)
parents 63341287 4e2927f1
...@@ -161,7 +161,9 @@ def export_to_git(course_id, repo, user='', rdir=None): ...@@ -161,7 +161,9 @@ def export_to_git(course_id, repo, user='', rdir=None):
ident = GIT_EXPORT_DEFAULT_IDENT ident = GIT_EXPORT_DEFAULT_IDENT
time_stamp = timezone.now() time_stamp = timezone.now()
cwd = os.path.abspath(rdirp) cwd = os.path.abspath(rdirp)
commit_msg = 'Export from Studio at {1}'.format(user, time_stamp) commit_msg = "Export from Studio at {time_stamp}".format(
time_stamp=time_stamp,
)
try: try:
cmd_log(['git', 'config', 'user.email', ident['email']], cwd) cmd_log(['git', 'config', 'user.email', ident['email']], cwd)
cmd_log(['git', 'config', 'user.name', ident['name']], cwd) cmd_log(['git', 'config', 'user.name', ident['name']], cwd)
......
...@@ -40,7 +40,12 @@ class Command(BaseCommand): ...@@ -40,7 +40,12 @@ class Command(BaseCommand):
try: try:
user = user_from_str(args[1]) user = user_from_str(args[1])
except User.DoesNotExist: except User.DoesNotExist:
raise CommandError("No user {} found: expected args are ".format(args[1], self.args)) raise CommandError(
"No user {user} found: expected args are {args}".format(
user=args[1],
args=self.args,
),
)
org = args[2] org = args[2]
course = args[3] course = args[3]
......
...@@ -3,7 +3,10 @@ from opaque_keys.edx.locations import Location ...@@ -3,7 +3,10 @@ from opaque_keys.edx.locations import Location
from django.test import TestCase from django.test import TestCase
class Content: class Content(object):
"""
Mock cached content
"""
def __init__(self, location, content): def __init__(self, location, content):
self.location = location self.location = location
self.content = content self.content = content
......
...@@ -134,9 +134,6 @@ FEATURES = { ...@@ -134,9 +134,6 @@ FEATURES = {
# Prerequisite courses feature flag # Prerequisite courses feature flag
'ENABLE_PREREQUISITE_COURSES': False, 'ENABLE_PREREQUISITE_COURSES': False,
# Toggle course milestones app/feature
'MILESTONES_APP': False,
# Toggle course entrance exams feature # Toggle course entrance exams feature
'ENTRANCE_EXAMS': False, 'ENTRANCE_EXAMS': False,
......
...@@ -39,5 +39,5 @@ class LazyModule(object): ...@@ -39,5 +39,5 @@ class LazyModule(object):
submod = getattr(mod, name) submod = getattr(mod, name)
except ImportError: except ImportError:
raise AttributeError("'module' object has no attribute %r" % name) raise AttributeError("'module' object has no attribute %r" % name)
self.__dict__[name] = LazyModule(subname, submod) self.__dict__[name] = LazyModule(subname)
return self.__dict__[name] return self.__dict__[name]
...@@ -4,7 +4,7 @@ Constants for capa_base problems ...@@ -4,7 +4,7 @@ Constants for capa_base problems
""" """
class SHOWANSWER: class SHOWANSWER(object):
""" """
Constants for when to show answer Constants for when to show answer
""" """
...@@ -18,7 +18,7 @@ class SHOWANSWER: ...@@ -18,7 +18,7 @@ class SHOWANSWER:
NEVER = "never" NEVER = "never"
class RANDOMIZATION: class RANDOMIZATION(object):
""" """
Constants for problem randomization Constants for problem randomization
""" """
......
...@@ -50,8 +50,11 @@ class DuplicateItemError(Exception): ...@@ -50,8 +50,11 @@ class DuplicateItemError(Exception):
""" """
Print info about what's duplicated Print info about what's duplicated
""" """
return '{0.store}[{0.collection}] already has {0.element_id}'.format( return "{store}[{collection}] already has {element_id} ({exception})".format(
self, Exception.__str__(self, *args, **kwargs) store=self.store,
collection=self.collection,
element_id=self.element_id,
exception=Exception.__str__(self, *args, **kwargs),
) )
......
...@@ -67,7 +67,7 @@ HUMAN_STATES = { ...@@ -67,7 +67,7 @@ HUMAN_STATES = {
SKIP_BASIC_CHECKS = False SKIP_BASIC_CHECKS = False
class CombinedOpenEndedV1Module(): class CombinedOpenEndedV1Module(object):
""" """
This is a module that encapsulates all open ended grading (self assessment, peer assessment, etc). This is a module that encapsulates all open ended grading (self assessment, peer assessment, etc).
It transitions between problems, and support arbitrary ordering. It transitions between problems, and support arbitrary ordering.
...@@ -1185,7 +1185,7 @@ class CombinedOpenEndedV1Module(): ...@@ -1185,7 +1185,7 @@ class CombinedOpenEndedV1Module():
return declaration return declaration
class CombinedOpenEndedV1Descriptor(): class CombinedOpenEndedV1Descriptor(object):
""" """
Module for adding combined open ended questions Module for adding combined open ended questions
""" """
......
...@@ -846,7 +846,7 @@ class OpenEndedModule(openendedchild.OpenEndedChild): ...@@ -846,7 +846,7 @@ class OpenEndedModule(openendedchild.OpenEndedChild):
return score return score
class OpenEndedDescriptor(): class OpenEndedDescriptor(object):
""" """
Module for adding open ended response questions to courses Module for adding open ended response questions to courses
""" """
......
...@@ -286,7 +286,7 @@ class SelfAssessmentModule(openendedchild.OpenEndedChild): ...@@ -286,7 +286,7 @@ class SelfAssessmentModule(openendedchild.OpenEndedChild):
return [rubric_scores] return [rubric_scores]
class SelfAssessmentDescriptor(): class SelfAssessmentDescriptor(object):
""" """
Module for adding self assessment questions to courses Module for adding self assessment questions to courses
""" """
......
...@@ -616,7 +616,7 @@ class PeerGradingModule(PeerGradingFields, XModule): ...@@ -616,7 +616,7 @@ class PeerGradingModule(PeerGradingFields, XModule):
elif data.get('location') is not None: elif data.get('location') is not None:
problem_location = self.course_id.make_usage_key_from_deprecated_string(data.get('location')) problem_location = self.course_id.make_usage_key_from_deprecated_string(data.get('location'))
module = self._find_corresponding_module_for_location(problem_location) # pylint: disable-unused-variable self._find_corresponding_module_for_location(problem_location)
ajax_url = self.ajax_url ajax_url = self.ajax_url
html = self.system.render_template('peer_grading/peer_grading_problem.html', { html = self.system.render_template('peer_grading/peer_grading_problem.html', {
......
...@@ -50,13 +50,16 @@ injected humour and the like). ...@@ -50,13 +50,16 @@ injected humour and the like).
""" """
class Content: class Content(object):
"""
A class with location and content_type members
"""
def __init__(self, location, content_type): def __init__(self, location, content_type):
self.location = location self.location = location
self.content_type = content_type self.content_type = content_type
class FakeGridFsItem: class FakeGridFsItem(object):
""" """
This class provides the basic methods to get data from a GridFS item This class provides the basic methods to get data from a GridFS item
""" """
......
...@@ -22,7 +22,7 @@ class CourseEmailTemplateForm(forms.ModelForm): ...@@ -22,7 +22,7 @@ class CourseEmailTemplateForm(forms.ModelForm):
name = forms.CharField(required=False) name = forms.CharField(required=False)
class Meta: # pylint: disable=missing-docstring class Meta(object): # pylint: disable=missing-docstring
model = CourseEmailTemplate model = CourseEmailTemplate
fields = ('html_template', 'plain_template', 'name') fields = ('html_template', 'plain_template', 'name')
...@@ -76,7 +76,7 @@ class CourseEmailTemplateForm(forms.ModelForm): ...@@ -76,7 +76,7 @@ class CourseEmailTemplateForm(forms.ModelForm):
class CourseAuthorizationAdminForm(forms.ModelForm): class CourseAuthorizationAdminForm(forms.ModelForm):
"""Input form for email enabling, allowing us to verify data.""" """Input form for email enabling, allowing us to verify data."""
class Meta: # pylint: disable=missing-docstring class Meta(object): # pylint: disable=missing-docstring
model = CourseAuthorization model = CourseAuthorization
def clean_course_id(self): def clean_course_id(self):
......
...@@ -44,7 +44,7 @@ class Email(models.Model): ...@@ -44,7 +44,7 @@ class Email(models.Model):
created = models.DateTimeField(auto_now_add=True) created = models.DateTimeField(auto_now_add=True)
modified = models.DateTimeField(auto_now=True) modified = models.DateTimeField(auto_now=True)
class Meta: # pylint: disable=missing-docstring class Meta(object): # pylint: disable=missing-docstring
abstract = True abstract = True
...@@ -142,7 +142,7 @@ class Optout(models.Model): ...@@ -142,7 +142,7 @@ class Optout(models.Model):
user = models.ForeignKey(User, db_index=True, null=True) user = models.ForeignKey(User, db_index=True, null=True)
course_id = CourseKeyField(max_length=255, db_index=True) course_id = CourseKeyField(max_length=255, db_index=True)
class Meta: # pylint: disable=missing-docstring class Meta(object): # pylint: disable=missing-docstring
unique_together = ('user', 'course_id') unique_together = ('user', 'course_id')
......
...@@ -74,7 +74,7 @@ class Command(BaseCommand): ...@@ -74,7 +74,7 @@ class Command(BaseCommand):
else: else:
user = User.objects.get(username=user_str) user = User.objects.get(username=user_str)
cert_whitelist, created = \ cert_whitelist, _created = \
CertificateWhitelist.objects.get_or_create( CertificateWhitelist.objects.get_or_create(
user=user, course_id=course) user=user, course_id=course)
if options['add']: if options['add']:
......
...@@ -124,7 +124,7 @@ class Command(BaseCommand): ...@@ -124,7 +124,7 @@ class Command(BaseCommand):
diff = datetime.datetime.now(UTC) - start diff = datetime.datetime.now(UTC) - start
timeleft = diff * (total - count) / STATUS_INTERVAL timeleft = diff * (total - count) / STATUS_INTERVAL
hours, remainder = divmod(timeleft.seconds, 3600) hours, remainder = divmod(timeleft.seconds, 3600)
minutes, seconds = divmod(remainder, 60) minutes, _seconds = divmod(remainder, 60)
print "{0}/{1} completed ~{2:02}:{3:02}m remaining".format( print "{0}/{1} completed ~{2:02}:{3:02}m remaining".format(
count, total, hours, minutes) count, total, hours, minutes)
start = datetime.datetime.now(UTC) start = datetime.datetime.now(UTC)
......
...@@ -114,7 +114,7 @@ class GeneratedCertificate(models.Model): ...@@ -114,7 +114,7 @@ class GeneratedCertificate(models.Model):
auto_now=True, default=datetime.now) auto_now=True, default=datetime.now)
error_reason = models.CharField(max_length=512, blank=True, default='') error_reason = models.CharField(max_length=512, blank=True, default='')
class Meta: class Meta(object): # pylint: disable=missing-docstring
unique_together = (('user', 'course_id'),) unique_together = (('user', 'course_id'),)
@classmethod @classmethod
......
...@@ -42,7 +42,7 @@ class CodeMirror(BaseEditor): ...@@ -42,7 +42,7 @@ class CodeMirror(BaseEditor):
def get_widget(self, instance=None): def get_widget(self, instance=None):
return CodeMirrorWidget() return CodeMirrorWidget()
class AdminMedia: class AdminMedia(object): # pylint: disable=missing-docstring
css = { css = {
'all': ("wiki/markitup/skins/simple/style.css", 'all': ("wiki/markitup/skins/simple/style.css",
"wiki/markitup/sets/admin/style.css",) "wiki/markitup/sets/admin/style.css",)
...@@ -52,7 +52,7 @@ class CodeMirror(BaseEditor): ...@@ -52,7 +52,7 @@ class CodeMirror(BaseEditor):
"wiki/markitup/sets/admin/set.js", "wiki/markitup/sets/admin/set.js",
) )
class Media: class Media(object): # pylint: disable=missing-docstring
css = { css = {
'all': ("js/vendor/CodeMirror/codemirror.css",) 'all': ("js/vendor/CodeMirror/codemirror.css",)
} }
......
...@@ -92,7 +92,6 @@ class WikiRedirectTestCase(LoginEnrollmentTestCase, ModuleStoreTestCase): ...@@ -92,7 +92,6 @@ class WikiRedirectTestCase(LoginEnrollmentTestCase, ModuleStoreTestCase):
course_wiki_page = referer.replace('progress', 'wiki/' + self.toy.wiki_slug + "/") course_wiki_page = referer.replace('progress', 'wiki/' + self.toy.wiki_slug + "/")
ending_location = resp.redirect_chain[-1][0] ending_location = resp.redirect_chain[-1][0]
ending_status = resp.redirect_chain[-1][1]
self.assertEquals(ending_location, 'http://testserver' + course_wiki_page) self.assertEquals(ending_location, 'http://testserver' + course_wiki_page)
self.assertEquals(resp.status_code, 200) self.assertEquals(resp.status_code, 200)
......
...@@ -46,7 +46,7 @@ class StudentModule(models.Model): ...@@ -46,7 +46,7 @@ class StudentModule(models.Model):
course_id = CourseKeyField(max_length=255, db_index=True) course_id = CourseKeyField(max_length=255, db_index=True)
class Meta: class Meta(object): # pylint: disable=missing-docstring
unique_together = (('student', 'module_state_key', 'course_id'),) unique_together = (('student', 'module_state_key', 'course_id'),)
## Internal state of the object ## Internal state of the object
...@@ -102,7 +102,7 @@ class StudentModuleHistory(models.Model): ...@@ -102,7 +102,7 @@ class StudentModuleHistory(models.Model):
HISTORY_SAVING_TYPES = {'problem'} HISTORY_SAVING_TYPES = {'problem'}
class Meta: class Meta(object): # pylint: disable=missing-docstring
get_latest_by = "created" get_latest_by = "created"
student_module = models.ForeignKey(StudentModule, db_index=True) student_module = models.ForeignKey(StudentModule, db_index=True)
...@@ -135,7 +135,7 @@ class XBlockFieldBase(models.Model): ...@@ -135,7 +135,7 @@ class XBlockFieldBase(models.Model):
""" """
Base class for all XBlock field storage. Base class for all XBlock field storage.
""" """
class Meta: class Meta(object): # pylint: disable=missing-docstring
abstract = True abstract = True
# The name of the field # The name of the field
...@@ -163,7 +163,7 @@ class XModuleUserStateSummaryField(XBlockFieldBase): ...@@ -163,7 +163,7 @@ class XModuleUserStateSummaryField(XBlockFieldBase):
Stores data set in the Scope.user_state_summary scope by an xmodule field Stores data set in the Scope.user_state_summary scope by an xmodule field
""" """
class Meta: class Meta(object): # pylint: disable=missing-docstring
unique_together = (('usage_id', 'field_name'),) unique_together = (('usage_id', 'field_name'),)
# The definition id for the module # The definition id for the module
...@@ -175,7 +175,7 @@ class XModuleStudentPrefsField(XBlockFieldBase): ...@@ -175,7 +175,7 @@ class XModuleStudentPrefsField(XBlockFieldBase):
Stores data set in the Scope.preferences scope by an xmodule field Stores data set in the Scope.preferences scope by an xmodule field
""" """
class Meta: # pylint: disable=missing-docstring class Meta(object): # pylint: disable=missing-docstring
unique_together = (('student', 'module_type', 'field_name'),) unique_together = (('student', 'module_type', 'field_name'),)
# The type of the module for these preferences # The type of the module for these preferences
...@@ -189,7 +189,7 @@ class XModuleStudentInfoField(XBlockFieldBase): ...@@ -189,7 +189,7 @@ class XModuleStudentInfoField(XBlockFieldBase):
Stores data set in the Scope.preferences scope by an xmodule field Stores data set in the Scope.preferences scope by an xmodule field
""" """
class Meta: class Meta(object): # pylint: disable=missing-docstring
unique_together = (('student', 'field_name'),) unique_together = (('student', 'field_name'),)
student = models.ForeignKey(User, db_index=True) student = models.ForeignKey(User, db_index=True)
...@@ -207,7 +207,7 @@ class OfflineComputedGrade(models.Model): ...@@ -207,7 +207,7 @@ class OfflineComputedGrade(models.Model):
gradeset = models.TextField(null=True, blank=True) # grades, stored as JSON gradeset = models.TextField(null=True, blank=True) # grades, stored as JSON
class Meta: class Meta(object): # pylint: disable=missing-docstring
unique_together = (('user', 'course_id'), ) unique_together = (('user', 'course_id'), )
def __unicode__(self): def __unicode__(self):
...@@ -219,7 +219,7 @@ class OfflineComputedGradeLog(models.Model): ...@@ -219,7 +219,7 @@ class OfflineComputedGradeLog(models.Model):
Log of when offline grades are computed. Log of when offline grades are computed.
Use this to be able to show instructor when the last computed grades were done. Use this to be able to show instructor when the last computed grades were done.
""" """
class Meta: class Meta(object): # pylint: disable=missing-docstring
ordering = ["-created"] ordering = ["-created"]
get_latest_by = "created" get_latest_by = "created"
......
...@@ -106,7 +106,7 @@ class BaseTestXmodule(ModuleStoreTestCase): ...@@ -106,7 +106,7 @@ class BaseTestXmodule(ModuleStoreTestCase):
# username = robot{0}, password = 'test' # username = robot{0}, password = 'test'
self.users = [ self.users = [
UserFactory.create() UserFactory.create()
for i in range(self.USER_COUNT) for dummy0 in range(self.USER_COUNT)
] ]
for user in self.users: for user in self.users:
......
...@@ -1085,7 +1085,7 @@ class UserProfileTestCase(ModuleStoreTestCase): ...@@ -1085,7 +1085,7 @@ class UserProfileTestCase(ModuleStoreTestCase):
request = RequestFactory().get("dummy_url") request = RequestFactory().get("dummy_url")
request.user = self.student request.user = self.student
with self.assertRaises(Http404): with self.assertRaises(Http404):
response = views.user_profile( views.user_profile(
request, request,
self.course.id.to_deprecated_string(), self.course.id.to_deprecated_string(),
-999 -999
...@@ -1095,7 +1095,7 @@ class UserProfileTestCase(ModuleStoreTestCase): ...@@ -1095,7 +1095,7 @@ class UserProfileTestCase(ModuleStoreTestCase):
request = RequestFactory().get("dummy_url") request = RequestFactory().get("dummy_url")
request.user = self.student request.user = self.student
with self.assertRaises(Http404): with self.assertRaises(Http404):
response = views.user_profile( views.user_profile(
request, request,
"non/existent/course", "non/existent/course",
self.profiled_user.id self.profiled_user.id
......
...@@ -2,7 +2,7 @@ import unittest ...@@ -2,7 +2,7 @@ import unittest
import threading import threading
import json import json
import urllib2 import urllib2
from mock_cs_server import MockCommentServiceServer from django_comment_client.tests.mock_cs_server.mock_cs_server import MockCommentServiceServer
from nose.plugins.skip import SkipTest from nose.plugins.skip import SkipTest
......
...@@ -34,10 +34,6 @@ class RoleClassTestCase(ModuleStoreTestCase): ...@@ -34,10 +34,6 @@ class RoleClassTestCase(ModuleStoreTestCase):
self.TA_role_2 = models.Role.objects.get_or_create(name="Community TA", self.TA_role_2 = models.Role.objects.get_or_create(name="Community TA",
course_id=self.course_id_2)[0] course_id=self.course_id_2)[0]
class Dummy():
def render_template():
pass
def test_has_permission(self): def test_has_permission(self):
# Whenever you add a permission to student_role, # Whenever you add a permission to student_role,
# Roles with the same FORUM_ROLE in same class also receives the same # Roles with the same FORUM_ROLE in same class also receives the same
......
...@@ -83,7 +83,7 @@ class PuzzleComplete(models.Model): ...@@ -83,7 +83,7 @@ class PuzzleComplete(models.Model):
e.g. PuzzleID 1234, set 1, subset 3. (Sets and subsets correspond to levels e.g. PuzzleID 1234, set 1, subset 3. (Sets and subsets correspond to levels
in the intro puzzles) in the intro puzzles)
""" """
class Meta: class Meta(object): # pylint: disable=missing-docstring
# there should only be one puzzle complete entry for any particular # there should only be one puzzle complete entry for any particular
# puzzle for any user # puzzle for any user
unique_together = ('user', 'puzzle_id', 'puzzle_set', 'puzzle_subset') unique_together = ('user', 'puzzle_id', 'puzzle_set', 'puzzle_subset')
......
...@@ -188,7 +188,7 @@ class TestInstructorEnrollsStudent(ModuleStoreTestCase, LoginEnrollmentTestCase) ...@@ -188,7 +188,7 @@ class TestInstructorEnrollsStudent(ModuleStoreTestCase, LoginEnrollmentTestCase)
""" """
string = "abc@test.com, def@test.com ghi@test.com \n \n jkl@test.com \n mno@test.com " string = "abc@test.com, def@test.com ghi@test.com \n \n jkl@test.com \n mno@test.com "
cleaned_string, cleaned_string_lc = get_and_clean_student_list(string) cleaned_string, _cleaned_string_lc = get_and_clean_student_list(string)
self.assertEqual(cleaned_string, ['abc@test.com', 'def@test.com', 'ghi@test.com', 'jkl@test.com', 'mno@test.com']) self.assertEqual(cleaned_string, ['abc@test.com', 'def@test.com', 'ghi@test.com', 'jkl@test.com', 'mno@test.com'])
@ddt.data('http', 'https') @ddt.data('http', 'https')
......
...@@ -148,7 +148,7 @@ class TestGetUnitsWithDueDate(ModuleStoreTestCase): ...@@ -148,7 +148,7 @@ class TestGetUnitsWithDueDate(ModuleStoreTestCase):
week1 = ItemFactory.create(due=due, parent=course) week1 = ItemFactory.create(due=due, parent=course)
week2 = ItemFactory.create(due=due, parent=course) week2 = ItemFactory.create(due=due, parent=course)
homework = ItemFactory.create( ItemFactory.create(
parent=week1, parent=week1,
due=due due=due
) )
......
...@@ -82,7 +82,6 @@ class InstructorTaskModuleSubmitTest(InstructorTaskModuleTestCase): ...@@ -82,7 +82,6 @@ class InstructorTaskModuleSubmitTest(InstructorTaskModuleTestCase):
def test_submit_nonexistent_modules(self): def test_submit_nonexistent_modules(self):
# confirm that a rescore of a non-existent module returns an exception # confirm that a rescore of a non-existent module returns an exception
problem_url = InstructorTaskModuleTestCase.problem_location("NonexistentProblem") problem_url = InstructorTaskModuleTestCase.problem_location("NonexistentProblem")
course_id = self.course.id
request = None request = None
with self.assertRaises(ItemNotFoundError): with self.assertRaises(ItemNotFoundError):
submit_rescore_problem_for_student(request, problem_url, self.student) submit_rescore_problem_for_student(request, problem_url, self.student)
...@@ -98,7 +97,6 @@ class InstructorTaskModuleSubmitTest(InstructorTaskModuleTestCase): ...@@ -98,7 +97,6 @@ class InstructorTaskModuleSubmitTest(InstructorTaskModuleTestCase):
# (Note that it is easier to test a scoreable but non-rescorable module in test_tasks, # (Note that it is easier to test a scoreable but non-rescorable module in test_tasks,
# where we are creating real modules.) # where we are creating real modules.)
problem_url = self.problem_section.location problem_url = self.problem_section.location
course_id = self.course.id
request = None request = None
with self.assertRaises(NotImplementedError): with self.assertRaises(NotImplementedError):
submit_rescore_problem_for_student(request, problem_url, self.student) submit_rescore_problem_for_student(request, problem_url, self.student)
......
...@@ -184,7 +184,10 @@ class CommandTest(ModuleStoreTestCase): ...@@ -184,7 +184,10 @@ class CommandTest(ModuleStoreTestCase):
software_count = CourseSoftware.objects.all().count() software_count = CourseSoftware.objects.all().count()
self.assertEqual(2, software_count) self.assertEqual(2, software_count)
log.debug('Now we should have 3 sets of 20 serials'.format(size)) log.debug(
"Now we should have 3 sets of %s serials",
size,
)
licenses_count = UserLicense.objects.all().count() licenses_count = UserLicense.objects.all().count()
self.assertEqual(3 * size, licenses_count) self.assertEqual(3 * size, licenses_count)
......
...@@ -31,7 +31,7 @@ def create_groups(): ...@@ -31,7 +31,7 @@ def create_groups():
cxfn = path(data_dir) / course_dir / 'course.xml' cxfn = path(data_dir) / course_dir / 'course.xml'
try: try:
coursexml = etree.parse(cxfn) coursexml = etree.parse(cxfn)
except Exception as err: except Exception: # pylint: disable=broad-except
print "Oops, cannot read %s, skipping" % cxfn print "Oops, cannot read %s, skipping" % cxfn
continue continue
cxmlroot = coursexml.getroot() cxmlroot = coursexml.getroot()
......
...@@ -44,7 +44,7 @@ class MyCompleter(object): # Custom completer ...@@ -44,7 +44,7 @@ class MyCompleter(object): # Custom completer
def GenPasswd(length=8, chars=string.letters + string.digits): def GenPasswd(length=8, chars=string.letters + string.digits):
return ''.join([choice(chars) for i in range(length)]) return ''.join([choice(chars) for dummy0 in range(length)])
#----------------------------------------------------------------------------- #-----------------------------------------------------------------------------
# main command # main command
......
...@@ -80,7 +80,7 @@ class CourseEnrollmentSerializer(serializers.ModelSerializer): ...@@ -80,7 +80,7 @@ class CourseEnrollmentSerializer(serializers.ModelSerializer):
else: else:
return {} return {}
class Meta: # pylint: disable=missing-docstring class Meta(object): # pylint: disable=missing-docstring
model = CourseEnrollment model = CourseEnrollment
fields = ('created', 'mode', 'is_active', 'course', 'certificate') fields = ('created', 'mode', 'is_active', 'course', 'certificate')
lookup_field = 'username' lookup_field = 'username'
...@@ -96,7 +96,7 @@ class UserSerializer(serializers.HyperlinkedModelSerializer): ...@@ -96,7 +96,7 @@ class UserSerializer(serializers.HyperlinkedModelSerializer):
lookup_field='username' lookup_field='username'
) )
class Meta: # pylint: disable=missing-docstring class Meta(object): # pylint: disable=missing-docstring
model = User model = User
fields = ('id', 'username', 'email', 'name', 'course_enrollments') fields = ('id', 'username', 'email', 'name', 'course_enrollments')
lookup_field = 'username' lookup_field = 'username'
...@@ -63,7 +63,7 @@ class NotifierUserSerializer(serializers.ModelSerializer): ...@@ -63,7 +63,7 @@ class NotifierUserSerializer(serializers.ModelSerializer):
pass pass
return ret return ret
class Meta: class Meta(object): # pylint: disable=missing-docstring
model = User model = User
fields = ("id", "email", "name", "preferences", "course_info") fields = ("id", "email", "name", "preferences", "course_info")
read_only_fields = ("id", "email") read_only_fields = ("id", "email")
...@@ -10,7 +10,7 @@ from xmodule.open_ended_grading_classes.grading_service_module import GradingSer ...@@ -10,7 +10,7 @@ from xmodule.open_ended_grading_classes.grading_service_module import GradingSer
import json import json
from student.models import unique_id_for_user from student.models import unique_id_for_user
import open_ended_notifications from open_ended_grading import open_ended_notifications
from xmodule.modulestore.django import modulestore from xmodule.modulestore.django import modulestore
from xmodule.modulestore import search from xmodule.modulestore import search
......
...@@ -10,7 +10,7 @@ from survey.models import SurveyForm ...@@ -10,7 +10,7 @@ from survey.models import SurveyForm
class SurveyFormAdminForm(forms.ModelForm): class SurveyFormAdminForm(forms.ModelForm):
"""Form providing validation of SurveyForm content.""" """Form providing validation of SurveyForm content."""
class Meta: # pylint: disable=missing-docstring class Meta(object): # pylint: disable=missing-docstring
model = SurveyForm model = SurveyForm
fields = ('name', 'form') fields = ('name', 'form')
......
...@@ -177,7 +177,7 @@ class PhotoVerification(StatusModel): ...@@ -177,7 +177,7 @@ class PhotoVerification(StatusModel):
# capturing it so that we can later query for the common problems. # capturing it so that we can later query for the common problems.
error_code = models.CharField(blank=True, max_length=50) error_code = models.CharField(blank=True, max_length=50)
class Meta: class Meta(object): # pylint: disable=missing-docstring
abstract = True abstract = True
ordering = ['-created_at'] ordering = ['-created_at']
......
...@@ -311,7 +311,7 @@ class TestPhotoVerification(TestCase): ...@@ -311,7 +311,7 @@ class TestPhotoVerification(TestCase):
attempt.status = "approved" attempt.status = "approved"
attempt.save() attempt.save()
assert_true(SoftwareSecurePhotoVerification.user_is_verified(user), status) assert_true(SoftwareSecurePhotoVerification.user_is_verified(user), attempt.status)
def test_user_has_valid_or_pending(self): def test_user_has_valid_or_pending(self):
""" """
......
...@@ -12,7 +12,7 @@ django_admin.py celery worker ...@@ -12,7 +12,7 @@ django_admin.py celery worker
# want to import all variables from base settings files # want to import all variables from base settings files
# pylint: disable=wildcard-import, unused-wildcard-import # pylint: disable=wildcard-import, unused-wildcard-import
from dev import * from lms.envs.dev import *
################################# CELERY ###################################### ################################# CELERY ######################################
......
...@@ -7,7 +7,7 @@ get shared sessions) ...@@ -7,7 +7,7 @@ get shared sessions)
# want to import all variables from base settings files # want to import all variables from base settings files
# pylint: disable=wildcard-import, unused-wildcard-import # pylint: disable=wildcard-import, unused-wildcard-import
from courses import * from lms.envs.devgroups.courses import *
# Move this to a shared file later: # Move this to a shared file later:
for class_id, db_name in CLASSES_TO_DBS.items(): for class_id, db_name in CLASSES_TO_DBS.items():
......
from .utils import CommentClientRequestError, perform_request from .utils import CommentClientRequestError, perform_request
from .thread import Thread, _url_for_flag_abuse_thread, _url_for_unflag_abuse_thread from .thread import Thread, _url_for_flag_abuse_thread, _url_for_unflag_abuse_thread
import models from lms.lib.comment_client import models
import settings from lms.lib.comment_client import settings
class Comment(models.Model): class Comment(models.Model):
......
"""Provides base Commentable model class""" """Provides base Commentable model class"""
import models from lms.lib.comment_client import models
import settings from lms.lib.comment_client import settings
class Commentable(models.Model): class Commentable(models.Model):
......
...@@ -61,7 +61,7 @@ git clean -qxfd ...@@ -61,7 +61,7 @@ git clean -qxfd
source scripts/jenkins-common.sh source scripts/jenkins-common.sh
# Violations thresholds for failing the build # Violations thresholds for failing the build
PYLINT_THRESHOLD=6000 PYLINT_THRESHOLD=5800
# If the environment variable 'SHARD' is not set, default to 'all'. # If the environment variable 'SHARD' is not set, default to 'all'.
# This could happen if you are trying to use this script from # This could happen if you are trying to use this script from
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment