Minor pylint/whitespace changes
This commit is contained in:
committed by
Calen Pennington
parent
fe82e865aa
commit
8b23eeca7e
@@ -1,5 +1,5 @@
|
||||
# disable missing docstring
|
||||
#pylint: disable=C0111
|
||||
# pylint: disable=C0111
|
||||
|
||||
from lettuce import world, step
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ from xmodule.modulestore.draft import DIRECT_ONLY_CATEGORIES
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
#In order to instantiate an open ended tab automatically, need to have this data
|
||||
# In order to instantiate an open ended tab automatically, need to have this data
|
||||
OPEN_ENDED_PANEL = {"name": "Open Ended Panel", "type": "open_ended"}
|
||||
NOTES_PANEL = {"name": "My Notes", "type": "notes"}
|
||||
EXTRA_TAB_PANELS = dict([(p['type'], p) for p in [OPEN_ENDED_PANEL, NOTES_PANEL]])
|
||||
|
||||
@@ -167,7 +167,8 @@
|
||||
%else:
|
||||
<span class="published-status"><strong>Will Release:</strong>
|
||||
${date_utils.get_default_time_display(section.lms.start)}</span>
|
||||
<a href="#" class="edit-button" data-date="${start_date_str}" data-time="${start_time_str}" data-id="${section.location}">Edit</a>
|
||||
<a href="#" class="edit-button" data-date="${start_date_str}"
|
||||
data-time="${start_time_str}" data-id="${section.location}">Edit</a>
|
||||
%endif
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -101,12 +101,12 @@ class DraftModuleStore(ModuleStoreBase):
|
||||
draft_items = super(DraftModuleStore, self).get_items(draft_loc, course_id=course_id, depth=depth)
|
||||
items = super(DraftModuleStore, self).get_items(location, course_id=course_id, depth=depth)
|
||||
|
||||
draft_locs_found = set(item.location._replace(revision=None) for item in draft_items)
|
||||
draft_locs_found = set(item.location.replace(revision=None) for item in draft_items)
|
||||
non_draft_items = [
|
||||
item
|
||||
for item in items
|
||||
if (item.location.revision != DRAFT
|
||||
and item.location._replace(revision=None) not in draft_locs_found)
|
||||
and item.location.replace(revision=None) not in draft_locs_found)
|
||||
]
|
||||
return [wrap_draft(item) for item in draft_items + non_draft_items]
|
||||
|
||||
|
||||
@@ -195,7 +195,7 @@ class CachingDescriptorSystem(MakoDescriptorSystem):
|
||||
if self.cached_metadata is not None:
|
||||
# parent container pointers don't differentiate between draft and non-draft
|
||||
# so when we do the lookup, we should do so with a non-draft location
|
||||
non_draft_loc = location._replace(revision=None)
|
||||
non_draft_loc = location.replace(revision=None)
|
||||
metadata_to_inherit = self.cached_metadata.get(non_draft_loc.url(), {})
|
||||
inherit_metadata(module, metadata_to_inherit)
|
||||
return module
|
||||
|
||||
@@ -646,7 +646,7 @@ class CombinedOpenEndedV1Module():
|
||||
if self.student_attempts > self.attempts:
|
||||
return {
|
||||
'success': False,
|
||||
#This is a student_facing_error
|
||||
# This is a student_facing_error
|
||||
'error': (
|
||||
'You have attempted this question {0} times. '
|
||||
'You are only allowed to attempt it {1} times.'
|
||||
|
||||
@@ -157,9 +157,10 @@ class ImportTestCase(BaseCourseTestCase):
|
||||
self.assertEqual(child.lms.due, ImportTestCase.date.from_json(v))
|
||||
self.assertEqual(child._inheritable_metadata, child._inherited_metadata)
|
||||
self.assertEqual(2, len(child._inherited_metadata))
|
||||
self.assertLessEqual(ImportTestCase.date.from_json(
|
||||
child._inherited_metadata['start']),
|
||||
datetime.datetime.now(UTC()))
|
||||
self.assertLessEqual(
|
||||
ImportTestCase.date.from_json(child._inherited_metadata['start']),
|
||||
datetime.datetime.now(UTC())
|
||||
)
|
||||
self.assertEqual(v, child._inherited_metadata['due'])
|
||||
|
||||
# Now export and check things
|
||||
@@ -221,7 +222,8 @@ class ImportTestCase(BaseCourseTestCase):
|
||||
# why do these tests look in the internal structure v just calling child.start?
|
||||
self.assertLessEqual(
|
||||
ImportTestCase.date.from_json(child._inherited_metadata['start']),
|
||||
datetime.datetime.now(UTC()))
|
||||
datetime.datetime.now(UTC())
|
||||
)
|
||||
|
||||
def test_metadata_override_default(self):
|
||||
"""
|
||||
|
||||
@@ -248,7 +248,7 @@ class TestDeserializeFloat(TestDeserialize):
|
||||
test_field = Float
|
||||
|
||||
def test_deserialize(self):
|
||||
self.assertDeserializeEqual( -2, '-2')
|
||||
self.assertDeserializeEqual(-2, '-2')
|
||||
self.assertDeserializeEqual("450", '"450"')
|
||||
self.assertDeserializeEqual(-2.78, '-2.78')
|
||||
self.assertDeserializeEqual("0.45", '"0.45"')
|
||||
@@ -256,7 +256,7 @@ class TestDeserializeFloat(TestDeserialize):
|
||||
# False can be parsed as a float (converts to 0)
|
||||
self.assertDeserializeEqual(False, 'false')
|
||||
# True can be parsed as a float (converts to 1)
|
||||
self.assertDeserializeEqual( True, 'true')
|
||||
self.assertDeserializeEqual(True, 'true')
|
||||
|
||||
def test_deserialize_unsupported_types(self):
|
||||
self.assertDeserializeEqual('[3]', '[3]')
|
||||
|
||||
@@ -141,9 +141,9 @@ class XmlDescriptor(XModuleDescriptor):
|
||||
# Related: What's the right behavior for clean_metadata?
|
||||
metadata_attributes = ('format', 'graceperiod', 'showanswer', 'rerandomize',
|
||||
'start', 'due', 'graded', 'display_name', 'url_name', 'hide_from_toc',
|
||||
'ispublic', # if True, then course is listed for all users; see
|
||||
'xqa_key', # for xqaa server access
|
||||
'giturl', # url of git server for origin of file
|
||||
'ispublic', # if True, then course is listed for all users; see
|
||||
'xqa_key', # for xqaa server access
|
||||
'giturl', # url of git server for origin of file
|
||||
# information about testcenter exams is a dict (of dicts), not a string,
|
||||
# so it cannot be easily exportable as a course element's attribute.
|
||||
'testcenter_info',
|
||||
@@ -347,7 +347,7 @@ class XmlDescriptor(XModuleDescriptor):
|
||||
model_data['children'] = children
|
||||
|
||||
model_data['xml_attributes'] = {}
|
||||
model_data['xml_attributes']['filename'] = definition.get('filename', ['', None]) # for git link
|
||||
model_data['xml_attributes']['filename'] = definition.get('filename', ['', None]) # for git link
|
||||
for key, value in metadata.items():
|
||||
if key not in set(f.name for f in cls.fields + cls.lms.fields):
|
||||
model_data['xml_attributes'][key] = value
|
||||
@@ -409,7 +409,6 @@ class XmlDescriptor(XModuleDescriptor):
|
||||
# don't want e.g. data_dir
|
||||
if attr not in self.metadata_to_strip and attr not in self.metadata_to_export_to_policy:
|
||||
val = val_for_xml(attr)
|
||||
#logging.debug('location.category = {0}, attr = {1}'.format(self.location.category, attr))
|
||||
try:
|
||||
xml_object.set(attr, val)
|
||||
except Exception, e:
|
||||
|
||||
@@ -523,10 +523,8 @@ def _adjust_start_date_for_beta_testers(user, descriptor):
|
||||
beta_group = course_beta_test_group_name(descriptor.location)
|
||||
if beta_group in user_groups:
|
||||
debug("Adjust start time: user in group %s", beta_group)
|
||||
start_as_datetime = descriptor.lms.start
|
||||
delta = timedelta(descriptor.lms.days_early_for_beta)
|
||||
effective = start_as_datetime - delta
|
||||
# ...and back to time_struct
|
||||
effective = descriptor.lms.start - delta
|
||||
return effective
|
||||
|
||||
return descriptor.lms.start
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
Steps for problem.feature lettuce tests
|
||||
'''
|
||||
|
||||
#pylint: disable=C0111
|
||||
#pylint: disable=W0621
|
||||
# pylint: disable=C0111
|
||||
# pylint: disable=W0621
|
||||
|
||||
from lettuce import world, step
|
||||
from lettuce.django import django_url
|
||||
@@ -135,7 +135,7 @@ def action_button_present(_step, buttonname, doesnt_appear):
|
||||
|
||||
|
||||
@step(u'the button with the label "([^"]*)" does( not)? appear')
|
||||
def button_with_label_present(step, buttonname, doesnt_appear):
|
||||
def button_with_label_present(_step, buttonname, doesnt_appear):
|
||||
if doesnt_appear:
|
||||
assert world.browser.is_text_not_present(buttonname, wait_time=5)
|
||||
else:
|
||||
|
||||
@@ -354,7 +354,7 @@ def get_module_for_descriptor_internal(user, descriptor, model_data_cache, cours
|
||||
system.set('position', position)
|
||||
system.set('DEBUG', settings.DEBUG)
|
||||
if settings.MITX_FEATURES.get('ENABLE_PSYCHOMETRICS'):
|
||||
system.set('psychometrics_handler', # set callback for updating PsychometricsData
|
||||
system.set('psychometrics_handler', # set callback for updating PsychometricsData
|
||||
make_psychometrics_data_update_handler(course_id, user, descriptor.location.url()))
|
||||
|
||||
try:
|
||||
|
||||
Reference in New Issue
Block a user