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:
usamasadiq
2021-02-22 12:42:26 +05:00
parent 23d87e253f
commit 96f0915b0f
44 changed files with 73 additions and 86 deletions

View File

@@ -69,7 +69,7 @@ class TestGenerateCourseBlocks(ModuleStoreTestCase):
"""
Asserts that the logger was called with the given message.
"""
message_present = any([message in call_args[0][0] for call_args in mock_log.warning.call_args_list])
message_present = any(message in call_args[0][0] for call_args in mock_log.warning.call_args_list)
if expected_presence:
assert message_present
else:

View File

@@ -227,7 +227,7 @@ class DarkLangMiddlewareTests(CacheIsolationTestCase):
self.assertAcceptEquals(
'es-419;q=1.0',
self.process_middleware_request(accept=b'{};q=1.0, pt;q=0.5'.format(latin_america_code))
self.process_middleware_request(accept=b'{};q=1.0, pt;q=0.5'.format(latin_america_code)) # pylint:disable=no-member
)
def assert_session_lang_equals(self, value, session):

View File

@@ -173,7 +173,7 @@ class DiscussionsConfigurationModelTest(TestCase):
assert not configuration.enabled
assert configuration.lti_configuration is None
actual_url = configuration.plugin_configuration.get('url')
expected_url = self.configuration_with_values.plugin_configuration.get('url')
expected_url = self.configuration_with_values.plugin_configuration.get('url') # pylint: disable=no-member
assert actual_url == expected_url
assert configuration.provider_type == self.configuration_with_values.provider_type

View File

@@ -158,7 +158,7 @@ def permission_blacked_out(course, role_names, permission_name):
return (
not course.forum_posts_allowed and
role_names == {FORUM_ROLE_STUDENT} and
any([permission_name.startswith(prefix) for prefix in ['edit', 'update', 'create']])
any(permission_name.startswith(prefix) for prefix in ['edit', 'update', 'create'])
)

View File

@@ -55,7 +55,7 @@ def check_comprehensive_theme_settings(app_configs, **kwargs): # lint-amnesty,
id='openedx.core.djangoapps.theming.E004',
)
)
if not all([isinstance(theme_dir, six.string_types) for theme_dir in theme_dirs]):
if not all(isinstance(theme_dir, six.string_types) for theme_dir in theme_dirs):
errors.append(
Error(
"COMPREHENSIVE_THEME_DIRS must contain only strings.",
@@ -63,7 +63,7 @@ def check_comprehensive_theme_settings(app_configs, **kwargs): # lint-amnesty,
id='openedx.core.djangoapps.theming.E005',
)
)
if not all([theme_dir.startswith("/") for theme_dir in theme_dirs]):
if not all(theme_dir.startswith("/") for theme_dir in theme_dirs):
errors.append(
Error(
"COMPREHENSIVE_THEME_DIRS must contain only absolute paths to themes dirs.",
@@ -71,7 +71,7 @@ def check_comprehensive_theme_settings(app_configs, **kwargs): # lint-amnesty,
id='openedx.core.djangoapps.theming.E006',
)
)
if not all([os.path.isdir(theme_dir) for theme_dir in theme_dirs]):
if not all(os.path.isdir(theme_dir) for theme_dir in theme_dirs):
errors.append(
Error(
"COMPREHENSIVE_THEME_DIRS must contain valid paths.",

View File

@@ -164,7 +164,7 @@ class UserMessageCollection():
"""
Returns the user message type associated with a level.
"""
for __, type in UserMessageType.__members__.items(): # lint-amnesty, pylint: disable=redefined-builtin
for __, type in UserMessageType.__members__.items(): # lint-amnesty, pylint: disable=redefined-builtin, no-member
if type.value is level:
return type
raise Exception(u'Unable to find UserMessageType for level {level}'.format(level=level))

View File

@@ -160,7 +160,7 @@ class DiscussionXBlockImportExportTests(TestCase):
target_node = etree.Element('dummy')
block = DiscussionXBlock(self.runtime_mock, scope_ids=self.keys, field_data=DictFieldData({}))
discussion_id_field = block.fields['discussion_id']
discussion_id_field = block.fields['discussion_id'] # pylint: disable=unsubscriptable-object
# precondition checks - discussion_id does not have a value and uses UNIQUE_ID
self.assertEqual(

View File

@@ -1,4 +1,5 @@
""" # lint-amnesty, pylint: disable=django-not-configured
# lint-amnesty, pylint: disable=django-not-configured
"""
Script to process pytest warnings output by pytest-json-report plugin and output it as a html
"""
@@ -10,9 +11,7 @@ import os
import re
from collections import Counter
from write_to_html import (
HtmlOutlineWriter,
) # noqa pylint: disable=import-error,useless-suppression
from write_to_html import HtmlOutlineWriter # noqa pylint: disable=import-error,useless-suppression
columns = [
"message",