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:
@@ -1332,7 +1332,7 @@ def create_xblock_info(xblock, data=None, metadata=None, include_ancestor_info=F
|
||||
xblock_info['staff_only_message'] = True
|
||||
elif child_info and child_info['children']:
|
||||
xblock_info['staff_only_message'] = all(
|
||||
[child['staff_only_message'] for child in child_info['children']]
|
||||
child['staff_only_message'] for child in child_info['children']
|
||||
)
|
||||
else:
|
||||
xblock_info['staff_only_message'] = False
|
||||
|
||||
@@ -177,7 +177,7 @@ def _course_team_user(request, course_key, email):
|
||||
role_added = True
|
||||
else:
|
||||
return permissions_error_response
|
||||
elif role.has_user(user, check_user_activation=False):
|
||||
elif role.has_user(user, check_user_activation=False): # pylint: disable=no-value-for-parameter
|
||||
# Remove the user from this old role:
|
||||
old_roles.add(role)
|
||||
|
||||
|
||||
@@ -72,6 +72,6 @@ def should_send_proctoring_requirements_email(username, course_id):
|
||||
settings={'is_time_limited': True}
|
||||
)
|
||||
|
||||
has_proctored_exam = any([exam.is_proctored_exam for exam in timed_exams])
|
||||
has_proctored_exam = any(exam.is_proctored_exam for exam in timed_exams)
|
||||
|
||||
return has_proctored_exam
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
# lint-amnesty, pylint: disable=missing-module-docstring
|
||||
|
||||
import unittest
|
||||
import pytest
|
||||
from tempfile import NamedTemporaryFile
|
||||
|
||||
import pytest
|
||||
import six
|
||||
from django.conf import settings
|
||||
from django.core.files.uploadedfile import SimpleUploadedFile
|
||||
@@ -13,13 +13,11 @@ from testfixtures import LogCapture
|
||||
|
||||
from common.djangoapps.course_modes.models import CourseMode
|
||||
from common.djangoapps.course_modes.tests.factories import CourseModeFactory
|
||||
from common.djangoapps.student.models import CourseEnrollment
|
||||
from common.djangoapps.student.models import BulkChangeEnrollmentConfiguration, CourseEnrollment
|
||||
from common.djangoapps.student.tests.factories import UserFactory
|
||||
from xmodule.modulestore.tests.django_utils import SharedModuleStoreTestCase
|
||||
from xmodule.modulestore.tests.factories import CourseFactory
|
||||
|
||||
from common.djangoapps.student.models import BulkChangeEnrollmentConfiguration
|
||||
|
||||
LOGGER_NAME = 'common.djangoapps.student.management.commands.bulk_change_enrollment_csv'
|
||||
|
||||
|
||||
|
||||
@@ -52,7 +52,7 @@ class JwtHasTpaProviderFilterForRequestedProvider(BasePermission):
|
||||
# TODO: Remove ApiKeyHeaderPermission. Check deprecated_api_key_header custom attribute for active usage.
|
||||
_NOT_JWT_RESTRICTED_TPA_PERMISSIONS = (
|
||||
C(NotJwtRestrictedApplication) &
|
||||
(C(IsSuperuser) | ApiKeyHeaderPermission | C(IsStaff))
|
||||
(C(IsSuperuser) | ApiKeyHeaderPermission | C(IsStaff)) # pylint: disable=unsupported-binary-operation
|
||||
)
|
||||
_JWT_RESTRICTED_TPA_PERMISSIONS = (
|
||||
C(JwtRestrictedApplication) &
|
||||
|
||||
@@ -100,21 +100,21 @@ class TransactionManagersTestCase(TransactionTestCase):
|
||||
if connection.vendor != 'mysql':
|
||||
raise unittest.SkipTest('Only works on MySQL.')
|
||||
|
||||
outer_atomic()(do_nothing)()
|
||||
outer_atomic()(do_nothing)() # pylint: disable=not-callable
|
||||
|
||||
with atomic():
|
||||
atomic()(do_nothing)()
|
||||
atomic()(do_nothing)() # pylint: disable=not-callable
|
||||
|
||||
with outer_atomic():
|
||||
atomic()(do_nothing)()
|
||||
atomic()(do_nothing)() # pylint: disable=not-callable
|
||||
|
||||
with self.assertRaisesRegex(TransactionManagementError, 'Cannot be inside an atomic block.'):
|
||||
with atomic():
|
||||
outer_atomic()(do_nothing)()
|
||||
outer_atomic()(do_nothing)() # pylint: disable=not-callable
|
||||
|
||||
with self.assertRaisesRegex(TransactionManagementError, 'Cannot be inside an atomic block.'):
|
||||
with outer_atomic():
|
||||
outer_atomic()(do_nothing)()
|
||||
outer_atomic()(do_nothing)() # pylint: disable=not-callable
|
||||
|
||||
def test_named_outer_atomic_nesting(self):
|
||||
"""
|
||||
@@ -124,44 +124,44 @@ class TransactionManagersTestCase(TransactionTestCase):
|
||||
if connection.vendor != 'mysql':
|
||||
raise unittest.SkipTest('Only works on MySQL.')
|
||||
|
||||
outer_atomic(name='abc')(do_nothing)()
|
||||
outer_atomic(name='abc')(do_nothing)() # pylint: disable=not-callable
|
||||
|
||||
with atomic():
|
||||
outer_atomic(name='abc')(do_nothing)()
|
||||
outer_atomic(name='abc')(do_nothing)() # pylint: disable=not-callable
|
||||
|
||||
with enable_named_outer_atomic('abc'):
|
||||
|
||||
outer_atomic(name='abc')(do_nothing)() # Not nested.
|
||||
outer_atomic(name='abc')(do_nothing)() # pylint: disable=not-callable # Not nested.
|
||||
|
||||
with atomic():
|
||||
outer_atomic(name='pqr')(do_nothing)() # Not enabled.
|
||||
outer_atomic(name='pqr')(do_nothing)() # pylint: disable=not-callable # Not enabled.
|
||||
|
||||
with self.assertRaisesRegex(TransactionManagementError, 'Cannot be inside an atomic block.'):
|
||||
with atomic():
|
||||
outer_atomic(name='abc')(do_nothing)()
|
||||
outer_atomic(name='abc')(do_nothing)() # pylint: disable=not-callable
|
||||
|
||||
with enable_named_outer_atomic('abc', 'def'):
|
||||
|
||||
outer_atomic(name='def')(do_nothing)() # Not nested.
|
||||
outer_atomic(name='def')(do_nothing)() # pylint: disable=not-callable # Not nested.
|
||||
|
||||
with atomic():
|
||||
outer_atomic(name='pqr')(do_nothing)() # Not enabled.
|
||||
outer_atomic(name='pqr')(do_nothing)() # pylint: disable=not-callable # Not enabled.
|
||||
|
||||
with self.assertRaisesRegex(TransactionManagementError, 'Cannot be inside an atomic block.'):
|
||||
with atomic():
|
||||
outer_atomic(name='def')(do_nothing)()
|
||||
outer_atomic(name='def')(do_nothing)() # pylint: disable=not-callable
|
||||
|
||||
with self.assertRaisesRegex(TransactionManagementError, 'Cannot be inside an atomic block.'):
|
||||
with outer_atomic():
|
||||
outer_atomic(name='def')(do_nothing)()
|
||||
outer_atomic(name='def')(do_nothing)() # pylint: disable=not-callable
|
||||
|
||||
with self.assertRaisesRegex(TransactionManagementError, 'Cannot be inside an atomic block.'):
|
||||
with atomic():
|
||||
outer_atomic(name='abc')(do_nothing)()
|
||||
outer_atomic(name='abc')(do_nothing)() # pylint: disable=not-callable
|
||||
|
||||
with self.assertRaisesRegex(TransactionManagementError, 'Cannot be inside an atomic block.'):
|
||||
with outer_atomic():
|
||||
outer_atomic(name='abc')(do_nothing)()
|
||||
outer_atomic(name='abc')(do_nothing)() # pylint: disable=not-callable
|
||||
|
||||
|
||||
@ddt.ddt
|
||||
|
||||
@@ -9,7 +9,6 @@ from datetime import datetime
|
||||
from io import StringIO
|
||||
import pytest
|
||||
import ddt
|
||||
import six
|
||||
from django.core import exceptions
|
||||
from django.core.files.uploadedfile import SimpleUploadedFile
|
||||
from django.http import HttpRequest
|
||||
|
||||
@@ -1284,7 +1284,7 @@ class ChoiceResponseTest(ResponseTest): # pylint: disable=missing-class-docstri
|
||||
ok0 = c % 2 == 0 # check remainder modulo 2
|
||||
ok1 = c % 3 == 0 # check remainder modulo 3
|
||||
ok2 = c % 5 == 0 # check remainder modulo 5
|
||||
ok3 = not any([ok0, ok1, ok2])
|
||||
ok3 = not any((ok0, ok1, ok2))
|
||||
""")
|
||||
choices = ["$ok0", "$ok1", "$ok2", "$ok3"]
|
||||
problem = self.build_problem(script=script,
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -18,10 +18,7 @@ class PaginatedMixin(object):
|
||||
|
||||
To specify a specific arrow, pass an iterable with a single element, 'next' or 'previous'.
|
||||
"""
|
||||
return all([
|
||||
self.q(css=u'nav.%s * .%s-page-link.is-disabled' % (position, arrow))
|
||||
for arrow in arrows
|
||||
])
|
||||
return all(self.q(css=u'nav.%s * .%s-page-link.is-disabled' % (position, arrow)) for arrow in arrows)
|
||||
|
||||
def move_back(self, position):
|
||||
"""
|
||||
|
||||
@@ -56,7 +56,7 @@ def set_input_value_and_save(page, css, value):
|
||||
page.wait_for_ajax()
|
||||
|
||||
|
||||
def verify_ordering(test_class, page, expected_orderings):
|
||||
def verify_ordering(test_class, page, expected_orderings): # pylint: disable=unused-argument
|
||||
"""
|
||||
Verifies the expected ordering of xblocks on the page.
|
||||
"""
|
||||
|
||||
@@ -159,7 +159,7 @@ class CertificatesListView(APIView):
|
||||
permissions.JwtHasUserFilterForRequestedUser
|
||||
)
|
||||
),
|
||||
(C(permissions.IsStaff) | IsOwnerOrPublicCertificates),
|
||||
(C(permissions.IsStaff) | IsOwnerOrPublicCertificates), # pylint: disable=unsupported-binary-operation
|
||||
)
|
||||
|
||||
required_scopes = ['certificates:read']
|
||||
|
||||
@@ -491,11 +491,11 @@ class CertificateAvailableDate(DateSummary):
|
||||
|
||||
@property
|
||||
def has_certificate_modes(self):
|
||||
return any([
|
||||
return any(
|
||||
mode.slug for mode in CourseMode.modes_for_course(
|
||||
course_id=self.course.id, include_expired=True
|
||||
) if mode.slug != CourseMode.AUDIT
|
||||
])
|
||||
)
|
||||
|
||||
def register_alerts(self, request, course):
|
||||
"""
|
||||
|
||||
@@ -103,7 +103,7 @@ def _get_course(course_key, user):
|
||||
# Raise course not found if the user cannot access the course
|
||||
# since it doesn't make sense to redirect an API.
|
||||
raise CourseNotFoundError("Course not found.") # lint-amnesty, pylint: disable=raise-missing-from
|
||||
if not any([tab.type == 'discussion' and tab.is_enabled(course, user) for tab in course.tabs]):
|
||||
if not any(tab.type == 'discussion' and tab.is_enabled(course, user) for tab in course.tabs):
|
||||
raise DiscussionDisabledError("Discussion is disabled for the course.")
|
||||
return course
|
||||
|
||||
|
||||
@@ -293,10 +293,10 @@ class PartialDictMatcher: # lint-amnesty, pylint: disable=missing-class-docstri
|
||||
self.expected_values = expected_values
|
||||
|
||||
def __eq__(self, other):
|
||||
return all([
|
||||
return all(
|
||||
key in other and other[key] == value
|
||||
for key, value in self.expected_values.items()
|
||||
])
|
||||
)
|
||||
|
||||
|
||||
@patch('requests.request', autospec=True)
|
||||
|
||||
@@ -9,7 +9,6 @@ from django.conf import settings
|
||||
from django.db.models import BooleanField, IntegerField, TextField
|
||||
from django.utils.encoding import python_2_unicode_compatible
|
||||
from opaque_keys.edx.django.models import CourseKeyField
|
||||
from six import text_type
|
||||
|
||||
from openedx.core.lib.cache_utils import request_cached
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ class CourseData:
|
||||
cache during its lifecycle.
|
||||
"""
|
||||
def __init__(self, user, course=None, collected_block_structure=None, structure=None, course_key=None):
|
||||
if not any([course, collected_block_structure, structure, course_key]):
|
||||
if not any((course, collected_block_structure, structure, course_key)):
|
||||
raise ValueError(
|
||||
"You must specify one of course, collected_block_structure, structure, or course_key to this method."
|
||||
)
|
||||
|
||||
@@ -19,7 +19,6 @@ from rest_framework import status
|
||||
from rest_framework.generics import GenericAPIView
|
||||
from rest_framework.response import Response
|
||||
from rest_framework.views import APIView
|
||||
from six import text_type
|
||||
|
||||
from common.djangoapps.student.auth import has_course_author_access
|
||||
from common.djangoapps.student.models import CourseEnrollment
|
||||
|
||||
@@ -17,7 +17,6 @@ from opaque_keys.edx.locator import BlockUsageLocator
|
||||
from pytz import UTC
|
||||
from rest_framework import status
|
||||
from rest_framework.test import APITestCase
|
||||
from six import text_type
|
||||
|
||||
from common.djangoapps.course_modes.models import CourseMode
|
||||
from common.djangoapps.student.tests.factories import CourseEnrollmentFactory, UserFactory
|
||||
|
||||
@@ -5,8 +5,6 @@ import json
|
||||
from unittest import mock
|
||||
|
||||
import pytest
|
||||
import mock
|
||||
import six
|
||||
from django.core.exceptions import ObjectDoesNotExist
|
||||
from opaque_keys import InvalidKeyError
|
||||
|
||||
|
||||
@@ -9,8 +9,6 @@ import unittest
|
||||
from unittest import mock
|
||||
|
||||
import pytest
|
||||
import mock
|
||||
import six
|
||||
from django.contrib.auth.models import User # lint-amnesty, pylint: disable=imported-auth-user
|
||||
from django.core.exceptions import MultipleObjectsReturned
|
||||
from django.test import TestCase
|
||||
|
||||
@@ -120,7 +120,7 @@ def get_task_completion_info(instructor_task): # lint-amnesty, pylint: disable=
|
||||
if instructor_task.task_state in [FAILURE, REVOKED]:
|
||||
return (succeeded, task_output.get('message', _('No message provided')))
|
||||
|
||||
if any([key not in task_output for key in ['action_name', 'attempted', 'total']]):
|
||||
if any(key not in task_output for key in ['action_name', 'attempted', 'total']):
|
||||
fmt = _("Invalid task_output information found for instructor_task {0}: {1}")
|
||||
log.warning(fmt.format(instructor_task.task_id, instructor_task.task_output))
|
||||
return (succeeded, _("No progress status information available"))
|
||||
|
||||
@@ -43,9 +43,7 @@ class AppVersionConfig(models.Model):
|
||||
|
||||
.. no_pii:
|
||||
"""
|
||||
PLATFORM_CHOICES = tuple(
|
||||
[(platform, platform) for platform in sorted(PLATFORM_CLASSES.keys())]
|
||||
)
|
||||
PLATFORM_CHOICES = tuple((platform, platform) for platform in sorted(PLATFORM_CLASSES.keys()))
|
||||
|
||||
platform = models.CharField(max_length=50, choices=PLATFORM_CHOICES, blank=False)
|
||||
version = models.CharField(
|
||||
|
||||
@@ -159,7 +159,7 @@ class TeamsDashboardView(GenericAPIView):
|
||||
'organization_protection_status': organization_protection_status
|
||||
},
|
||||
)
|
||||
topics_data["sort_order"] = sort_order
|
||||
topics_data["sort_order"] = sort_order # pylint: disable=unsupported-assignment-operation
|
||||
|
||||
filter_query = {
|
||||
'membership__user': user,
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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):
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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'])
|
||||
)
|
||||
|
||||
|
||||
|
||||
@@ -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.",
|
||||
|
||||
@@ -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))
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -141,7 +141,7 @@ def get_course_outline_block_tree(request, course_id, user=None, allow_start_dat
|
||||
is_scored = block.get('has_score', False) and block.get('weight', 1) > 0
|
||||
# Use a list comprehension to force the recursion over all children, rather than just stopping
|
||||
# at the first child that is scored.
|
||||
children_scored = any([recurse_mark_scored(child) for child in block.get('children', [])])
|
||||
children_scored = any(recurse_mark_scored(child) for child in block.get('children', []))
|
||||
if is_scored or children_scored:
|
||||
block['scored'] = True
|
||||
return True
|
||||
|
||||
@@ -40,9 +40,9 @@ class TestPaverPIICheck(unittest.TestCase):
|
||||
call_task('pavelib.quality.run_pii_check', options={"report_dir": str(self.report_dir)})
|
||||
mock_calls = [str(call) for call in mock_paver_sh.mock_calls]
|
||||
assert len(mock_calls) == 2
|
||||
assert any(['lms.envs.test' in call for call in mock_calls])
|
||||
assert any(['cms.envs.test' in call for call in mock_calls])
|
||||
assert all([str(self.report_dir) in call for call in mock_calls])
|
||||
assert any('lms.envs.test' in call for call in mock_calls)
|
||||
assert any('cms.envs.test' in call for call in mock_calls)
|
||||
assert all(str(self.report_dir) in call for call in mock_calls)
|
||||
metrics_file = Env.METRICS_DIR / 'pii'
|
||||
assert open(metrics_file, 'r').read() == 'Number of PII Annotation violations: 66\n'
|
||||
|
||||
@@ -67,8 +67,8 @@ class TestPaverPIICheck(unittest.TestCase):
|
||||
self.assertRaises(BuildFailure)
|
||||
mock_calls = [str(call) for call in mock_paver_sh.mock_calls]
|
||||
assert len(mock_calls) == 2
|
||||
assert any(['lms.envs.test' in call for call in mock_calls])
|
||||
assert any(['cms.envs.test' in call for call in mock_calls])
|
||||
assert all([str(self.report_dir) in call for call in mock_calls])
|
||||
assert any('lms.envs.test' in call for call in mock_calls)
|
||||
assert any('cms.envs.test' in call for call in mock_calls)
|
||||
assert all(str(self.report_dir) in call for call in mock_calls)
|
||||
metrics_file = Env.METRICS_DIR / 'pii'
|
||||
assert open(metrics_file, 'r').read() == 'Number of PII Annotation violations: 66\n'
|
||||
|
||||
@@ -123,3 +123,6 @@ edx-bulk-grades<0.8.5
|
||||
|
||||
# python3-saml==1.10.0 version started breaking a11y tests
|
||||
python3-saml<1.10.0
|
||||
|
||||
# edx-proctoring>3.5.0 causes test failures
|
||||
edx-proctoring==3.5.0
|
||||
|
||||
@@ -106,7 +106,7 @@ edx-milestones==0.3.0 # via -r requirements/edx/base.in
|
||||
edx-opaque-keys[django]==2.2.0 # via -r requirements/edx/paver.txt, edx-bulk-grades, edx-ccx-keys, edx-completion, edx-drf-extensions, edx-enterprise, edx-milestones, edx-organizations, edx-proctoring, edx-user-state-client, edx-when, lti-consumer-xblock, xmodule
|
||||
edx-organizations==6.9.0 # via -r requirements/edx/base.in
|
||||
edx-proctoring-proctortrack==1.0.5 # via -r requirements/edx/base.in
|
||||
edx-proctoring==3.6.0 # via -r requirements/edx/base.in, edx-proctoring-proctortrack
|
||||
edx-proctoring==3.5.0 # via -r requirements/edx/base.in, edx-proctoring-proctortrack
|
||||
edx-rbac==1.4.1 # via edx-enterprise
|
||||
edx-rest-api-client==5.3.0 # via -r requirements/edx/base.in, edx-enterprise, edx-proctoring
|
||||
edx-search==3.0.0 # via -r requirements/edx/base.in
|
||||
|
||||
@@ -118,7 +118,7 @@ edx-milestones==0.3.0 # via -r requirements/edx/testing.txt
|
||||
edx-opaque-keys[django]==2.2.0 # via -r requirements/edx/testing.txt, edx-bulk-grades, edx-ccx-keys, edx-completion, edx-drf-extensions, edx-enterprise, edx-milestones, edx-organizations, edx-proctoring, edx-user-state-client, edx-when, lti-consumer-xblock, xmodule
|
||||
edx-organizations==6.9.0 # via -r requirements/edx/testing.txt
|
||||
edx-proctoring-proctortrack==1.0.5 # via -r requirements/edx/testing.txt
|
||||
edx-proctoring==3.6.0 # via -r requirements/edx/testing.txt, edx-proctoring-proctortrack
|
||||
edx-proctoring==3.5.0 # via -r requirements/edx/testing.txt, edx-proctoring-proctortrack
|
||||
edx-rbac==1.4.1 # via -r requirements/edx/testing.txt, edx-enterprise
|
||||
edx-rest-api-client==5.3.0 # via -r requirements/edx/testing.txt, edx-enterprise, edx-proctoring
|
||||
edx-search==3.0.0 # via -r requirements/edx/testing.txt
|
||||
|
||||
@@ -115,7 +115,7 @@ edx-milestones==0.3.0 # via -r requirements/edx/base.txt
|
||||
edx-opaque-keys[django]==2.2.0 # via -r requirements/edx/base.txt, edx-bulk-grades, edx-ccx-keys, edx-completion, edx-drf-extensions, edx-enterprise, edx-milestones, edx-organizations, edx-proctoring, edx-user-state-client, edx-when, lti-consumer-xblock, xmodule
|
||||
edx-organizations==6.9.0 # via -r requirements/edx/base.txt
|
||||
edx-proctoring-proctortrack==1.0.5 # via -r requirements/edx/base.txt
|
||||
edx-proctoring==3.6.0 # via -r requirements/edx/base.txt, edx-proctoring-proctortrack
|
||||
edx-proctoring==3.5.0 # via -r requirements/edx/base.txt, edx-proctoring-proctortrack
|
||||
edx-rbac==1.4.1 # via -r requirements/edx/base.txt, edx-enterprise
|
||||
edx-rest-api-client==5.3.0 # via -r requirements/edx/base.txt, edx-enterprise, edx-proctoring
|
||||
edx-search==3.0.0 # via -r requirements/edx/base.txt
|
||||
|
||||
Reference in New Issue
Block a user