Commit 8b23eeca by Don Mitchell Committed by Calen Pennington

Minor pylint/whitespace changes

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