Fixed new pylint warnings.
use generator in any/all() disable not-callable warnings disable no-member warnings Suppressed smaller pylint warnings Pin edx-proctoring==3.5.0
This commit is contained in:
@@ -228,7 +228,7 @@ class LibraryContentBlock(
|
||||
raise NotImplementedError("Unsupported mode.")
|
||||
selected_keys |= added_block_keys
|
||||
|
||||
if any([invalid_block_keys, overlimit_block_keys, added_block_keys]):
|
||||
if any((invalid_block_keys, overlimit_block_keys, added_block_keys)):
|
||||
selected = list(selected_keys)
|
||||
random.shuffle(selected)
|
||||
|
||||
|
||||
@@ -725,7 +725,7 @@ class MongoModuleStore(ModuleStoreDraftAndPublished, ModuleStoreWriteBase, Mongo
|
||||
results_by_url[location_url].setdefault('definition', {})['children'] = set(total_children)
|
||||
else:
|
||||
results_by_url[location_url] = result
|
||||
if location.block_type == 'course':
|
||||
if location.block_type == 'course': # pylint: disable=no-member
|
||||
root = location_url
|
||||
|
||||
# now traverse the tree and compute down the inherited metadata
|
||||
|
||||
@@ -679,7 +679,7 @@ class DraftModuleStore(MongoModuleStore):
|
||||
# fix a bug where dangling pointers should imply a change
|
||||
if len(xblock.children) > len(xblock.get_children()):
|
||||
return True
|
||||
return any([self.has_changes(child) for child in xblock.get_children()])
|
||||
return any(self.has_changes(child) for child in xblock.get_children())
|
||||
# otherwise there are no changes
|
||||
else:
|
||||
return False
|
||||
|
||||
@@ -361,7 +361,7 @@ class DraftVersioningModuleStore(SplitMongoModuleStore, ModuleStoreDraftAndPubli
|
||||
# check the children in the draft
|
||||
if 'children' in draft_block.fields:
|
||||
return any(
|
||||
[has_changes_subtree(child_block_id) for child_block_id in draft_block.fields['children']]
|
||||
has_changes_subtree(child_block_id) for child_block_id in draft_block.fields['children']
|
||||
)
|
||||
|
||||
return False
|
||||
|
||||
@@ -626,7 +626,7 @@ def mongo_uses_error_check(store):
|
||||
Does mongo use the error check as a separate message?
|
||||
"""
|
||||
if hasattr(store, 'modulestores'):
|
||||
return any([mongo_uses_error_check(substore) for substore in store.modulestores])
|
||||
return any(mongo_uses_error_check(substore) for substore in store.modulestores)
|
||||
return False
|
||||
|
||||
|
||||
|
||||
@@ -214,9 +214,9 @@ class DirectOnlyCategorySemantics(PureModulestoreTestCase):
|
||||
def verify_course_summery_fields(course_summary):
|
||||
""" Verify that every `course_summary` object has all the required fields """
|
||||
expected_fields = CourseSummary.course_info_fields + ['id', 'location', 'has_ended']
|
||||
return all([hasattr(course_summary, field) for field in expected_fields])
|
||||
return all(hasattr(course_summary, field) for field in expected_fields)
|
||||
|
||||
assert all((verify_course_summery_fields(course_summary) for course_summary in course_summaries))
|
||||
assert all(verify_course_summery_fields(course_summary) for course_summary in course_summaries)
|
||||
|
||||
def is_detached(self, block_type):
|
||||
"""
|
||||
@@ -236,7 +236,7 @@ class DirectOnlyCategorySemantics(PureModulestoreTestCase):
|
||||
field_data = KvsFieldData(key_store)
|
||||
|
||||
aside = AsideTest(scope_ids=scope_ids, runtime=TestRuntime(services={'field-data': field_data}))
|
||||
aside.fields[self.ASIDE_DATA_FIELD.field_name].write_to(aside, self.ASIDE_DATA_FIELD.initial)
|
||||
aside.fields[self.ASIDE_DATA_FIELD.field_name].write_to(aside, self.ASIDE_DATA_FIELD.initial) # pylint: disable=unsubscriptable-object
|
||||
return [aside]
|
||||
|
||||
def _get_aside(self, block):
|
||||
|
||||
@@ -180,7 +180,7 @@ class ConditionalBlockBasicTest(unittest.TestCase):
|
||||
ajax = json.loads(modules['cond_module'].handle_ajax('', ''))
|
||||
print("ajax: ", ajax)
|
||||
fragments = ajax['fragments']
|
||||
assert not any([('This is a secret' in item['content']) for item in fragments])
|
||||
assert not any(('This is a secret' in item['content']) for item in fragments)
|
||||
|
||||
# now change state of the capa problem to make it completed
|
||||
modules['source_module'].is_attempted = "true"
|
||||
@@ -188,7 +188,7 @@ class ConditionalBlockBasicTest(unittest.TestCase):
|
||||
modules['cond_module'].save()
|
||||
print("post-attempt ajax: ", ajax)
|
||||
fragments = ajax['fragments']
|
||||
assert any([('This is a secret' in item['content']) for item in fragments])
|
||||
assert any(('This is a secret' in item['content']) for item in fragments)
|
||||
|
||||
def test_error_as_source(self):
|
||||
'''
|
||||
@@ -199,7 +199,7 @@ class ConditionalBlockBasicTest(unittest.TestCase):
|
||||
modules['cond_module'].save()
|
||||
ajax = json.loads(modules['cond_module'].handle_ajax('', ''))
|
||||
fragments = ajax['fragments']
|
||||
assert not any([('This is a secret' in item['content']) for item in fragments])
|
||||
assert not any(('This is a secret' in item['content']) for item in fragments)
|
||||
|
||||
@patch('xmodule.conditional_module.log')
|
||||
def test_conditional_with_staff_only_source_module(self, mock_log):
|
||||
@@ -294,7 +294,7 @@ class ConditionalBlockXmlTest(unittest.TestCase):
|
||||
module.save()
|
||||
print("ajax: ", ajax)
|
||||
fragments = ajax['fragments']
|
||||
assert not any([('This is a secret' in item['content']) for item in fragments])
|
||||
assert not any(('This is a secret' in item['content']) for item in fragments)
|
||||
|
||||
# Now change state of the capa problem to make it completed
|
||||
inner_module = inner_get_module(location.replace(category="problem", name='choiceprob'))
|
||||
@@ -306,7 +306,7 @@ class ConditionalBlockXmlTest(unittest.TestCase):
|
||||
module.save()
|
||||
print("post-attempt ajax: ", ajax)
|
||||
fragments = ajax['fragments']
|
||||
assert any([('This is a secret' in item['content']) for item in fragments])
|
||||
assert any(('This is a secret' in item['content']) for item in fragments)
|
||||
|
||||
maxDiff = None
|
||||
|
||||
|
||||
Reference in New Issue
Block a user