diff --git a/cms/djangoapps/contentstore/api/tests/test_validation.py b/cms/djangoapps/contentstore/api/tests/test_validation.py
index 4b94c3558822..a65a1de6c892 100644
--- a/cms/djangoapps/contentstore/api/tests/test_validation.py
+++ b/cms/djangoapps/contentstore/api/tests/test_validation.py
@@ -54,7 +54,7 @@ def initialize_course(cls, course):
update_key.course_key,
update_key.block_type,
block_id=update_key.block_id,
- fields=dict(data="
{org} -
{course}
@@ -869,13 +869,13 @@ def test_dashboard_with_resume_buttons_and_view_buttons(self):
html_for_view_buttons.append(
self._get_html_for_view_course_button(
course_key_string,
- course_run_string
+ course_run_string # pylint: disable=possibly-used-before-assignment
)
)
html_for_resume_buttons.append(
self._get_html_for_resume_course_button(
course_key_string,
- last_completed_block_string,
+ last_completed_block_string, # pylint: disable=possibly-used-before-assignment
course_run_string
)
)
diff --git a/common/djangoapps/student/views/dashboard.py b/common/djangoapps/student/views/dashboard.py
index f729a2aee130..96022a837420 100644
--- a/common/djangoapps/student/views/dashboard.py
+++ b/common/djangoapps/student/views/dashboard.py
@@ -829,7 +829,7 @@ def student_dashboard(request): # lint-amnesty, pylint: disable=too-many-statem
'show_dashboard_tabs': True,
'disable_courseware_js': True,
'display_course_modes_on_dashboard': enable_verified_certificates and display_course_modes_on_dashboard,
- 'display_sidebar_account_activation_message': not(user.is_active or hide_dashboard_courses_until_activated),
+ 'display_sidebar_account_activation_message': not (user.is_active or hide_dashboard_courses_until_activated),
'display_dashboard_courses': (user.is_active or not hide_dashboard_courses_until_activated),
'empty_dashboard_message': empty_dashboard_message,
'enrollments_fbe_is_on': enrollments_fbe_is_on,
diff --git a/common/djangoapps/third_party_auth/api/tests/test_permissions.py b/common/djangoapps/third_party_auth/api/tests/test_permissions.py
index 1cb9450c49a2..9ae60482b03e 100644
--- a/common/djangoapps/third_party_auth/api/tests/test_permissions.py
+++ b/common/djangoapps/third_party_auth/api/tests/test_permissions.py
@@ -34,7 +34,7 @@ def _create_user(self, is_superuser=False, is_staff=False):
def _create_request(self, auth_header=None):
url = '/'
- extra = dict(HTTP_AUTHORIZATION=auth_header) if auth_header else {}
+ extra = {"HTTP_AUTHORIZATION": auth_header} if auth_header else {}
return RequestFactory().get(url, **extra)
def _create_session(self, request, user):
@@ -65,16 +65,9 @@ def test_session_with_user_permission(self, is_superuser, is_staff, expected_sta
@ddt.data(
# unrestricted (for example, jwt cookies)
- dict(
- is_restricted=False,
- expected_response=403,
- ),
-
+ {"is_restricted": False, "expected_response": 403},
# restricted (note: further test cases for scopes and filters are in tests below)
- dict(
- is_restricted=True,
- expected_response=403,
- ),
+ {"is_restricted": True, "expected_response": 403},
)
@ddt.unpack
def test_jwt_without_scopes_and_filters(
@@ -94,12 +87,12 @@ def test_jwt_without_scopes_and_filters(
@ddt.data(
# valid scopes
- dict(scopes=['tpa:read'], expected_response=200),
- dict(scopes=['tpa:read', 'another_scope'], expected_response=200),
+ {"scopes": ['tpa:read'], "expected_response": 200},
+ {"scopes": ['tpa:read', 'another_scope'], "expected_response": 200},
# invalid scopes
- dict(scopes=[], expected_response=403),
- dict(scopes=['another_scope'], expected_response=403),
+ {"scopes": [], "expected_response": 403},
+ {"scopes": ['another_scope'], "expected_response": 403},
)
@ddt.unpack
def test_jwt_scopes(self, scopes, expected_response):
@@ -111,20 +104,13 @@ def test_jwt_scopes(self, scopes, expected_response):
@ddt.data(
# valid provider filters
- dict(
- filters=['tpa_provider:some_tpa_provider', 'tpa_provider:another_tpa_provider'],
- expected_response=200,
- ),
-
+ {
+ "filters": ["tpa_provider:some_tpa_provider", "tpa_provider:another_tpa_provider"],
+ "expected_response": 200,
+ },
# invalid provider filters
- dict(
- filters=['tpa_provider:another_tpa_provider'],
- expected_response=403,
- ),
- dict(
- filters=[],
- expected_response=403,
- ),
+ {"filters": ["tpa_provider:another_tpa_provider"], "expected_response": 403},
+ {"filters": [], "expected_response": 403},
)
@ddt.unpack
def test_jwt_org_filters(self, filters, expected_response):
diff --git a/common/djangoapps/third_party_auth/api/tests/test_views.py b/common/djangoapps/third_party_auth/api/tests/test_views.py
index aea4c18367e6..948314a0672f 100644
--- a/common/djangoapps/third_party_auth/api/tests/test_views.py
+++ b/common/djangoapps/third_party_auth/api/tests/test_views.py
@@ -60,7 +60,7 @@ def setUp(self): # pylint: disable=arguments-differ
# Create several users and link each user to Google and TestShib
for username in LINKED_USERS:
- make_superuser = (username == ADMIN_USERNAME)
+ make_superuser = username == ADMIN_USERNAME
make_staff = (username == STAFF_USERNAME) or make_superuser
user = UserFactory.create(
username=username,
diff --git a/common/djangoapps/third_party_auth/lti.py b/common/djangoapps/third_party_auth/lti.py
index 3895c888661c..496b7dcbbbab 100644
--- a/common/djangoapps/third_party_auth/lti.py
+++ b/common/djangoapps/third_party_auth/lti.py
@@ -177,7 +177,7 @@ def safe_int(value):
# As this must take constant time, do not use shortcutting operators such as 'and'.
# Instead, use constant time operators such as '&', which is the bitwise and.
- valid = (lti_consumer_valid)
+ valid = lti_consumer_valid
valid = valid & (submitted_signature == computed_signature)
valid = valid & (request.oauth_version == '1.0')
valid = valid & (request.oauth_signature_method == 'HMAC-SHA1')
diff --git a/common/djangoapps/third_party_auth/models.py b/common/djangoapps/third_party_auth/models.py
index 6d244d96eddd..1dbe8611f5bc 100644
--- a/common/djangoapps/third_party_auth/models.py
+++ b/common/djangoapps/third_party_auth/models.py
@@ -879,7 +879,7 @@ def get_config(self):
conf['x509certMulti'] = {'signing': public_keys}
conf['x509cert'] = ''
- conf['url'] = sso_url
+ conf['url'] = sso_url # pylint: disable=possibly-used-before-assignment
# Add SAMLConfiguration appropriate for this IdP
conf['saml_sp_configuration'] = (
diff --git a/common/djangoapps/third_party_auth/pipeline.py b/common/djangoapps/third_party_auth/pipeline.py
index ef1e6f887c36..ce9502800d57 100644
--- a/common/djangoapps/third_party_auth/pipeline.py
+++ b/common/djangoapps/third_party_auth/pipeline.py
@@ -801,7 +801,7 @@ def associate_by_email_if_enterprise_user():
they should not be prompted for their edX password.
"""
try:
- enterprise_customer_user = is_enterprise_customer_user(current_provider.provider_id, current_user)
+ enterprise_customer_user = is_enterprise_customer_user(current_provider.provider_id, current_user) # pylint: disable=possibly-used-before-assignment
logger.info(
'[Multiple_SSO_SAML_Accounts_Association_to_User] Enterprise user verification:'
'User Email: {email}, User ID: {user_id}, Provider ID: {provider_id},'
diff --git a/common/djangoapps/track/views/segmentio.py b/common/djangoapps/track/views/segmentio.py
index 2ab5306232c5..8c022211ad1c 100644
--- a/common/djangoapps/track/views/segmentio.py
+++ b/common/djangoapps/track/views/segmentio.py
@@ -205,9 +205,9 @@ def track_segmentio_event(request): # pylint: disable=too-many-statements
raise EventValidationError(ERROR_USER_NOT_EXIST) # lint-amnesty, pylint: disable=raise-missing-from
except ValueError:
raise EventValidationError(ERROR_INVALID_USER_ID) # lint-amnesty, pylint: disable=raise-missing-from
- else:
- context['user_id'] = user.id
- context['username'] = user.username
+
+ context['user_id'] = user.id
+ context['username'] = user.username
# course_id is expected to be provided in the context when applicable
course_id = context.get('course_id')
diff --git a/lms/djangoapps/bulk_email/models.py b/lms/djangoapps/bulk_email/models.py
index d4f238fd9453..b1a7aa574408 100644
--- a/lms/djangoapps/bulk_email/models.py
+++ b/lms/djangoapps/bulk_email/models.py
@@ -114,7 +114,7 @@ def get_users(self, course_id, user_id=None):
"""
staff_qset = CourseStaffRole(course_id).users_with_role()
instructor_qset = CourseInstructorRole(course_id).users_with_role()
- staff_instructor_qset = (staff_qset | instructor_qset)
+ staff_instructor_qset = staff_qset | instructor_qset
enrollment_query = models.Q(
is_active=True,
courseenrollment__course_id=course_id,
diff --git a/lms/djangoapps/ccx/views.py b/lms/djangoapps/ccx/views.py
index 7c6a75aaf6d4..2fdf00d83336 100644
--- a/lms/djangoapps/ccx/views.py
+++ b/lms/djangoapps/ccx/views.py
@@ -417,7 +417,7 @@ def visit(node, depth=1):
'display_name': child.display_name,
'category': child.category,
'start': start,
- 'due': due,
+ 'due': due, # pylint: disable=possibly-used-before-assignment
'hidden': hidden,
}
else:
diff --git a/lms/djangoapps/certificates/api.py b/lms/djangoapps/certificates/api.py
index 895822f58824..164ea670d88f 100644
--- a/lms/djangoapps/certificates/api.py
+++ b/lms/djangoapps/certificates/api.py
@@ -549,11 +549,7 @@ def get_certificate_header_context(is_secure=True):
Return data to be used in Certificate Header,
data returned should be customized according to the site configuration.
"""
- data = dict(
- logo_src=branding_api.get_logo_url(is_secure),
- logo_url=branding_api.get_base_url(is_secure),
- )
-
+ data = {"logo_src": branding_api.get_logo_url(is_secure), "logo_url": branding_api.get_base_url(is_secure)}
return data
diff --git a/lms/djangoapps/certificates/tests/test_api.py b/lms/djangoapps/certificates/tests/test_api.py
index cb11b9e00bd1..02384d83a4e7 100644
--- a/lms/djangoapps/certificates/tests/test_api.py
+++ b/lms/djangoapps/certificates/tests/test_api.py
@@ -471,11 +471,11 @@ def test_get_web_certificate_url(self):
"""
Test the get_certificate_url with a web cert course
"""
- expected_url = reverse("certificates:render_cert_by_uuid", kwargs=dict(certificate_uuid=self.uuid))
+ expected_url = reverse("certificates:render_cert_by_uuid", kwargs={"certificate_uuid": self.uuid})
cert_url = get_certificate_url(user_id=self.student.id, course_id=self.web_cert_course.id, uuid=self.uuid)
assert expected_url == cert_url
- expected_url = reverse("certificates:render_cert_by_uuid", kwargs=dict(certificate_uuid=self.uuid))
+ expected_url = reverse("certificates:render_cert_by_uuid", kwargs={"certificate_uuid": self.uuid})
cert_url = get_certificate_url(user_id=self.student.id, course_id=self.web_cert_course.id, uuid=self.uuid)
assert expected_url == cert_url
diff --git a/lms/djangoapps/certificates/tests/test_webview_views.py b/lms/djangoapps/certificates/tests/test_webview_views.py
index 7949b84f13b1..ffe02b83f683 100644
--- a/lms/djangoapps/certificates/tests/test_webview_views.py
+++ b/lms/djangoapps/certificates/tests/test_webview_views.py
@@ -438,11 +438,11 @@ def test_social_sharing_availability_site(self, facebook_sharing, twitter_sharin
"""
self._add_course_certificates(count=1, signatory_count=1, is_active=True)
test_url = get_certificate_url(course_id=self.cert.course_id, uuid=self.cert.verify_uuid)
- social_sharing_settings = dict(
- CERTIFICATE_FACEBOOK=facebook_sharing,
- CERTIFICATE_TWITTER=twitter_sharing,
- CERTIFICATE_LINKEDIN=linkedin_sharing,
- )
+ social_sharing_settings = {
+ 'CERTIFICATE_FACEBOOK': facebook_sharing,
+ 'CERTIFICATE_TWITTER': twitter_sharing,
+ 'CERTIFICATE_LINKEDIN': linkedin_sharing,
+ }
with with_site_configuration_context(
configuration={
'platform_name': 'My Platform Site',
@@ -463,10 +463,10 @@ def test_facebook_default_text_site(self):
self._add_course_certificates(count=1, signatory_count=1, is_active=True)
test_url = get_certificate_url(course_id=self.cert.course_id, uuid=self.cert.verify_uuid)
facebook_text = "Facebook text on Test Site"
- social_sharing_settings = dict(
- CERTIFICATE_FACEBOOK=True,
- CERTIFICATE_FACEBOOK_TEXT=facebook_text,
- )
+ social_sharing_settings = {
+ 'CERTIFICATE_FACEBOOK': True,
+ 'CERTIFICATE_FACEBOOK_TEXT': facebook_text,
+ }
with with_site_configuration_context(
configuration={
'SOCIAL_SHARING_SETTINGS': social_sharing_settings,
@@ -483,10 +483,10 @@ def test_twitter_default_text_site(self):
self._add_course_certificates(count=1, signatory_count=1, is_active=True)
test_url = get_certificate_url(course_id=self.cert.course_id, uuid=self.cert.verify_uuid)
twitter_text = "Twitter text on Test Site"
- social_sharing_settings = dict(
- CERTIFICATE_TWITTER=True,
- CERTIFICATE_TWITTER_TEXT=twitter_text,
- )
+ social_sharing_settings = {
+ 'CERTIFICATE_TWITTER': True,
+ 'CERTIFICATE_TWITTER_TEXT': twitter_text,
+ }
with with_site_configuration_context(
configuration={
'SOCIAL_SHARING_SETTINGS': social_sharing_settings,
@@ -530,13 +530,13 @@ def test_rendering_course_organization_data(self):
"CERTIFICATE_FACEBOOK": True,
})
@with_site_configuration(
- configuration=dict(
- platform_name='My Platform Site',
- SITE_NAME='test_site.localhost',
- urls=dict(
- ABOUT='https://www.test-site.org/about-us',
- ),
- ),
+ configuration={
+ 'platform_name': 'My Platform Site',
+ 'SITE_NAME': 'test_site.localhost',
+ 'urls': {
+ 'ABOUT': 'https://www.test-site.org/about-us',
+ },
+ }
)
def test_rendering_maximum_data(self):
"""
@@ -780,7 +780,7 @@ def test_course_display_name_not_override_with_course_title(self):
'description': 'Description 0',
'signatories': [],
'version': 1,
- 'is_active':True
+ 'is_active': True
}
]
self.course.certificates = {'certificates': test_certificates}
diff --git a/lms/djangoapps/certificates/views/webview.py b/lms/djangoapps/certificates/views/webview.py
index 06e4e8a55337..03996f7a88b2 100644
--- a/lms/djangoapps/certificates/views/webview.py
+++ b/lms/djangoapps/certificates/views/webview.py
@@ -366,7 +366,7 @@ def _get_user_certificate(request, user, course_key, course_overview, preview_mo
user_certificate = GeneratedCertificate(
mode=preview_mode,
verify_uuid=str(uuid4().hex),
- modified_date=modified_date,
+ modified_date=modified_date, # pylint: disable=possibly-used-before-assignment
created_date=datetime.now().date(),
)
elif certificates_viewable_for_course(course_overview):
diff --git a/lms/djangoapps/commerce/management/commands/tests/test_configure_commerce.py b/lms/djangoapps/commerce/management/commands/tests/test_configure_commerce.py
index 4b4aac519217..d542085d3edf 100644
--- a/lms/djangoapps/commerce/management/commands/tests/test_configure_commerce.py
+++ b/lms/djangoapps/commerce/management/commands/tests/test_configure_commerce.py
@@ -55,5 +55,5 @@ def test_site_associated_commerce_configuration(self):
This is done to make sure that this command gets updated once site_id field is added to
CommerceConfiguration model.
"""
- assert not hasattr(CommerceConfiguration, 'site'),\
+ assert not hasattr(CommerceConfiguration, 'site'), \
'Update configure_commerce command to account for site specific configurations.'
diff --git a/lms/djangoapps/commerce/tests/test_utils.py b/lms/djangoapps/commerce/tests/test_utils.py
index d5d0cf1f1c23..bc07ff9424e7 100644
--- a/lms/djangoapps/commerce/tests/test_utils.py
+++ b/lms/djangoapps/commerce/tests/test_utils.py
@@ -201,7 +201,7 @@ def setUp(self):
@patch('lms.djangoapps.commerce.utils.is_commerce_service_configured', return_value=False)
def test_ecommerce_service_not_configured(self, mock_commerce_configured):
- course_entitlement = CourseEntitlementFactory.create(mode=CourseMode.VERIFIED)
+ course_entitlement = CourseEntitlementFactory.create(mode=CourseMode.VERIFIED) # pylint: disable=possibly-used-before-assignment
refund_success = refund_entitlement(course_entitlement)
assert mock_commerce_configured.is_called
assert not refund_success
diff --git a/lms/djangoapps/course_api/tests/test_api.py b/lms/djangoapps/course_api/tests/test_api.py
index 8e4d1253f8f7..de886af2aafe 100644
--- a/lms/djangoapps/course_api/tests/test_api.py
+++ b/lms/djangoapps/course_api/tests/test_api.py
@@ -216,12 +216,12 @@ def test_filter(self):
test_cases = [
(None, [alternate_course, self.course]),
- (dict(mobile_available=True), [alternate_course]),
- (dict(mobile_available=False), [self.course]),
+ ({"mobile_available": True}, [alternate_course]),
+ ({"mobile_available": False}, [self.course]),
]
for filter_, expected_courses in test_cases:
filtered_courses = self._make_api_call(self.staff_user, self.staff_user, filter_=filter_)
- assert {course.id for course in filtered_courses} == {course.id for course in expected_courses},\
+ assert {course.id for course in filtered_courses} == {course.id for course in expected_courses}, \
f'testing course_api.api.list_courses with filter_={filter_}'
def test_permissions(self):
diff --git a/lms/djangoapps/course_api/tests/test_views.py b/lms/djangoapps/course_api/tests/test_views.py
index aab9769661a2..683d32862619 100644
--- a/lms/djangoapps/course_api/tests/test_views.py
+++ b/lms/djangoapps/course_api/tests/test_views.py
@@ -210,8 +210,8 @@ def test_filter(self):
test_cases = [
(None, [alternate_course, self.course]),
- (dict(mobile=True), [alternate_course]),
- (dict(mobile=False), [self.course]),
+ ({"mobile": True}, [alternate_course]),
+ ({"mobile": False}, [self.course]),
]
for filter_, expected_courses in test_cases:
params = {'username': self.staff_user.username}
diff --git a/lms/djangoapps/course_blocks/transformers/tests/test_user_partitions.py b/lms/djangoapps/course_blocks/transformers/tests/test_user_partitions.py
index 410de94dc845..03943e79318d 100644
--- a/lms/djangoapps/course_blocks/transformers/tests/test_user_partitions.py
+++ b/lms/djangoapps/course_blocks/transformers/tests/test_user_partitions.py
@@ -324,19 +324,19 @@ def get_course_hierarchy(self):
'#type': 'vertical',
'#ref': 'B',
'#parents': ['A'],
- 'metadata': {'group_access': {1: [1], 2:[3], 3:[]}},
+ 'metadata': {'group_access': {1: [1], 2: [3], 3: []}},
},
{
'#type': 'vertical',
'#ref': 'C',
'#parents': ['A'],
- 'metadata': {'group_access': {1: [2], 2:[2], 3:[]}},
+ 'metadata': {'group_access': {1: [2], 2: [2], 3: []}},
},
{
'#type': 'vertical',
'#ref': 'D',
'#parents': ['A'],
- 'metadata': {'group_access': {1: [3], 2:[1], 3:[]}},
+ 'metadata': {'group_access': {1: [3], 2: [1], 3: []}},
},
{
'#type': 'vertical',
diff --git a/lms/djangoapps/course_blocks/transformers/tests/test_visibility.py b/lms/djangoapps/course_blocks/transformers/tests/test_visibility.py
index 8ceb821a642a..6b1f311ba44c 100644
--- a/lms/djangoapps/course_blocks/transformers/tests/test_visibility.py
+++ b/lms/djangoapps/course_blocks/transformers/tests/test_visibility.py
@@ -36,7 +36,7 @@ def test_block_visibility(
):
for idx, _ in enumerate(self.parents_map):
block = self.get_block(idx)
- block.visible_to_staff_only = (idx in staff_only_blocks)
+ block.visible_to_staff_only = idx in staff_only_blocks
update_block(block)
self.assert_transform_results(
diff --git a/lms/djangoapps/course_goals/management/commands/goal_reminder_email.py b/lms/djangoapps/course_goals/management/commands/goal_reminder_email.py
index eea03bd79455..cee7545104e4 100644
--- a/lms/djangoapps/course_goals/management/commands/goal_reminder_email.py
+++ b/lms/djangoapps/course_goals/management/commands/goal_reminder_email.py
@@ -215,8 +215,8 @@ def _handle_all_goals(self):
'goal_count': total_goals,
}
)
- log.info(f'Processing course goals, total goal count {total_goals},'
- + f'timestamp: {datetime.now()}, uuid: {session_id}')
+ log.info('Processing course goals, total goal count %d, timestamp: %s, uuid: %s',
+ total_goals, datetime.now(), session_id)
for goal in course_goals:
# emulate a request for waffle's benefit
with emulate_http_request(site=Site.objects.get_current(), user=goal.user):
@@ -225,8 +225,8 @@ def _handle_all_goals(self):
else:
filtered_count += 1
if (sent_count + filtered_count) % 10000 == 0:
- log.info(f'Processing course goals: sent {sent_count} filtered {filtered_count} out of {total_goals},'
- + f'timestamp: {datetime.now()}, uuid: {session_id}')
+ log.info('Processing course goals: sent %d filtered %d out of %d, timestamp: %s, uuid: %s',
+ sent_count, filtered_count, total_goals, datetime.now(), session_id)
tracker.emit(
'edx.course.goal.email.session_completed',
@@ -238,8 +238,8 @@ def _handle_all_goals(self):
'emails_filtered': filtered_count,
}
)
- log.info(f'Processing course goals complete: sent {sent_count} emails, filtered out {filtered_count} emails'
- + f'timestamp: {datetime.now()}, uuid: {session_id}')
+ log.info('Processing course goals complete: sent %d emails, filtered out %d emails, timestamp: %s, uuid: %s',
+ sent_count, filtered_count, datetime.now(), session_id)
@staticmethod
def handle_goal(goal, today, sunday_date, monday_date, session_id):
diff --git a/lms/djangoapps/courseware/rules.py b/lms/djangoapps/courseware/rules.py
index 07cbbab9022c..25bf3c752f12 100644
--- a/lms/djangoapps/courseware/rules.py
+++ b/lms/djangoapps/courseware/rules.py
@@ -118,7 +118,7 @@ def _check_with_query(self, user, instance=None):
elif isinstance(instance, str):
course_key = CourseKey.from_string(instance)
- return self.filter(user, CourseOverview.objects.filter(id=course_key)).exists()
+ return self.filter(user, CourseOverview.objects.filter(id=course_key)).exists() # pylint: disable=possibly-used-before-assignment
def query(self, user):
"""
diff --git a/lms/djangoapps/courseware/tests/test_access.py b/lms/djangoapps/courseware/tests/test_access.py
index e0c5f59a83fb..5fa6ab323d90 100644
--- a/lms/djangoapps/courseware/tests/test_access.py
+++ b/lms/djangoapps/courseware/tests/test_access.py
@@ -960,5 +960,5 @@ def test_course_catalog_access_num_queries_enterprise(self, user_attr_name, cour
num_queries = 0
course_overview = CourseOverview.get_from_id(course.id)
- with self.assertNumQueries(num_queries, table_ignorelist=QUERY_COUNT_TABLE_IGNORELIST):
+ with self.assertNumQueries(num_queries, table_ignorelist=QUERY_COUNT_TABLE_IGNORELIST): # pylint: disable=possibly-used-before-assignment
bool(access.has_access(user, 'see_exists', course_overview, course_key=course.id))
diff --git a/lms/djangoapps/courseware/tests/test_block_render.py b/lms/djangoapps/courseware/tests/test_block_render.py
index 182f8d0c03ab..5c1a15ea3213 100644
--- a/lms/djangoapps/courseware/tests/test_block_render.py
+++ b/lms/djangoapps/courseware/tests/test_block_render.py
@@ -231,12 +231,12 @@ def setUp(self):
# Construct a 'standard' xqueue_callback url
self.callback_url = reverse(
'xqueue_callback',
- kwargs=dict(
- course_id=str(self.course_key),
- userid=str(self.mock_user.id),
- mod_id=self.mock_block.id,
- dispatch=self.dispatch
- )
+ kwargs={
+ 'course_id': str(self.course_key),
+ 'userid': str(self.mock_user.id),
+ 'mod_id': self.mock_block.id,
+ 'dispatch': self.dispatch,
+ }
)
def tearDown(self):
@@ -2533,7 +2533,7 @@ def _has_access(self, user, action, obj, course_key=None):
key = obj.scope_ids.usage_id
elif isinstance(obj, UsageKey):
key = obj
- if key == self.parent.scope_ids.usage_id: # lint-amnesty, pylint: disable=no-member
+ if key == self.parent.scope_ids.usage_id: # lint-amnesty, pylint: disable=no-member, possibly-used-before-assignment
return AccessResponse(True)
return AccessResponse(key == self.children_for_user[user])
diff --git a/lms/djangoapps/courseware/tests/test_courses.py b/lms/djangoapps/courseware/tests/test_courses.py
index 804f9037791f..cbe642086ecf 100644
--- a/lms/djangoapps/courseware/tests/test_courses.py
+++ b/lms/djangoapps/courseware/tests/test_courses.py
@@ -155,8 +155,8 @@ def test_get_courses_with_filter(self):
test_cases = (
(None, {non_mobile_course.id, mobile_course.id}),
- (dict(mobile_available=True), {mobile_course.id}),
- (dict(mobile_available=False), {non_mobile_course.id}),
+ ({"mobile_available": True}, {mobile_course.id}),
+ ({"mobile_available": False}, {non_mobile_course.id}),
)
for filter_, expected_courses in test_cases:
assert {course.id for course in get_courses(user, filter_=filter_)} ==\
diff --git a/lms/djangoapps/courseware/tests/test_date_summary.py b/lms/djangoapps/courseware/tests/test_date_summary.py
index 27e7f1a3c226..d9fa21096cb4 100644
--- a/lms/djangoapps/courseware/tests/test_date_summary.py
+++ b/lms/djangoapps/courseware/tests/test_date_summary.py
@@ -586,7 +586,7 @@ def test_verification_deadline_date_denied(self):
block = VerificationDeadlineDate(course, user)
assert block.css_class == 'verification-deadline-passed'
assert block.title == 'Missed Verification Deadline'
- assert block.date == (datetime.now(utc) + timedelta(days=(- 1)))
+ assert block.date == (datetime.now(utc) + timedelta(days=- 1))
assert block.description == "Unfortunately you missed this course's deadline for a successful verification."
assert block.link_text == 'Learn More'
assert block.link == ''
diff --git a/lms/djangoapps/courseware/tests/test_video_mongo.py b/lms/djangoapps/courseware/tests/test_video_mongo.py
index d45bb94816b9..2074f8f221b5 100644
--- a/lms/djangoapps/courseware/tests/test_video_mongo.py
+++ b/lms/djangoapps/courseware/tests/test_video_mongo.py
@@ -857,23 +857,19 @@ def encode_and_create_video(self, edx_video_id):
encoded_videos = []
for profile, extension in [("desktop_webm", "webm"), ("desktop_mp4", "mp4")]:
create_profile(profile)
- encoded_videos.append(
- dict(
- url=f"http://fake-video.edx.org/{edx_video_id}.{extension}",
- file_size=9000,
- bitrate=42,
- profile=profile,
- )
- )
- result = create_video(
- dict(
- client_video_id='A Client Video id',
- duration=111.0,
- edx_video_id=edx_video_id,
- status='test',
- encoded_videos=encoded_videos,
- )
- )
+ encoded_videos.append({
+ 'url': f"http://fake-video.edx.org/{edx_video_id}.{extension}",
+ 'file_size': 9000,
+ 'bitrate': 42,
+ 'profile': profile,
+ })
+ result = create_video({
+ 'client_video_id': 'A Client Video id',
+ 'duration': 111.0,
+ 'edx_video_id': edx_video_id,
+ 'status': 'test',
+ 'encoded_videos': encoded_videos,
+ })
assert result == edx_video_id
return encoded_videos
@@ -1784,12 +1780,12 @@ def setUp(self):
self.addCleanup(shutil.rmtree, self.temp_dir)
def get_video_transcript_data(self, video_id, language_code='en', file_format='srt', provider='Custom'):
- return dict(
- video_id=video_id,
- language_code=language_code,
- provider=provider,
- file_format=file_format,
- )
+ return {
+ 'video_id': video_id,
+ 'language_code': language_code,
+ 'provider': provider,
+ 'file_format': file_format,
+ }
def test_get_context(self):
""""
diff --git a/lms/djangoapps/courseware/tests/test_views.py b/lms/djangoapps/courseware/tests/test_views.py
index cdc59e48c0e6..8ddd476c85bb 100644
--- a/lms/djangoapps/courseware/tests/test_views.py
+++ b/lms/djangoapps/courseware/tests/test_views.py
@@ -302,7 +302,7 @@ def test_jump_to_legacy_for_learner_with_staff_only_content(self, store_type, is
sequence = BlockFactory.create(category='sequential', parent_location=chapter.location)
__ = BlockFactory.create(category='vertical', parent_location=sequence.location)
staff_only_vertical = BlockFactory.create(category='vertical', parent_location=sequence.location,
- metadata=dict(visible_to_staff_only=True))
+ metadata={"visible_to_staff_only": True})
__ = BlockFactory.create(category='vertical', parent_location=sequence.location)
usage_key = UsageKey.from_string(str(staff_only_vertical.location)).replace(course_key=course_key)
@@ -1884,9 +1884,7 @@ def setup_course(self, show_correctness='', due_date=None, graded=False, **cours
}
self.create_course(**course_options)
- metadata = dict(
- show_correctness=show_correctness,
- )
+ metadata = {"show_correctness": show_correctness}
if due_date is not None:
metadata['due'] = due_date
if graded:
@@ -3198,9 +3196,9 @@ def test_consent_required(self, mock_enterprise_customer_for_request):
course_id = str(self.course.id)
for url in (
- reverse("courseware", kwargs=dict(course_id=course_id)),
- reverse("progress", kwargs=dict(course_id=course_id)),
- reverse("student_progress", kwargs=dict(course_id=course_id, student_id=str(self.user.id))),
+ reverse("courseware", kwargs={'course_id': course_id}),
+ reverse("progress", kwargs={'course_id': course_id}),
+ reverse("student_progress", kwargs={'course_id': course_id, 'student_id': str(self.user.id)}),
):
self.verify_consent_required(self.client, url) # lint-amnesty, pylint: disable=no-value-for-parameter
diff --git a/lms/djangoapps/discussion/django_comment_client/base/views.py b/lms/djangoapps/discussion/django_comment_client/base/views.py
index 3df362bdf6d2..5d13cd389b58 100644
--- a/lms/djangoapps/discussion/django_comment_client/base/views.py
+++ b/lms/djangoapps/discussion/django_comment_client/base/views.py
@@ -157,7 +157,7 @@ def track_created_event(request, event_name, course, obj, data):
def add_truncated_title_to_event_data(event_data, full_title):
- event_data['title_truncated'] = (len(full_title) > TRACKING_MAX_FORUM_TITLE)
+ event_data['title_truncated'] = len(full_title) > TRACKING_MAX_FORUM_TITLE
event_data['title'] = full_title[:TRACKING_MAX_FORUM_TITLE]
diff --git a/lms/djangoapps/discussion/rest_api/api.py b/lms/djangoapps/discussion/rest_api/api.py
index a517e00dff34..417add3c2672 100644
--- a/lms/djangoapps/discussion/rest_api/api.py
+++ b/lms/djangoapps/discussion/rest_api/api.py
@@ -866,7 +866,7 @@ def _serialize_discussion_entities(request, context, discussion_entities, reques
serialized_entity = ThreadSerializer(entity, context=context).data
elif discussion_entity_type == DiscussionEntity.comment:
serialized_entity = CommentSerializer(entity, context=context).data
- results.append(serialized_entity)
+ results.append(serialized_entity) # pylint: disable=possibly-used-before-assignment
if include_profile_image:
if serialized_entity['author'] and serialized_entity['author'] not in usernames:
@@ -1010,7 +1010,7 @@ def get_thread_list(
if view in ["unread", "unanswered", "unresponded"]:
query_params[view] = "true"
else:
- ValidationError({
+ raise ValidationError({
"view": [f"Invalid value. '{view}' must be 'unread' or 'unanswered'"]
})
diff --git a/lms/djangoapps/discussion/rest_api/tests/test_api.py b/lms/djangoapps/discussion/rest_api/tests/test_api.py
index 62725cc47466..828e5a64731b 100644
--- a/lms/djangoapps/discussion/rest_api/tests/test_api.py
+++ b/lms/djangoapps/discussion/rest_api/tests/test_api.py
@@ -4245,7 +4245,7 @@ def setUp(self) -> None:
parent_location=self.sequential.location,
category='vertical',
display_name='staff-vertical-1',
- metadata=dict(visible_to_staff_only=True),
+ metadata={"visible_to_staff_only": True},
)
self.course_key = course_key = self.course.id
self.config = DiscussionsConfiguration.objects.create(context_key=course_key, provider_type=Provider.OPEN_EDX)
@@ -4286,13 +4286,15 @@ def setUp(self) -> None:
# Set up topic stats for all topics, but have one deleted topic
# and one active topic return zero stats for testing.
self.topic_stats = {
- **{topic_id: dict(discussion=random.randint(0, 10), question=random.randint(0, 10))
- for topic_id in self.all_topic_ids},
- deleted_topic_ids[0]: dict(discussion=0, question=0),
- self.topic_ids[0]: dict(discussion=0, question=0),
+ **{
+ topic_id: {"discussion": random.randint(0, 10), "question": random.randint(0, 10)}
+ for topic_id in self.all_topic_ids
+ },
+ deleted_topic_ids[0]: {"discussion": 0, "question": 0},
+ self.topic_ids[0]: {"discussion": 0, "question": 0},
}
patcher = mock.patch(
- 'lms.djangoapps.discussion.rest_api.api.get_course_commentable_counts',
+ "lms.djangoapps.discussion.rest_api.api.get_course_commentable_counts",
mock.Mock(return_value=self.topic_stats),
)
patcher.start()
diff --git a/lms/djangoapps/discussion/rest_api/tests/test_views.py b/lms/djangoapps/discussion/rest_api/tests/test_views.py
index 9ae03986bb93..037814b37ab5 100644
--- a/lms/djangoapps/discussion/rest_api/tests/test_views.py
+++ b/lms/djangoapps/discussion/rest_api/tests/test_views.py
@@ -1014,9 +1014,9 @@ def setUp(self) -> None:
topic_ids = list(topic_id_query.order_by('ordering'))
DiscussionTopicLink.objects.bulk_create(topic_links)
self.topic_stats = {
- **{topic_id: dict(discussion=random.randint(0, 10), question=random.randint(0, 10))
+ **{topic_id: {"discussion": random.randint(0, 10), "question": random.randint(0, 10)}
for topic_id in set(topic_ids)},
- topic_ids[0]: dict(discussion=0, question=0),
+ topic_ids[0]: {"discussion": 0, "question": 0},
}
patcher = mock.patch(
'lms.djangoapps.discussion.rest_api.api.get_course_commentable_counts',
diff --git a/lms/djangoapps/discussion/rest_api/views.py b/lms/djangoapps/discussion/rest_api/views.py
index 2b0bf8c41e5b..aafdc59876d2 100644
--- a/lms/djangoapps/discussion/rest_api/views.py
+++ b/lms/djangoapps/discussion/rest_api/views.py
@@ -1320,7 +1320,7 @@ class CourseDiscussionSettingsAPIView(DeveloperErrorViewMixin, APIView):
permission_classes = (permissions.IsAuthenticated, IsStaffOrAdmin)
def _get_request_kwargs(self, course_id):
- return dict(course_id=course_id)
+ return {"course_id": course_id}
def get(self, request, course_id):
"""
@@ -1443,7 +1443,7 @@ class CourseDiscussionRolesAPIView(DeveloperErrorViewMixin, APIView):
permission_classes = (permissions.IsAuthenticated, permissions.IsAdminUser)
def _get_request_kwargs(self, course_id, rolename):
- return dict(course_id=course_id, rolename=rolename)
+ return {"course_id": course_id, "rolename": rolename}
def get(self, request, course_id, rolename):
"""
diff --git a/lms/djangoapps/discussion/tasks.py b/lms/djangoapps/discussion/tasks.py
index 3fef4f5f7cef..d483388f54ae 100644
--- a/lms/djangoapps/discussion/tasks.py
+++ b/lms/djangoapps/discussion/tasks.py
@@ -120,8 +120,6 @@ def send_ace_message(context): # lint-amnesty, pylint: disable=missing-function
log.info('Sending forum comment notification with context %s', message_context)
ace.send(message, limit_to_channels=[ChannelType.PUSH])
_track_notification_sent(message, context)
- else:
- return
@shared_task(base=LoggedTask)
diff --git a/lms/djangoapps/discussion/tests/test_signals.py b/lms/djangoapps/discussion/tests/test_signals.py
index d61b706292cf..38731bfd6f43 100644
--- a/lms/djangoapps/discussion/tests/test_signals.py
+++ b/lms/djangoapps/discussion/tests/test_signals.py
@@ -85,7 +85,7 @@ class CoursePublishHandlerTestCase(ModuleStoreTestCase):
ENABLED_SIGNALS = ['course_published']
def test_discussion_id_map_updates_on_publish(self):
- course_key_args = dict(org='org', course='number', run='run')
+ course_key_args = {"org": 'org', "course": 'number', "run": 'run'}
course_key = self.store.make_course_key(**course_key_args)
# create course
diff --git a/lms/djangoapps/discussion/tests/test_views.py b/lms/djangoapps/discussion/tests/test_views.py
index facdb368f14f..8fb7dd78bf51 100644
--- a/lms/djangoapps/discussion/tests/test_views.py
+++ b/lms/djangoapps/discussion/tests/test_views.py
@@ -592,7 +592,7 @@ def call_single_thread():
"""
Call single_thread and assert that it returns what we expect.
"""
- with patch.dict("django.conf.settings.FEATURES", dict(ENABLE_ENTERPRISE_INTEGRATION=enterprise_enabled)):
+ with patch.dict("django.conf.settings.FEATURES", {"ENABLE_ENTERPRISE_INTEGRATION": enterprise_enabled}):
response = views.single_thread(
request,
str(course.id),
@@ -2134,9 +2134,9 @@ def test_consent_required(self, mock_enterprise_customer_for_request, mock_reque
for url in (
reverse('forum_form_discussion',
- kwargs=dict(course_id=course_id)),
+ kwargs={"course_id": course_id}),
reverse('single_thread',
- kwargs=dict(course_id=course_id, discussion_id=self.discussion_id, thread_id=thread_id)),
+ kwargs={"course_id": course_id, "discussion_id": self.discussion_id, "thread_id": thread_id}),
):
self.verify_consent_required(self.client, url) # pylint: disable=no-value-for-parameter
diff --git a/lms/djangoapps/edxnotes/helpers.py b/lms/djangoapps/edxnotes/helpers.py
index 17705f835e9d..be7f7bbb8d65 100644
--- a/lms/djangoapps/edxnotes/helpers.py
+++ b/lms/djangoapps/edxnotes/helpers.py
@@ -164,7 +164,7 @@ def preprocess_collection(user, course, collection):
store = modulestore()
filtered_collection = []
cache = {}
- include_path_info = ('course_structure' not in settings.NOTES_DISABLED_TABS)
+ include_path_info = 'course_structure' not in settings.NOTES_DISABLED_TABS
with store.bulk_operations(course.id):
for model in collection:
update = {
diff --git a/lms/djangoapps/edxnotes/views.py b/lms/djangoapps/edxnotes/views.py
index 3e23ebe9ab47..6c2d99224c6b 100644
--- a/lms/djangoapps/edxnotes/views.py
+++ b/lms/djangoapps/edxnotes/views.py
@@ -57,7 +57,7 @@ def edxnotes(request, course_id):
raise Http404
notes_info = get_notes(request, course)
- has_notes = (len(notes_info.get('results')) > 0)
+ has_notes = len(notes_info.get('results')) > 0
context = {
"course": course,
"notes_endpoint": reverse("notes", kwargs={"course_id": course_id}),
diff --git a/lms/djangoapps/experiments/flags.py b/lms/djangoapps/experiments/flags.py
index b83a7751fae7..3b45bcee5b5c 100644
--- a/lms/djangoapps/experiments/flags.py
+++ b/lms/djangoapps/experiments/flags.py
@@ -245,7 +245,7 @@ def get_bucket(self, course_key=None, track=True):
if (
track and hasattr(request, 'session') and
session_key not in request.session and
- not masquerading_as_specific_student and not anonymous
+ not masquerading_as_specific_student and not anonymous # pylint: disable=used-before-assignment
):
segment.track(
user_id=user.id,
diff --git a/lms/djangoapps/grades/management/commands/compute_grades.py b/lms/djangoapps/grades/management/commands/compute_grades.py
index a1ead12d7fd3..245a593ba281 100644
--- a/lms/djangoapps/grades/management/commands/compute_grades.py
+++ b/lms/djangoapps/grades/management/commands/compute_grades.py
@@ -139,7 +139,7 @@ def _set_log_level(self, options):
log_level = logging.WARNING
elif options.get('verbosity') >= 1:
log_level = logging.INFO
- log.setLevel(log_level)
+ log.setLevel(log_level) # pylint: disable=possibly-used-before-assignment
def _latest_settings(self):
"""
diff --git a/lms/djangoapps/grades/rest_api/v1/gradebook_views.py b/lms/djangoapps/grades/rest_api/v1/gradebook_views.py
index 26df7ce2583d..86fe689d65f2 100644
--- a/lms/djangoapps/grades/rest_api/v1/gradebook_views.py
+++ b/lms/djangoapps/grades/rest_api/v1/gradebook_views.py
@@ -504,7 +504,7 @@ def _gradebook_entry(self, user, course, graded_subsections, course_grade):
user_entry['section_breakdown'] = breakdown
user_entry['progress_page_url'] = reverse(
'student_progress',
- kwargs=dict(course_id=str(course.id), student_id=user.id)
+ kwargs={"course_id": str(course.id), "student_id": user.id}
)
user_entry['user_id'] = user.id
@@ -642,10 +642,7 @@ def get(self, request, course_key): # lint-amnesty, pylint: disable=too-many-st
q_objects.append(q_object)
if request.GET.get('excluded_course_roles'):
excluded_course_roles = request.GET.getlist('excluded_course_roles')
- course_access_role_filters = dict(
- user=OuterRef('user'),
- course_id=course_key,
- )
+ course_access_role_filters = {"user": OuterRef('user'), "course_id": course_key}
if 'all' not in excluded_course_roles:
course_access_role_filters['role__in'] = excluded_course_roles
annotations['has_excluded_role'] = Exists(
@@ -919,19 +916,19 @@ def _create_override(self, request_user, subsection_grade_model, **override_data
create_new_event_transaction_id()
recalculate_subsection_grade_v3.apply(
- kwargs=dict(
- user_id=subsection_grade_model.user_id,
- anonymous_user_id=None,
- course_id=str(subsection_grade_model.course_id),
- usage_id=str(subsection_grade_model.usage_key),
- only_if_higher=False,
- expected_modified_time=to_timestamp(override.modified),
- score_deleted=False,
- event_transaction_id=str(get_event_transaction_id()),
- event_transaction_type=str(get_event_transaction_type()),
- score_db_table=grades_constants.ScoreDatabaseTableEnum.overrides,
- force_update_subsections=True,
- )
+ kwargs={
+ "user_id": subsection_grade_model.user_id,
+ "anonymous_user_id": None,
+ "course_id": str(subsection_grade_model.course_id),
+ "usage_id": str(subsection_grade_model.usage_key),
+ "only_if_higher": False,
+ "expected_modified_time": to_timestamp(override.modified),
+ "score_deleted": False,
+ "event_transaction_id": str(get_event_transaction_id()),
+ "event_transaction_type": str(get_event_transaction_type()),
+ "score_db_table": grades_constants.ScoreDatabaseTableEnum.overrides,
+ "force_update_subsections": True,
+ }
)
# Emit events to let our tracking system to know we updated subsection grade
grades_events.subsection_grade_calculated(subsection_grade_model)
diff --git a/lms/djangoapps/grades/signals/handlers.py b/lms/djangoapps/grades/signals/handlers.py
index 58c5fb90aace..1548ed528eea 100644
--- a/lms/djangoapps/grades/signals/handlers.py
+++ b/lms/djangoapps/grades/signals/handlers.py
@@ -234,19 +234,19 @@ def enqueue_subsection_update(sender, **kwargs): # pylint: disable=unused-argum
if not context_key.is_course:
return # If it's not a course, it has no subsections, so skip the subsection grading update
recalculate_subsection_grade_v3.apply_async(
- kwargs=dict(
- user_id=kwargs['user_id'],
- anonymous_user_id=kwargs.get('anonymous_user_id'),
- course_id=kwargs['course_id'],
- usage_id=kwargs['usage_id'],
- only_if_higher=kwargs.get('only_if_higher'),
- expected_modified_time=to_timestamp(kwargs['modified']),
- score_deleted=kwargs.get('score_deleted', False),
- event_transaction_id=str(get_event_transaction_id()),
- event_transaction_type=str(get_event_transaction_type()),
- score_db_table=kwargs['score_db_table'],
- force_update_subsections=kwargs.get('force_update_subsections', False),
- ),
+ kwargs={
+ "user_id": kwargs["user_id"],
+ "anonymous_user_id": kwargs.get("anonymous_user_id"),
+ "course_id": kwargs["course_id"],
+ "usage_id": kwargs["usage_id"],
+ "only_if_higher": kwargs.get("only_if_higher"),
+ "expected_modified_time": to_timestamp(kwargs["modified"]),
+ "score_deleted": kwargs.get("score_deleted", False),
+ "event_transaction_id": str(get_event_transaction_id()),
+ "event_transaction_type": str(get_event_transaction_type()),
+ "score_db_table": kwargs["score_db_table"],
+ "force_update_subsections": kwargs.get("force_update_subsections", False),
+ },
countdown=RECALCULATE_GRADE_DELAY_SECONDS,
)
@@ -269,10 +269,7 @@ def recalculate_course_and_subsection_grades(sender, user, course_key, countdown
"""
recalculate_course_and_subsection_grades_for_user.apply_async(
countdown=countdown,
- kwargs=dict(
- user_id=user.id,
- course_key=str(course_key)
- )
+ kwargs={"user_id": user.id, "course_key": str(course_key)}
)
diff --git a/lms/djangoapps/grades/subsection_grade.py b/lms/djangoapps/grades/subsection_grade.py
index ba098a92a417..9442d837a036 100644
--- a/lms/djangoapps/grades/subsection_grade.py
+++ b/lms/djangoapps/grades/subsection_grade.py
@@ -361,18 +361,18 @@ def _persisted_model_params(self, student):
Returns the parameters for creating/updating the
persisted model for this subsection grade.
"""
- return dict(
- user_id=student.id,
- usage_key=self.location,
- course_version=self.course_version,
- subtree_edited_timestamp=self.subtree_edited_timestamp,
- earned_all=self.all_total.earned,
- possible_all=self.all_total.possible,
- earned_graded=self.graded_total.earned,
- possible_graded=self.graded_total.possible,
- visible_blocks=self._get_visible_blocks,
- first_attempted=self.all_total.first_attempted,
- )
+ return {
+ "user_id": student.id,
+ "usage_key": self.location,
+ "course_version": self.course_version,
+ "subtree_edited_timestamp": self.subtree_edited_timestamp,
+ "earned_all": self.all_total.earned,
+ "possible_all": self.all_total.possible,
+ "earned_graded": self.graded_total.earned,
+ "possible_graded": self.graded_total.possible,
+ "visible_blocks": self._get_visible_blocks,
+ "first_attempted": self.all_total.first_attempted,
+ }
@property
def _get_visible_blocks(self):
diff --git a/lms/djangoapps/grades/tests/test_course_data.py b/lms/djangoapps/grades/tests/test_course_data.py
index d71858312171..60f69201efee 100644
--- a/lms/djangoapps/grades/tests/test_course_data.py
+++ b/lms/djangoapps/grades/tests/test_course_data.py
@@ -67,10 +67,10 @@ def test_properties(self):
)
for kwargs in [
- dict(course=self.course),
- dict(collected_block_structure=self.one_true_structure),
- dict(structure=self.one_true_structure),
- dict(course_key=self.course.id),
+ {"course": self.course},
+ {"collected_block_structure": self.one_true_structure},
+ {"structure": self.one_true_structure},
+ {"course_key": self.course.id},
]:
course_data = CourseData(self.user, **kwargs)
assert course_data.course_key == self.course.id
diff --git a/lms/djangoapps/grades/tests/test_transformer.py b/lms/djangoapps/grades/tests/test_transformer.py
index 7ef13e5b5b7c..486bdf11a51b 100644
--- a/lms/djangoapps/grades/tests/test_transformer.py
+++ b/lms/djangoapps/grades/tests/test_transformer.py
@@ -75,7 +75,7 @@ def assert_collected_xblock_fields(self, block_structure, usage_key, **expectati
for field in expectations:
# Append our custom message to the default assertEqual error message
self.longMessage = True # pylint: disable=invalid-name
- assert expectations[field] == block_structure.get_xblock_field(usage_key, field),\
+ assert expectations[field] == block_structure.get_xblock_field(usage_key, field), \
f'in field {repr(field)},'
assert block_structure.get_xblock_field(usage_key, 'subtree_edited_on') is not None
diff --git a/lms/djangoapps/grades/tests/utils.py b/lms/djangoapps/grades/tests/utils.py
index 9111820379b4..31520cc58b0f 100644
--- a/lms/djangoapps/grades/tests/utils.py
+++ b/lms/djangoapps/grades/tests/utils.py
@@ -19,13 +19,13 @@ def mock_passing_grade(letter_grade='Pass', percent=0.75, last_updated=None):
"""
Mock the grading function to always return a passing grade.
"""
- passing_grade_fields = dict(
- letter_grade=letter_grade,
- percent=percent,
- passed=letter_grade is not None,
- attempted=True,
- last_updated=last_updated,
- )
+ passing_grade_fields = {
+ "letter_grade": letter_grade,
+ "percent": percent,
+ "passed": letter_grade is not None,
+ "attempted": True,
+ "last_updated": last_updated,
+ }
with patch('lms.djangoapps.grades.course_grade_factory.CourseGradeFactory.read') as mock_grade_read:
mock_grade_read.return_value = MagicMock(**passing_grade_fields)
with patch('lms.djangoapps.grades.course_grade.CourseGrade.update') as mock_grade_update:
diff --git a/lms/djangoapps/instructor/tests/test_certificates.py b/lms/djangoapps/instructor/tests/test_certificates.py
index 3b6a9a223586..980e48f5a1dd 100644
--- a/lms/djangoapps/instructor/tests/test_certificates.py
+++ b/lms/djangoapps/instructor/tests/test_certificates.py
@@ -406,21 +406,21 @@ def setUp(self):
course_id=self.course.id,
)
- self.certificate_exception = dict(
- created="",
- notes="Test Notes for Test Certificate Exception",
- user_email='',
- user_id='',
- user_name=str(self.user.username)
- )
-
- self.certificate_exception_in_db = dict(
- id=certificate_allowlist_item.id,
- user_name=certificate_allowlist_item.user.username,
- notes=certificate_allowlist_item.notes,
- user_email=certificate_allowlist_item.user.email,
- user_id=certificate_allowlist_item.user.id,
- )
+ self.certificate_exception = {
+ "created": "",
+ "notes": "Test Notes for Test Certificate Exception",
+ "user_email": '',
+ "user_id": '',
+ "user_name": str(self.user.username)
+ }
+
+ self.certificate_exception_in_db = {
+ "id": certificate_allowlist_item.id,
+ "user_name": certificate_allowlist_item.user.username,
+ "notes": certificate_allowlist_item.notes,
+ "user_email": certificate_allowlist_item.user.email,
+ "user_id": certificate_allowlist_item.user.id,
+ }
# Enable certificate generation
cache.clear()
@@ -733,13 +733,13 @@ def setUp(self):
course_id=self.course.id,
)
- self.certificate_exception = dict(
- id=certificate_exception.id,
- user_name=certificate_exception.user.username,
- notes=certificate_exception.notes,
- user_email=certificate_exception.user.email,
- user_id=certificate_exception.user.id,
- )
+ self.certificate_exception = {
+ "id": certificate_exception.id,
+ "user_name": certificate_exception.user.username,
+ "notes": certificate_exception.notes,
+ "user_email": certificate_exception.user.email,
+ "user_id": certificate_exception.user.id,
+ }
# Enable certificate generation
cache.clear()
@@ -1052,10 +1052,10 @@ def setUp(self):
mode='honor',
)
- self.certificate_invalidation_data = dict(
- user=self.enrolled_user_1.username,
- notes=self.notes,
- )
+ self.certificate_invalidation_data = {
+ "user": self.enrolled_user_1.username,
+ "notes": self.notes,
+ }
# Global staff can see the certificates section
self.client.login(username=self.global_staff.username, password=self.TEST_PASSWORD)
diff --git a/lms/djangoapps/instructor/views/api.py b/lms/djangoapps/instructor/views/api.py
index 631500fe3246..51626675e724 100644
--- a/lms/djangoapps/instructor/views/api.py
+++ b/lms/djangoapps/instructor/views/api.py
@@ -475,7 +475,7 @@ def post(self, request, course_id): # pylint: disable=too-many-statements
})
course_mode = default_course_mode
- email_params = get_email_params(course, True, secure=request.is_secure())
+ email_params = get_email_params(course, True, secure=request.is_secure()) # pylint: disable=possibly-used-before-assignment
try:
validate_email(email) # Raises ValidationError if invalid
except ValidationError:
@@ -2643,8 +2643,13 @@ def _list_report_downloads(request, course_id):
response_payload = {
'downloads': [
- dict(name=name, url=url, link=HTML('
{}').format(HTML(url), Text(name)))
- for name, url in report_store.links_for(course_id) if report_name is None or name == report_name
+ {
+ 'name': name,
+ 'url': url,
+ 'link': HTML('
{}').format(HTML(url), Text(name))
+ }
+ for name, url in report_store.links_for(course_id)
+ if report_name is None or name == report_name
]
}
return JsonResponse(response_payload)
@@ -2664,7 +2669,11 @@ def list_financial_report_downloads(_request, course_id):
response_payload = {
'downloads': [
- dict(name=name, url=url, link=HTML('
{}').format(HTML(url), Text(name)))
+ {
+ 'name': name,
+ 'url': url,
+ 'link': HTML('
{}').format(HTML(url), Text(name))
+ }
for name, url in report_store.links_for(course_id)
]
}
@@ -3238,7 +3247,7 @@ def enable_certificate_generation(request, course_id=None):
"""
course_key = CourseKey.from_string(course_id)
- is_enabled = (request.POST.get('certificates-enabled', 'false') == 'true')
+ is_enabled = request.POST.get('certificates-enabled', 'false') == 'true'
certs_api.set_cert_generation_enabled(course_key, is_enabled)
return redirect(_instructor_dash_url(course_key, section='certificates'))
diff --git a/lms/djangoapps/instructor/views/gradebook_api.py b/lms/djangoapps/instructor/views/gradebook_api.py
index b4de0b73e627..9a3c81f977e7 100644
--- a/lms/djangoapps/instructor/views/gradebook_api.py
+++ b/lms/djangoapps/instructor/views/gradebook_api.py
@@ -44,7 +44,7 @@ def calculate_page_info(offset, total_students):
previous_offset = offset - MAX_STUDENTS_PER_PAGE_GRADE_BOOK
# calculate current page number.
- page_num = ((offset / MAX_STUDENTS_PER_PAGE_GRADE_BOOK) + 1)
+ page_num = (offset / MAX_STUDENTS_PER_PAGE_GRADE_BOOK) + 1
# calculate total number of pages.
total_pages = int(math.ceil(float(total_students) / MAX_STUDENTS_PER_PAGE_GRADE_BOOK)) or 1
diff --git a/lms/djangoapps/instructor_analytics/distributions.py b/lms/djangoapps/instructor_analytics/distributions.py
index 1a91771a2fa2..b1553a72f4cf 100644
--- a/lms/djangoapps/instructor_analytics/distributions.py
+++ b/lms/djangoapps/instructor_analytics/distributions.py
@@ -111,7 +111,7 @@ def profile_distribution(course_id, feature):
raw_choices = UserProfile.LEVEL_OF_EDUCATION_CHOICES
# short name and display name (full) of the choices.
- choices = list(raw_choices) + [('no_data', 'No Data')]
+ choices = list(raw_choices) + [('no_data', 'No Data')] # pylint: disable=possibly-used-before-assignment
def get_filter(feature, value):
""" Get the orm filter parameters for a feature. """
diff --git a/lms/djangoapps/instructor_task/api.py b/lms/djangoapps/instructor_task/api.py
index 62095c3ae3aa..1e61c8772eeb 100644
--- a/lms/djangoapps/instructor_task/api.py
+++ b/lms/djangoapps/instructor_task/api.py
@@ -388,7 +388,7 @@ def submit_calculate_students_features_csv(request, course_key, features, **task
"""
task_type = InstructorTaskTypes.PROFILE_INFO_CSV
task_class = calculate_students_features_csv
- task_input = dict(features=features, **task_kwargs)
+ task_input = {"features": features, **task_kwargs}
task_key = ""
return submit_task(request, task_type, task_class, course_key, task_input, task_key)
diff --git a/lms/djangoapps/instructor_task/tasks_helper/module_state.py b/lms/djangoapps/instructor_task/tasks_helper/module_state.py
index 53e22feb236e..0af890137191 100644
--- a/lms/djangoapps/instructor_task/tasks_helper/module_state.py
+++ b/lms/djangoapps/instructor_task/tasks_helper/module_state.py
@@ -174,21 +174,13 @@ def rescore_problem_module_state(xblock_instance_args, block, student_module, ta
TASK_LOG.exception(
"error processing rescore call for course %(course)s, problem %(loc)s "
"and student %(student)s",
- dict(
- course=course_id,
- loc=usage_key,
- student=student
- )
+ {"course": course_id, "loc": usage_key, "student": student}
)
except StudentInputError:
TASK_LOG.warning(
"error processing rescore call for course %(course)s, problem %(loc)s "
"and student %(student)s",
- dict(
- course=course_id,
- loc=usage_key,
- student=student
- )
+ {"course": course_id, "loc": usage_key, "student": student}
)
return UPDATE_STATUS_FAILED
@@ -196,11 +188,7 @@ def rescore_problem_module_state(xblock_instance_args, block, student_module, ta
TASK_LOG.debug(
"successfully processed rescore call for course %(course)s, problem %(loc)s "
"and student %(student)s",
- dict(
- course=course_id,
- loc=usage_key,
- student=student
- )
+ {"course": course_id, "loc": usage_key, "student": student}
)
return UPDATE_STATUS_SUCCEEDED
@@ -276,11 +264,7 @@ def override_score_module_state(xblock_instance_args, block, student_module, tas
TASK_LOG.debug(
"successfully processed score override for course %(course)s, problem %(loc)s "
"and student %(student)s",
- dict(
- course=course_id,
- loc=usage_key,
- student=student
- )
+ {"course": course_id, "loc": usage_key, "student": student}
)
return UPDATE_STATUS_SUCCEEDED
diff --git a/lms/djangoapps/instructor_task/tests/test_integration.py b/lms/djangoapps/instructor_task/tests/test_integration.py
index 004cba1cdacc..02fafeeb99b5 100644
--- a/lms/djangoapps/instructor_task/tests/test_integration.py
+++ b/lms/djangoapps/instructor_task/tests/test_integration.py
@@ -199,11 +199,12 @@ def verify_rescore_results(self, problem_edit, new_expected_scores, new_expected
RescoreTestData = namedtuple('RescoreTestData', 'edit, new_expected_scores, new_expected_max')
@ddt.data(
- RescoreTestData(edit=dict(correct_answer=OPTION_2), new_expected_scores=(0, 1, 1, 2), new_expected_max=2),
- RescoreTestData(edit=dict(num_inputs=2), new_expected_scores=(2, 1, 1, 0), new_expected_max=4),
- RescoreTestData(edit=dict(num_inputs=4), new_expected_scores=(2, 1, 1, 0), new_expected_max=8),
- RescoreTestData(edit=dict(num_responses=4), new_expected_scores=(2, 1, 1, 0), new_expected_max=4),
- RescoreTestData(edit=dict(num_inputs=2, num_responses=4), new_expected_scores=(2, 1, 1, 0), new_expected_max=8),
+ RescoreTestData(edit={'correct_answer': OPTION_2}, new_expected_scores=(0, 1, 1, 2), new_expected_max=2),
+ RescoreTestData(edit={'num_inputs': 2}, new_expected_scores=(2, 1, 1, 0), new_expected_max=4),
+ RescoreTestData(edit={'num_inputs': 4}, new_expected_scores=(2, 1, 1, 0), new_expected_max=8),
+ RescoreTestData(edit={'num_responses': 4}, new_expected_scores=(2, 1, 1, 0), new_expected_max=4),
+ RescoreTestData(edit={
+ 'num_inputs': 2, 'num_responses': 4}, new_expected_scores=(2, 1, 1, 0), new_expected_max=8),
)
@ddt.unpack
def test_rescoring_option_problem(self, problem_edit, new_expected_scores, new_expected_max):
@@ -221,7 +222,7 @@ def test_rescoring_option_problem(self, problem_edit, new_expected_scores, new_e
@ddt.data(
RescoreTestData(edit={}, new_expected_scores=(2, 1, 1, 0), new_expected_max=2),
- RescoreTestData(edit=dict(correct_answer=OPTION_2), new_expected_scores=(2, 1, 1, 2), new_expected_max=2),
+ RescoreTestData(edit={"correct_answer": OPTION_2}, new_expected_scores=(2, 1, 1, 2), new_expected_max=2),
)
@ddt.unpack
def test_rescoring_if_higher(self, problem_edit, new_expected_scores, new_expected_max):
@@ -234,7 +235,7 @@ def test_rescoring_if_higher_scores_equal(self):
Specifically tests rescore when the previous and new raw scores are equal. In this case, the scores should
be updated.
"""
- problem_edit = dict(num_inputs=2) # this change to the problem means the problem will now have a max score of 4
+ problem_edit = {"num_inputs": 2} # this change to the problem means the problem will now have a max score of 4
unchanged_max = 2
new_max = 4
problem_url_name = 'H1P1'
diff --git a/lms/djangoapps/mfe_config_api/tests/test_views.py b/lms/djangoapps/mfe_config_api/tests/test_views.py
index fef7574f5932..eb15c1698f0a 100644
--- a/lms/djangoapps/mfe_config_api/tests/test_views.py
+++ b/lms/djangoapps/mfe_config_api/tests/test_views.py
@@ -62,44 +62,40 @@ def test_get_mfe_config_with_queryparam(self, configuration_helpers_mock):
@ddt.unpack
@ddt.data(
- dict(
- mfe_config={},
- mfe_config_overrides={},
- expected_response={},
- ),
- dict(
- mfe_config={"EXAMPLE_VAR": "value"},
- mfe_config_overrides={},
- expected_response={"EXAMPLE_VAR": "value"},
- ),
- dict(
- mfe_config={},
- mfe_config_overrides={"mymfe": {"EXAMPLE_VAR": "mymfe_value"}},
- expected_response={"EXAMPLE_VAR": "mymfe_value"},
- ),
- dict(
- mfe_config={"EXAMPLE_VAR": "value"},
- mfe_config_overrides={"mymfe": {"EXAMPLE_VAR": "mymfe_value"}},
- expected_response={"EXAMPLE_VAR": "mymfe_value"},
- ),
- dict(
- mfe_config={"EXAMPLE_VAR": "value", "OTHER": "other"},
- mfe_config_overrides={"mymfe": {"EXAMPLE_VAR": "mymfe_value"}},
- expected_response={"EXAMPLE_VAR": "mymfe_value", "OTHER": "other"},
- ),
- dict(
- mfe_config={"EXAMPLE_VAR": "value"},
- mfe_config_overrides={"yourmfe": {"EXAMPLE_VAR": "yourmfe_value"}},
- expected_response={"EXAMPLE_VAR": "value"},
- ),
- dict(
- mfe_config={"EXAMPLE_VAR": "value"},
- mfe_config_overrides={
+ {"mfe_config": {}, "mfe_config_overrides": {}, "expected_response": {}},
+ {
+ "mfe_config": {"EXAMPLE_VAR": "value"},
+ "mfe_config_overrides": {},
+ "expected_response": {"EXAMPLE_VAR": "value"},
+ },
+ {
+ "mfe_config": {},
+ "mfe_config_overrides": {"mymfe": {"EXAMPLE_VAR": "mymfe_value"}},
+ "expected_response": {"EXAMPLE_VAR": "mymfe_value"},
+ },
+ {
+ "mfe_config": {"EXAMPLE_VAR": "value"},
+ "mfe_config_overrides": {"mymfe": {"EXAMPLE_VAR": "mymfe_value"}},
+ "expected_response": {"EXAMPLE_VAR": "mymfe_value"},
+ },
+ {
+ "mfe_config": {"EXAMPLE_VAR": "value", "OTHER": "other"},
+ "mfe_config_overrides": {"mymfe": {"EXAMPLE_VAR": "mymfe_value"}},
+ "expected_response": {"EXAMPLE_VAR": "mymfe_value", "OTHER": "other"},
+ },
+ {
+ "mfe_config": {"EXAMPLE_VAR": "value"},
+ "mfe_config_overrides": {"yourmfe": {"EXAMPLE_VAR": "yourmfe_value"}},
+ "expected_response": {"EXAMPLE_VAR": "value"},
+ },
+ {
+ "mfe_config": {"EXAMPLE_VAR": "value"},
+ "mfe_config_overrides": {
"yourmfe": {"EXAMPLE_VAR": "yourmfe_value"},
"mymfe": {"EXAMPLE_VAR": "mymfe_value"},
},
- expected_response={"EXAMPLE_VAR": "mymfe_value"},
- ),
+ "expected_response": {"EXAMPLE_VAR": "mymfe_value"},
+ },
)
@patch("lms.djangoapps.mfe_config_api.views.configuration_helpers")
def test_get_mfe_config_with_queryparam_multiple_configs(
diff --git a/lms/djangoapps/mobile_api/course_info/views.py b/lms/djangoapps/mobile_api/course_info/views.py
index 0a173863db13..d013ab2b98f8 100644
--- a/lms/djangoapps/mobile_api/course_info/views.py
+++ b/lms/djangoapps/mobile_api/course_info/views.py
@@ -181,11 +181,11 @@ def post(self, request, *args, **kwargs):
log.warning('For this mobile request, user activity is not enabled for this user {} and course {}'.format(
str(user_id), str(course_key))
)
- return Response(status=(200))
+ return Response(status=200)
# Populate user activity for tracking progress towards a user's course goals
UserActivity.record_user_activity(user, course_key)
- return Response(status=(200))
+ return Response(status=200)
@view_auth_classes(is_authenticated=False)
diff --git a/lms/djangoapps/mobile_api/tests/test_course_info_views.py b/lms/djangoapps/mobile_api/tests/test_course_info_views.py
index 56c020ec8fa3..38b470c6f3bd 100644
--- a/lms/djangoapps/mobile_api/tests/test_course_info_views.py
+++ b/lms/djangoapps/mobile_api/tests/test_course_info_views.py
@@ -306,7 +306,7 @@ def test_get_requested_user(self, user_role, username, expected_username, mock_g
elif user_role == 'student':
request_user = self.student_user
- self.request.user = request_user
+ self.request.user = request_user # pylint: disable=possibly-used-before-assignment
if expected_username == 'student_user':
mock_user = self.student_user
diff --git a/lms/djangoapps/mobile_api/users/tests.py b/lms/djangoapps/mobile_api/users/tests.py
index 2cfefaa058d9..6b4df3373b74 100644
--- a/lms/djangoapps/mobile_api/users/tests.py
+++ b/lms/djangoapps/mobile_api/users/tests.py
@@ -110,7 +110,7 @@ class TestUserEnrollmentApi(UrlResetMixin, MobileAPITestCase, MobileAuthUserTest
ALLOW_ACCESS_TO_NON_VISIBLE_COURSE = True
NEXT_WEEK = datetime.datetime.now(pytz.UTC) + datetime.timedelta(days=7)
LAST_WEEK = datetime.datetime.now(pytz.UTC) - datetime.timedelta(days=7)
- THREE_YEARS_AGO = now() - datetime.timedelta(days=(365 * 3))
+ THREE_YEARS_AGO = now() - datetime.timedelta(days=365 * 3)
ADVERTISED_START = "Spring 2016"
ENABLED_SIGNALS = ['course_published']
DATES = {
diff --git a/lms/djangoapps/program_enrollments/management/commands/tests/test_send_program_course_nudge_email.py b/lms/djangoapps/program_enrollments/management/commands/tests/test_send_program_course_nudge_email.py
index f5a6dcebb846..3c6aa3c42ecb 100644
--- a/lms/djangoapps/program_enrollments/management/commands/tests/test_send_program_course_nudge_email.py
+++ b/lms/djangoapps/program_enrollments/management/commands/tests/test_send_program_course_nudge_email.py
@@ -108,7 +108,7 @@ def enroll_user(self, user, course, create_grade=False):
@patch('common.djangoapps.student.models.course_enrollment.segment.track')
@patch('lms.djangoapps.program_enrollments.management.commands.send_program_course_nudge_email.get_programs')
@patch('lms.djangoapps.certificates.api.certificates_viewable_for_course', return_value=True)
- @override_settings(FEATURES=dict(ENABLE_ENTERPRISE_INTEGRATION=True))
+ @override_settings(FEATURES={"ENABLE_ENTERPRISE_INTEGRATION": True})
def test_email_send(self, add_no_commit, __, get_programs_mock, mock_track):
"""
Test Segment fired as expected.
@@ -145,7 +145,7 @@ def test_email_send(self, add_no_commit, __, get_programs_mock, mock_track):
)
@patch('common.djangoapps.student.models.course_enrollment.segment.track')
@patch('lms.djangoapps.program_enrollments.management.commands.send_program_course_nudge_email.get_programs')
- @override_settings(FEATURES=dict(ENABLE_ENTERPRISE_INTEGRATION=True))
+ @override_settings(FEATURES={"ENABLE_ENTERPRISE_INTEGRATION": True})
def test_email_no_course_recommendation(self, add_no_commit, get_programs_mock, mock_track):
"""
Test Segment fired as expected.
diff --git a/lms/djangoapps/static_template_view/views.py b/lms/djangoapps/static_template_view/views.py
index a788f77a95fd..f8962897c033 100644
--- a/lms/djangoapps/static_template_view/views.py
+++ b/lms/djangoapps/static_template_view/views.py
@@ -92,8 +92,7 @@ def render_press_release(request, slug):
resp = render_to_response('static_templates/press_releases/' + template, {})
except TemplateDoesNotExist:
raise Http404 # lint-amnesty, pylint: disable=raise-missing-from
- else:
- return resp
+ return resp
@fix_crum_request
diff --git a/lms/djangoapps/support/tests/test_views.py b/lms/djangoapps/support/tests/test_views.py
index 147532bf2e27..6b77e04a9441 100644
--- a/lms/djangoapps/support/tests/test_views.py
+++ b/lms/djangoapps/support/tests/test_views.py
@@ -394,7 +394,7 @@ def test_order_source_system_information(self):
assert len(data) == 1
assert data[0]['source_system'] == 'commercetools'
- @override_settings(FEATURES=dict(ENABLE_ENTERPRISE_INTEGRATION=True))
+ @override_settings(FEATURES={"ENABLE_ENTERPRISE_INTEGRATION": True})
@enterprise_is_enabled()
def test_get_enrollments_enterprise_enabled(self):
url = reverse(
diff --git a/lms/djangoapps/teams/csv.py b/lms/djangoapps/teams/csv.py
index cbfb754a50bb..00801dd230d7 100644
--- a/lms/djangoapps/teams/csv.py
+++ b/lms/djangoapps/teams/csv.py
@@ -378,7 +378,7 @@ def validate_compatible_enrollment_modes(self, user, team_name, teamset_id):
with other enrollment modes on a single team.
Masters track students can't be added to existing non-protected teams
"""
- if(teamset_id, team_name) not in self.user_enrollment_by_team:
+ if (teamset_id, team_name) not in self.user_enrollment_by_team:
self.user_enrollment_by_team[teamset_id, team_name] = set()
self.user_enrollment_by_team[teamset_id, team_name].add(self.user_to_actual_enrollment_mode[user.id])
if self.is_FERPA_bubble_breached(teamset_id, team_name) or \
diff --git a/lms/djangoapps/user_tours/v1/tests/test_views.py b/lms/djangoapps/user_tours/v1/tests/test_views.py
index f78586b78dec..878de68c6cdf 100644
--- a/lms/djangoapps/user_tours/v1/tests/test_views.py
+++ b/lms/djangoapps/user_tours/v1/tests/test_views.py
@@ -64,7 +64,7 @@ def test_unauthorized_user(self, method):
response = self.client.get(url)
elif method == 'PATCH':
response = self.client.patch(url, data={})
- assert response.status_code == status.HTTP_401_UNAUTHORIZED
+ assert response.status_code == status.HTTP_401_UNAUTHORIZED # pylint: disable=possibly-used-before-assignment
def test_get_success(self):
""" Test GET request for a user. """
diff --git a/lms/djangoapps/verify_student/management/commands/tests/test_retry_failed_photo_verifications.py b/lms/djangoapps/verify_student/management/commands/tests/test_retry_failed_photo_verifications.py
index 8fa84efe3a85..043fad1fe419 100644
--- a/lms/djangoapps/verify_student/management/commands/tests/test_retry_failed_photo_verifications.py
+++ b/lms/djangoapps/verify_student/management/commands/tests/test_retry_failed_photo_verifications.py
@@ -55,7 +55,7 @@ def test_command(self):
def add_test_config_for_retry_verification(self):
"""Setups verification retry configuration."""
config = SSPVerificationRetryConfig.current()
- config.arguments = ('--verification-ids 1 2 3')
+ config.arguments = '--verification-ids 1 2 3'
config.enabled = True
config.save()
diff --git a/lms/djangoapps/verify_student/tests/test_models.py b/lms/djangoapps/verify_student/tests/test_models.py
index dfea8081e4d4..63550bc7b996 100644
--- a/lms/djangoapps/verify_student/tests/test_models.py
+++ b/lms/djangoapps/verify_student/tests/test_models.py
@@ -282,14 +282,14 @@ def test_initial_verification_for_user(self):
assert second_result == first_result
# Test method 'get_initial_verification' returns None after expiration
- expired_future = now() + timedelta(days=(FAKE_SETTINGS['DAYS_GOOD_FOR'] + 1))
+ expired_future = now() + timedelta(days=FAKE_SETTINGS['DAYS_GOOD_FOR'] + 1)
with freeze_time(expired_future):
third_result = SoftwareSecurePhotoVerification.get_initial_verification(user)
assert third_result is None
# Test method 'get_initial_verification' returns correct attempt after system expiration,
# but within earliest allowed override.
- expired_future = now() + timedelta(days=(FAKE_SETTINGS['DAYS_GOOD_FOR'] + 1))
+ expired_future = now() + timedelta(days=FAKE_SETTINGS['DAYS_GOOD_FOR'] + 1)
earliest_allowed = now() - timedelta(days=1)
with freeze_time(expired_future):
fourth_result = SoftwareSecurePhotoVerification.get_initial_verification(user, earliest_allowed)
diff --git a/lms/djangoapps/verify_student/tests/test_views.py b/lms/djangoapps/verify_student/tests/test_views.py
index 77ee515d3757..a77541931e2a 100644
--- a/lms/djangoapps/verify_student/tests/test_views.py
+++ b/lms/djangoapps/verify_student/tests/test_views.py
@@ -961,7 +961,7 @@ def _get_page_data(self, response):
soup = BeautifulSoup(markup=response.content, features="lxml")
pay_and_verify_div = soup.find(id="pay-and-verify-container")
- assert pay_and_verify_div is not None,\
+ assert pay_and_verify_div is not None, \
"Could not load pay and verify flow data. Maybe this isn't the pay and verify page?"
return {
@@ -1792,7 +1792,7 @@ def test_reverify_view_can_reverify_expired(self):
attempt.approve()
days_good_for = settings.VERIFY_STUDENT["DAYS_GOOD_FOR"]
- attempt.expiration_date = now() - timedelta(days=(days_good_for + 1))
+ attempt.expiration_date = now() - timedelta(days=days_good_for + 1)
attempt.save()
# Allow the student to re-verify
diff --git a/lms/djangoapps/verify_student/views.py b/lms/djangoapps/verify_student/views.py
index 1b6a47bee879..ed9073d6b891 100644
--- a/lms/djangoapps/verify_student/views.py
+++ b/lms/djangoapps/verify_student/views.py
@@ -382,7 +382,7 @@ def get( # lint-amnesty, pylint: disable=too-many-statements
# Remember whether the user is upgrading
# so we can fire an analytics event upon payment.
- request.session['attempting_upgrade'] = (message == self.UPGRADE_MSG)
+ request.session['attempting_upgrade'] = message == self.UPGRADE_MSG
# Determine the photo verification status
verification_good_until = self._verification_valid_until(request.user)
diff --git a/lms/envs/common.py b/lms/envs/common.py
index 4fcb0a8126bc..f9b964246e90 100644
--- a/lms/envs/common.py
+++ b/lms/envs/common.py
@@ -1274,13 +1274,14 @@
# 3 months and then we expire refresh tokens using edx_clear_expired_tokens (length is mobile app driven)
'REFRESH_TOKEN_EXPIRE_SECONDS': 7776000,
'SCOPES_BACKEND_CLASS': 'openedx.core.djangoapps.oauth_dispatch.scopes.ApplicationModelScopes',
- 'SCOPES': dict(OAUTH2_DEFAULT_SCOPES, **{
+ 'SCOPES': {
+ **OAUTH2_DEFAULT_SCOPES,
'certificates:read': _('Retrieve your course certificates'),
'grades:read': _('Retrieve your grades for your enrolled courses'),
'tpa:read': _('Retrieve your third-party authentication username mapping'),
# user_id is added in code as a default scope for JWT cookies and all password grant_type JWTs
'user_id': _('Know your user identifier'),
- }),
+ },
'DEFAULT_SCOPES': OAUTH2_DEFAULT_SCOPES,
'REQUEST_APPROVAL_PROMPT': 'auto_even_if_expired',
'ERROR_RESPONSE_WITH_SCOPES': True,
@@ -2952,7 +2953,7 @@ def _make_locale_paths(settings): # pylint: disable=missing-function-docstring
# .. setting_description: Stores all the settings used by block structures and block structure
# related tasks. See BLOCK_STRUCTURES_SETTINGS[XXX] documentation for details of each setting.
# For more information, check https://github.com/openedx/edx-platform/pull/13388.
-BLOCK_STRUCTURES_SETTINGS = dict(
+BLOCK_STRUCTURES_SETTINGS = {
# .. setting_name: BLOCK_STRUCTURES_SETTINGS['COURSE_PUBLISH_TASK_DELAY']
# .. setting_default: 30
# .. setting_description: Delay, in seconds, after a new edit of a course is published before
@@ -2960,14 +2961,14 @@ def _make_locale_paths(settings): # pylint: disable=missing-function-docstring
# the latest changes when there are secondary reads in sharded mongoDB clusters.
# For more information, check https://github.com/openedx/edx-platform/pull/13388 and
# https://github.com/openedx/edx-platform/pull/14571.
- COURSE_PUBLISH_TASK_DELAY=30,
+ 'COURSE_PUBLISH_TASK_DELAY': 30,
# .. setting_name: BLOCK_STRUCTURES_SETTINGS['TASK_DEFAULT_RETRY_DELAY']
# .. setting_default: 30
# .. setting_description: Delay, in seconds, between retry attempts if a block structure task
# fails. For more information, check https://github.com/openedx/edx-platform/pull/13388 and
# https://github.com/openedx/edx-platform/pull/14571.
- TASK_DEFAULT_RETRY_DELAY=30,
+ 'TASK_DEFAULT_RETRY_DELAY': 30,
# .. setting_name: BLOCK_STRUCTURES_SETTINGS['TASK_MAX_RETRIES']
# .. setting_default: 5
@@ -2976,8 +2977,8 @@ def _make_locale_paths(settings): # pylint: disable=missing-function-docstring
# the celery task, or wait for it to be triggered again.
# For more information, check https://github.com/openedx/edx-platform/pull/13388 and
# https://github.com/openedx/edx-platform/pull/14571.
- TASK_MAX_RETRIES=5,
-)
+ 'TASK_MAX_RETRIES': 5,
+}
################################ Bulk Email ###################################
@@ -3859,35 +3860,34 @@ def _make_locale_paths(settings): # pylint: disable=missing-function-docstring
########################## VIDEO IMAGE STORAGE ############################
-VIDEO_IMAGE_SETTINGS = dict(
- VIDEO_IMAGE_MAX_BYTES=2 * 1024 * 1024, # 2 MB
- VIDEO_IMAGE_MIN_BYTES=2 * 1024, # 2 KB
+VIDEO_IMAGE_SETTINGS = {
+ 'VIDEO_IMAGE_MAX_BYTES': 2 * 1024 * 1024, # 2 MB
+ 'VIDEO_IMAGE_MIN_BYTES': 2 * 1024, # 2 KB
# Backend storage
# STORAGE_CLASS='storages.backends.s3boto3.S3Boto3Storage',
- # STORAGE_KWARGS=dict(bucket='video-image-bucket'),
- STORAGE_KWARGS=dict(
- location=MEDIA_ROOT,
- ),
- DIRECTORY_PREFIX='video-images/',
- BASE_URL=MEDIA_URL,
-
-)
+ # STORAGE_KWARGS={'bucket': 'video-image-bucket'},
+ 'STORAGE_KWARGS': {
+ 'location': MEDIA_ROOT,
+ },
+ 'DIRECTORY_PREFIX': 'video-images/',
+ 'BASE_URL': MEDIA_URL,
+}
VIDEO_IMAGE_MAX_AGE = 31536000
########################## VIDEO TRANSCRIPTS STORAGE ############################
-VIDEO_TRANSCRIPTS_SETTINGS = dict(
- VIDEO_TRANSCRIPTS_MAX_BYTES=3 * 1024 * 1024, # 3 MB
+VIDEO_TRANSCRIPTS_SETTINGS = {
+ 'VIDEO_TRANSCRIPTS_MAX_BYTES': 3 * 1024 * 1024, # 3 MB
# Backend storage
# STORAGE_CLASS='storages.backends.s3boto3.S3Boto3Storage',
- # STORAGE_KWARGS=dict(bucket='video-transcripts-bucket'),
- STORAGE_KWARGS=dict(
- location=MEDIA_ROOT,
- ),
- DIRECTORY_PREFIX='video-transcripts/',
- BASE_URL=MEDIA_URL,
-)
+ # STORAGE_KWARGS={'bucket': 'video-transcripts-bucket'},
+ 'STORAGE_KWARGS': {
+ 'location': MEDIA_ROOT,
+ },
+ 'DIRECTORY_PREFIX': 'video-transcripts/',
+ 'BASE_URL': MEDIA_URL,
+}
VIDEO_TRANSCRIPTS_MAX_AGE = 31536000
diff --git a/lms/envs/test.py b/lms/envs/test.py
index a9e8aaf9f2e2..89f43cee1fd9 100644
--- a/lms/envs/test.py
+++ b/lms/envs/test.py
@@ -489,14 +489,14 @@
)
########################## VIDEO TRANSCRIPTS STORAGE ############################
-VIDEO_TRANSCRIPTS_SETTINGS = dict(
- VIDEO_TRANSCRIPTS_MAX_BYTES=3 * 1024 * 1024, # 3 MB
- STORAGE_KWARGS=dict(
- location=MEDIA_ROOT,
- base_url=MEDIA_URL,
- ),
- DIRECTORY_PREFIX='video-transcripts/',
-)
+VIDEO_TRANSCRIPTS_SETTINGS = {
+ 'VIDEO_TRANSCRIPTS_MAX_BYTES': 3 * 1024 * 1024, # 3 MB
+ 'STORAGE_KWARGS': {
+ 'location': MEDIA_ROOT,
+ 'base_url': MEDIA_URL,
+ },
+ 'DIRECTORY_PREFIX': 'video-transcripts/',
+}
####################### Authentication Settings ##########################
JWT_AUTH.update({
diff --git a/openedx/core/djangoapps/ace_common/tests/test_tracking.py b/openedx/core/djangoapps/ace_common/tests/test_tracking.py
index b6c0fa1df5b6..a192f8f0b58c 100644
--- a/openedx/core/djangoapps/ace_common/tests/test_tracking.py
+++ b/openedx/core/djangoapps/ace_common/tests/test_tracking.py
@@ -122,9 +122,7 @@ def test_missing_settings(self):
@override_settings(GOOGLE_ANALYTICS_TRACKING_ID='UA-123456-1')
def test_site_config_override(self):
site_config = SiteConfigurationFactory.create(
- site_values=dict(
- GOOGLE_ANALYTICS_ACCOUNT='UA-654321-1'
- )
+ site_values={"GOOGLE_ANALYTICS_ACCOUNT": 'UA-654321-1'}
)
pixel = GoogleAnalyticsTrackingPixel(site=site_config.site)
self.assert_query_string_parameters_equal(pixel.generate_image_url(), tid='UA-654321-1')
diff --git a/openedx/core/djangoapps/api_admin/tests/test_views.py b/openedx/core/djangoapps/api_admin/tests/test_views.py
index ae07399acb44..9228684c4faf 100644
--- a/openedx/core/djangoapps/api_admin/tests/test_views.py
+++ b/openedx/core/djangoapps/api_admin/tests/test_views.py
@@ -189,7 +189,7 @@ def test_post(self, status, application_exists, new_application_created):
applications = Application.objects.filter(user=self.user)
if application_exists and new_application_created:
assert applications.count() == 1
- assert old_application != applications[0]
+ assert old_application != applications[0] # pylint: disable=possibly-used-before-assignment
elif application_exists:
assert applications.count() == 1
assert old_application == applications[0]
diff --git a/openedx/core/djangoapps/catalog/management/commands/cache_programs.py b/openedx/core/djangoapps/catalog/management/commands/cache_programs.py
index 9e0664f4930f..c4aa27f866fc 100644
--- a/openedx/core/djangoapps/catalog/management/commands/cache_programs.py
+++ b/openedx/core/djangoapps/catalog/management/commands/cache_programs.py
@@ -203,7 +203,7 @@ def get_pathways(self, client, site, api_base_url):
api_url = urljoin(f"{api_base_url}/", "pathways/")
next_page = 1
while next_page:
- response = client.get(api_url, params=dict(exclude_utm=1, page=next_page))
+ response = client.get(api_url, params={"exclude_utm": 1, "page": next_page})
response.raise_for_status()
new_pathways = response.json()
pathways.extend(new_pathways['results'])
diff --git a/openedx/core/djangoapps/content/block_structure/management/commands/generate_course_blocks.py b/openedx/core/djangoapps/content/block_structure/management/commands/generate_course_blocks.py
index 047c945fe406..2abf656362f3 100644
--- a/openedx/core/djangoapps/content/block_structure/management/commands/generate_course_blocks.py
+++ b/openedx/core/djangoapps/content/block_structure/management/commands/generate_course_blocks.py
@@ -140,7 +140,7 @@ def _generate_for_course(self, options, course_key):
action = tasks.update_course_in_cache_v2 if options.get('force_update') else tasks.get_course_in_cache_v2
task_options = {'routing_key': options['routing_key']} if options.get('routing_key') else {}
result = action.apply_async(
- kwargs=dict(course_id=str(course_key)),
+ kwargs={"course_id": str(course_key)},
**task_options
)
log.info('BlockStructure: ENQUEUED generating for course: %s, task_id: %s.', course_key, result.id)
diff --git a/openedx/core/djangoapps/content/block_structure/management/commands/tests/test_generate_course_blocks.py b/openedx/core/djangoapps/content/block_structure/management/commands/tests/test_generate_course_blocks.py
index 430f374b07cc..55e7c8f3119f 100644
--- a/openedx/core/djangoapps/content/block_structure/management/commands/tests/test_generate_course_blocks.py
+++ b/openedx/core/djangoapps/content/block_structure/management/commands/tests/test_generate_course_blocks.py
@@ -99,7 +99,7 @@ def test_one_course(self):
)
@ddt.unpack
def test_enqueue(self, enqueue_task, force_update, routing_key):
- command_options = dict(all_courses=True, enqueue_task=enqueue_task, force_update=force_update)
+ command_options = {"all_courses": True, "enqueue_task": enqueue_task, "force_update": force_update}
if enqueue_task and routing_key:
command_options['routing_key'] = routing_key
diff --git a/openedx/core/djangoapps/content/block_structure/models.py b/openedx/core/djangoapps/content/block_structure/models.py
index b3a8439ca169..153db2df1935 100644
--- a/openedx/core/djangoapps/content/block_structure/models.py
+++ b/openedx/core/djangoapps/content/block_structure/models.py
@@ -95,11 +95,11 @@ class CustomizableFileField(models.FileField):
create new migration files for each configuration change.
"""
def __init__(self, *args, **kwargs):
- kwargs.update(dict(
- upload_to=_path_name,
- storage=_bs_model_storage(),
- max_length=500, # allocate enough for base path + prefix + usage_key + timestamp in filepath
- ))
+ kwargs.update({
+ "upload_to": _path_name,
+ "storage": _bs_model_storage(),
+ "max_length": 500, # allocate enough for base path + prefix + usage_key + timestamp in filepath
+ })
super().__init__(*args, **kwargs)
def deconstruct(self): # lint-amnesty, pylint: disable=missing-function-docstring
diff --git a/openedx/core/djangoapps/content/block_structure/signals.py b/openedx/core/djangoapps/content/block_structure/signals.py
index d097216d26ac..939b001f57f7 100644
--- a/openedx/core/djangoapps/content/block_structure/signals.py
+++ b/openedx/core/djangoapps/content/block_structure/signals.py
@@ -27,7 +27,7 @@ def update_block_structure_on_course_publish(sender, course_key, **kwargs): # p
return
update_course_in_cache_v2.apply_async(
- kwargs=dict(course_id=str(course_key)),
+ kwargs={"course_id": str(course_key)},
countdown=settings.BLOCK_STRUCTURES_SETTINGS['COURSE_PUBLISH_TASK_DELAY'],
)
diff --git a/openedx/core/djangoapps/content/block_structure/store.py b/openedx/core/djangoapps/content/block_structure/store.py
index 37a2b57449c0..e88188ea313d 100644
--- a/openedx/core/djangoapps/content/block_structure/store.py
+++ b/openedx/core/djangoapps/content/block_structure/store.py
@@ -206,12 +206,12 @@ def _version_data_of_block(root_block):
Returns the version-relevant data for the given block, including the
current schema state of the Transformers and BlockStructure classes.
"""
- return dict(
- data_version=getattr(root_block, 'course_version', None),
- data_edit_timestamp=getattr(root_block, 'subtree_edited_on', None),
- transformers_schema_version=TransformerRegistry.get_write_version_hash(),
- block_structure_schema_version=str(BlockStructureBlockData.VERSION),
- )
+ return {
+ "data_version": getattr(root_block, "course_version", None),
+ "data_edit_timestamp": getattr(root_block, "subtree_edited_on", None),
+ "transformers_schema_version": TransformerRegistry.get_write_version_hash(),
+ "block_structure_schema_version": str(BlockStructureBlockData.VERSION),
+ }
@staticmethod
def _version_data_of_model(bs_model):
diff --git a/openedx/core/djangoapps/content/block_structure/tests/helpers.py b/openedx/core/djangoapps/content/block_structure/tests/helpers.py
index f0a20554e6d2..1c166879b4db 100644
--- a/openedx/core/djangoapps/content/block_structure/tests/helpers.py
+++ b/openedx/core/djangoapps/content/block_structure/tests/helpers.py
@@ -307,7 +307,7 @@ def assert_block_structure(self, block_structure, children_map, missing_blocks=N
for block_key, children in enumerate(children_map):
# Verify presence
- assert (self.block_key_factory(block_key) in block_structure) == (block_key not in missing_blocks),\
+ assert (self.block_key_factory(block_key) in block_structure) == (block_key not in missing_blocks), \
'Expected presence in block_structure for block_key {} to match absence in missing_blocks.'\
.format(str(block_key))
diff --git a/openedx/core/djangoapps/content/block_structure/tests/test_models.py b/openedx/core/djangoapps/content/block_structure/tests/test_models.py
index 39bb68b09412..05610ebd6d9f 100644
--- a/openedx/core/djangoapps/content/block_structure/tests/test_models.py
+++ b/openedx/core/djangoapps/content/block_structure/tests/test_models.py
@@ -56,13 +56,13 @@ def _create_bsm_params(self):
"""
Returns the parameters for creating a BlockStructureModel.
"""
- return dict(
- data_usage_key=self.usage_key,
- data_version='DV',
- data_edit_timestamp=now(),
- transformers_schema_version='TV',
- block_structure_schema_version=str(1),
- )
+ return {
+ "data_usage_key": self.usage_key,
+ "data_version": "DV",
+ "data_edit_timestamp": now(),
+ "transformers_schema_version": "TV",
+ "block_structure_schema_version": str(1),
+ }
def _verify_update_or_create_call(self, serialized_data, mock_log=None, expect_created=None):
"""
@@ -96,7 +96,7 @@ def test_update_or_create(self, mock_log):
assert 'Read' in mock_log.info.call_args[0][1]
# update entry
- self.params.update(dict(data_version='new version'))
+ self.params.update({"data_version": 'new version'})
updated_serialized_data = 'updated data'
updated_bsm = self._verify_update_or_create_call(updated_serialized_data, mock_log, expect_created=False)
assert bsm.data.name != updated_bsm.data.name
diff --git a/openedx/core/djangoapps/content/block_structure/tests/test_tasks.py b/openedx/core/djangoapps/content/block_structure/tests/test_tasks.py
index 834600e3c97d..bafc1c04a279 100644
--- a/openedx/core/djangoapps/content/block_structure/tests/test_tasks.py
+++ b/openedx/core/djangoapps/content/block_structure/tests/test_tasks.py
@@ -21,5 +21,5 @@ def test_retry_on_error(self, mock_update, mock_retry):
Ensures that tasks will be retried if IntegrityErrors are encountered.
"""
mock_update.side_effect = Exception("WHAMMY")
- update_course_in_cache_v2.apply(kwargs=dict(course_id="invalid_course_key raises exception 12345 meow"))
+ update_course_in_cache_v2.apply(kwargs={"course_id": 'invalid_course_key raises exception 12345 meow'})
assert mock_retry.called
diff --git a/openedx/core/djangoapps/content/course_overviews/management/commands/tests/test_simulate_publish.py b/openedx/core/djangoapps/content/course_overviews/management/commands/tests/test_simulate_publish.py
index a91ff0ffffa4..761becc3608b 100644
--- a/openedx/core/djangoapps/content/course_overviews/management/commands/tests/test_simulate_publish.py
+++ b/openedx/core/djangoapps/content/course_overviews/management/commands/tests/test_simulate_publish.py
@@ -89,16 +89,16 @@ def options(self, **kwargs):
name_from_fn(self.sample_receiver_1),
name_from_fn(self.sample_receiver_2),
]
- default_options = dict(
- show_receivers=False,
- dry_run=False,
- receivers=default_receivers,
- courses=None,
- delay=0,
- force_lms=False,
- skip_ccx=False,
- args_from_database=False
- )
+ default_options = {
+ "show_receivers": False,
+ "dry_run": False,
+ "receivers": default_receivers,
+ "courses": None,
+ "delay": 0,
+ "force_lms": False,
+ "skip_ccx": False,
+ "args_from_database": False,
+ }
default_options.update(kwargs)
return default_options
diff --git a/openedx/core/djangoapps/content/course_overviews/models.py b/openedx/core/djangoapps/content/course_overviews/models.py
index 10a56f0868fb..7cb712a6f3d1 100644
--- a/openedx/core/djangoapps/content/course_overviews/models.py
+++ b/openedx/core/djangoapps/content/course_overviews/models.py
@@ -231,7 +231,7 @@ def _create_or_update(cls, course): # lint-amnesty, pylint: disable=too-many-st
course_overview.certificate_available_date = updated_available_date
course_overview.certificates_show_before_end = course.certificates_show_before_end
course_overview.cert_html_view_enabled = course.cert_html_view_enabled
- course_overview.has_any_active_web_certificate = (get_active_web_certificate(course) is not None)
+ course_overview.has_any_active_web_certificate = get_active_web_certificate(course) is not None
course_overview.cert_name_short = course.cert_name_short
course_overview.cert_name_long = course.cert_name_long
course_overview.lowest_passing_grade = lowest_passing_grade
diff --git a/openedx/core/djangoapps/content/course_overviews/tests/test_course_overviews.py b/openedx/core/djangoapps/content/course_overviews/tests/test_course_overviews.py
index 8e95c44825c5..24ccf1c5e985 100644
--- a/openedx/core/djangoapps/content/course_overviews/tests/test_course_overviews.py
+++ b/openedx/core/djangoapps/content/course_overviews/tests/test_course_overviews.py
@@ -539,8 +539,8 @@ def test_get_all_courses_by_mobile_available(self):
test_cases = (
(None, {non_mobile_course.id, mobile_course.id}),
- (dict(mobile_available=True), {mobile_course.id}),
- (dict(mobile_available=False), {non_mobile_course.id}),
+ ({"mobile_available": True}, {mobile_course.id}),
+ ({"mobile_available": False}, {non_mobile_course.id}),
)
for filter_, expected_courses in test_cases:
diff --git a/openedx/core/djangoapps/content/learning_sequences/api/tests/test_outlines.py b/openedx/core/djangoapps/content/learning_sequences/api/tests/test_outlines.py
index 20effa6b16cd..4e2c8db5497a 100644
--- a/openedx/core/djangoapps/content/learning_sequences/api/tests/test_outlines.py
+++ b/openedx/core/djangoapps/content/learning_sequences/api/tests/test_outlines.py
@@ -1064,7 +1064,7 @@ def get_attempt_status_side_effect(user_id, _course_key, usage_key):
for sequence_key in self.get_sequence_keys(exclude=[self.seq_normal_key]):
assert sequence_key in student_details.special_exam_attempts.sequences
attempt_summary = student_details.special_exam_attempts.sequences[sequence_key]
- assert type(attempt_summary) == dict # lint-amnesty, pylint: disable=unidiomatic-typecheck
+ assert isinstance(attempt_summary, dict)
assert attempt_summary["summary"]["usage_key"] == str(sequence_key)
@patch.dict(settings.FEATURES, {'ENABLE_SPECIAL_EXAMS': False})
@@ -1101,7 +1101,7 @@ def test_special_exam_attempt_data_exam_type(self):
# Ensure that exam type is correct for proctored exam
assert self.seq_proctored_exam_key in student_details.special_exam_attempts.sequences
attempt_summary = student_details.special_exam_attempts.sequences[self.seq_proctored_exam_key]
- assert type(attempt_summary) == dict # lint-amnesty, pylint: disable=unidiomatic-typecheck
+ assert isinstance(attempt_summary, dict)
assert attempt_summary["short_description"] == "Proctored Exam"
@@ -1262,7 +1262,7 @@ def test_public_course_outline(self):
assert len(user_course_outline.sections) == 3
assert len(user_course_outline.sequences) == 6
assert all([(seq.usage_key in user_course_outline.accessible_sequences) for seq in # lint-amnesty, pylint: disable=use-a-generator
- user_course_outline.sequences.values()]),\
+ user_course_outline.sequences.values()]), \
'Sequences should be accessible to all users for a public course'
@override_waffle_flag(COURSE_ENABLE_UNENROLLED_ACCESS_FLAG, active=True)
@@ -1287,11 +1287,11 @@ def test_public_outline_course_outline(self):
]
if user in [self.anonymous_user, self.unenrolled_student]:
- assert all((not is_accessible) for is_accessible in is_sequence_accessible),\
+ assert all((not is_accessible) for is_accessible in is_sequence_accessible), \
"Sequences shouldn't be accessible to anonymous or " \
"non-enrolled students for a public_outline course"
else:
- assert all(is_sequence_accessible),\
+ assert all(is_sequence_accessible), \
'Sequences should be accessible to enrolled, staff users for a public_outline course'
@override_waffle_flag(COURSE_ENABLE_UNENROLLED_ACCESS_FLAG, active=True)
@@ -1313,13 +1313,13 @@ def test_private_course_outline(self):
]
if user in [self.anonymous_user, self.unenrolled_student]:
- assert (len(user_course_outline.sections) == len(user_course_outline.sequences) == 0),\
+ assert (len(user_course_outline.sections) == len(user_course_outline.sequences) == 0), \
'No section of a private course should be visible to anonymous or non-enrolled student'
else:
# Enrolled or Staff User
assert len(user_course_outline.sections) == 3
assert len(user_course_outline.sequences) == 6
- assert all(is_sequence_accessible),\
+ assert all(is_sequence_accessible), \
'Sequences should be accessible to enrolled, staff users for a public_outline course'
diff --git a/openedx/core/djangoapps/content_libraries/tasks.py b/openedx/core/djangoapps/content_libraries/tasks.py
index f56b4adfe313..11da1d452b04 100644
--- a/openedx/core/djangoapps/content_libraries/tasks.py
+++ b/openedx/core/djangoapps/content_libraries/tasks.py
@@ -190,7 +190,7 @@ def _sync_children(
except ItemNotFoundError:
task.status.fail(f"Requested library {library_key} not found.")
return
- filter_children = (dest_block.capa_type != ANY_CAPA_TYPE_VALUE)
+ filter_children = dest_block.capa_type != ANY_CAPA_TYPE_VALUE
if filter_children:
# Apply simple filtering based on CAPA problem types:
source_blocks.extend(_problem_type_filter(store, library, dest_block.capa_type))
diff --git a/openedx/core/djangoapps/content_libraries/tests/base.py b/openedx/core/djangoapps/content_libraries/tests/base.py
index 77de1c028aa7..ddf2e6e33658 100644
--- a/openedx/core/djangoapps/content_libraries/tests/base.py
+++ b/openedx/core/djangoapps/content_libraries/tests/base.py
@@ -105,7 +105,7 @@ def _api(self, method, url, data, expect_response):
Call a REST API
"""
response = getattr(self.client, method)(url, data, format="json")
- assert response.status_code == expect_response,\
+ assert response.status_code == expect_response, \
'Unexpected response code {}:\n{}'.format(response.status_code, getattr(response, 'data', '(no data)'))
return response.data
@@ -277,7 +277,7 @@ def _set_library_block_asset(self, block_key, file_name, content, expect_respons
file_handle = BytesIO(content)
url = URL_LIB_BLOCK_ASSET_FILE.format(block_key=block_key, file_name=file_name)
response = self.client.put(url, data={"content": file_handle})
- assert response.status_code == expect_response,\
+ assert response.status_code == expect_response, \
'Unexpected response code {}:\n{}'.format(response.status_code, getattr(response, 'data', '(no data)'))
def _delete_library_block_asset(self, block_key, file_name, expect_response=204):
diff --git a/openedx/core/djangoapps/content_libraries/tests/test_content_libraries.py b/openedx/core/djangoapps/content_libraries/tests/test_content_libraries.py
index 83b277604071..7152834d73e4 100644
--- a/openedx/core/djangoapps/content_libraries/tests/test_content_libraries.py
+++ b/openedx/core/djangoapps/content_libraries/tests/test_content_libraries.py
@@ -1090,9 +1090,9 @@ class ContentLibraryXBlockValidationTest(APITestCase):
"""Tests only focused on service validation, no Learning Core interactions here."""
@ddt.data(
- (URL_BLOCK_METADATA_URL, dict(block_key='totally_invalid_key')),
- (URL_BLOCK_RENDER_VIEW, dict(block_key='totally_invalid_key', view_name='random')),
- (URL_BLOCK_GET_HANDLER_URL, dict(block_key='totally_invalid_key', handler_name='random')),
+ (URL_BLOCK_METADATA_URL, {"block_key": 'totally_invalid_key'}),
+ (URL_BLOCK_RENDER_VIEW, {"block_key": 'totally_invalid_key', "view_name": 'random'}),
+ (URL_BLOCK_GET_HANDLER_URL, {"block_key": 'totally_invalid_key', "handler_name": 'random'}),
)
@ddt.unpack
def test_invalid_key(self, endpoint, endpoint_parameters):
@@ -1105,10 +1105,10 @@ def test_invalid_key(self, endpoint, endpoint_parameters):
def test_xblock_handler_invalid_key(self):
"""This endpoint is tested separately from the previous ones as it's not a DRF endpoint."""
client = Client()
- response = client.get(URL_BLOCK_XBLOCK_HANDLER.format(**dict(
- block_key='totally_invalid_key',
- handler_name='random',
- user_id='random',
- secure_token='random',
- )))
+ response = client.get(URL_BLOCK_XBLOCK_HANDLER.format(**{
+ "block_key": "totally_invalid_key",
+ "handler_name": "random",
+ "user_id": "random",
+ "secure_token": "random",
+ }))
self.assertEqual(response.status_code, 404)
diff --git a/openedx/core/djangoapps/content_staging/tests/test_clipboard.py b/openedx/core/djangoapps/content_staging/tests/test_clipboard.py
index 551f94e90e1a..ab65d444ed6f 100644
--- a/openedx/core/djangoapps/content_staging/tests/test_clipboard.py
+++ b/openedx/core/djangoapps/content_staging/tests/test_clipboard.py
@@ -1,3 +1,4 @@
+# pylint: skip-file
"""
Tests for the clipboard functionality
"""
diff --git a/openedx/core/djangoapps/contentserver/test/test_contentserver.py b/openedx/core/djangoapps/contentserver/test/test_contentserver.py
index 4c0180c402e9..0e0f8d186c23 100644
--- a/openedx/core/djangoapps/contentserver/test/test_contentserver.py
+++ b/openedx/core/djangoapps/contentserver/test/test_contentserver.py
@@ -273,7 +273,7 @@ def test_range_request_malformed_invalid_range(self):
416 Requested Range Not Satisfiable.
"""
resp = self.client.get(self.url_unlocked, HTTP_RANGE='bytes={first}-{last}'.format(
- first=(self.length_unlocked // 2), last=(self.length_unlocked // 4)))
+ first=self.length_unlocked // 2, last=self.length_unlocked // 4))
assert resp.status_code == 416
def test_range_request_malformed_out_of_bounds(self):
@@ -282,7 +282,7 @@ def test_range_request_malformed_out_of_bounds(self):
outputs 416 Requested Range Not Satisfiable.
"""
resp = self.client.get(self.url_unlocked, HTTP_RANGE='bytes={first}-{last}'.format(
- first=(self.length_unlocked), last=(self.length_unlocked)))
+ first=self.length_unlocked, last=self.length_unlocked))
assert resp.status_code == 416
def test_vary_header_sent(self):
diff --git a/openedx/core/djangoapps/cookie_metadata/middleware.py b/openedx/core/djangoapps/cookie_metadata/middleware.py
index f54839da8fe8..5c7f30c0f09f 100644
--- a/openedx/core/djangoapps/cookie_metadata/middleware.py
+++ b/openedx/core/djangoapps/cookie_metadata/middleware.py
@@ -91,7 +91,7 @@ def __call__(self, request):
expand_settings["current"] not in request.COOKIES
and alt_cookie_in_request
):
- request.COOKIES[expand_settings["current"]] = alt_cookie_value
+ request.COOKIES[expand_settings["current"]] = alt_cookie_value # pylint: disable=possibly-used-before-assignment
set_custom_attribute("cookie.change_name", 1)
response = self.get_response(request)
diff --git a/openedx/core/djangoapps/cors_csrf/tests/test_views.py b/openedx/core/djangoapps/cors_csrf/tests/test_views.py
index a5f7c31b8800..4de88998e659 100644
--- a/openedx/core/djangoapps/cors_csrf/tests/test_views.py
+++ b/openedx/core/djangoapps/cors_csrf/tests/test_views.py
@@ -57,7 +57,7 @@ def test_xdomain_proxy_enabled_with_whitelist(self, whitelist, expected_whitelis
def _configure(self, is_enabled, whitelist=None):
"""Enable or disable the end-point and configure the whitelist. """
- config = XDomainProxyConfiguration.current()
+ config = XDomainProxyConfiguration.current() # pylint: disable=possibly-used-before-assignment
config.enabled = is_enabled
if whitelist:
diff --git a/openedx/core/djangoapps/course_apps/rest_api/tests/test_views.py b/openedx/core/djangoapps/course_apps/rest_api/tests/test_views.py
index 768643a7a204..49bd85e91e97 100644
--- a/openedx/core/djangoapps/course_apps/rest_api/tests/test_views.py
+++ b/openedx/core/djangoapps/course_apps/rest_api/tests/test_views.py
@@ -33,7 +33,7 @@ def setUp(self):
self.user = UserFactory()
self.client = Client()
self.client.login(username=self.instructor.username, password=self.TEST_PASSWORD)
- self.url = reverse("course_apps_api:v1:course_apps", kwargs=dict(course_id=self.course.id))
+ self.url = reverse("course_apps_api:v1:course_apps", kwargs={"course_id": self.course.id})
CourseStaffRole(self.course.id).add_users(self.instructor)
@contextlib.contextmanager
diff --git a/openedx/core/djangoapps/course_groups/tests/test_cohorts.py b/openedx/core/djangoapps/course_groups/tests/test_cohorts.py
index 0f6dd85863ba..e46829e0f7f7 100644
--- a/openedx/core/djangoapps/course_groups/tests/test_cohorts.py
+++ b/openedx/core/djangoapps/course_groups/tests/test_cohorts.py
@@ -257,7 +257,7 @@ def test_get_cohort(self):
assert cohorts.get_cohort(user, course.id).id == cohort.id, 'user should be assigned to the correct cohort'
assert cohorts.get_cohort(other_user, course.id).id == cohorts\
- .get_cohort_by_name(course.id, cohorts.DEFAULT_COHORT_NAME).id,\
+ .get_cohort_by_name(course.id, cohorts.DEFAULT_COHORT_NAME).id, \
'other_user should be assigned to the default cohort'
def test_get_cohort_preassigned_user(self):
@@ -411,7 +411,7 @@ def test_cohorting_with_migrations_done(self):
assert cohorts.get_cohort(user2, course.id).name == 'AutoGroup', 'user2 should be assigned to AutoGroups'
- assert cohorts.get_cohort(user1, course.id).name == 'AutoGroup',\
+ assert cohorts.get_cohort(user1, course.id).name == 'AutoGroup', \
'user1 should still be in originally placed cohort'
def test_cohorting_with_no_auto_cohorts(self):
@@ -446,7 +446,7 @@ def test_cohorting_with_no_auto_cohorts(self):
)
assert cohorts.get_cohort(user1, course.id).name == cohorts\
- .get_cohort_by_name(course.id, cohorts.DEFAULT_COHORT_NAME).name,\
+ .get_cohort_by_name(course.id, cohorts.DEFAULT_COHORT_NAME).name, \
'user1 should still be in the default cohort'
assert cohorts.get_cohort(user2, course.id).id == cohorts\
diff --git a/openedx/core/djangoapps/courseware_api/tests/test_views.py b/openedx/core/djangoapps/courseware_api/tests/test_views.py
index ef2f9ef24796..7f8c0fb1ea5a 100644
--- a/openedx/core/djangoapps/courseware_api/tests/test_views.py
+++ b/openedx/core/djangoapps/courseware_api/tests/test_views.py
@@ -181,7 +181,7 @@ def test_enrolled_course_metadata(self, logged_in, enrollment_mode):
assert response.data['verification_status'] == 'none'
request = RequestFactory().request()
- cert_url = get_certificate_url(course_id=self.course.id, uuid=cert.verify_uuid)
+ cert_url = get_certificate_url(course_id=self.course.id, uuid=cert.verify_uuid) # pylint: disable=possibly-used-before-assignment
linkedin_url_params = {
'name': '{platform_name} Verified Certificate for {course_name}'.format(
platform_name=settings.PLATFORM_NAME, course_name=self.course.display_name,
diff --git a/openedx/core/djangoapps/credit/models.py b/openedx/core/djangoapps/credit/models.py
index 2a9fa2088551..9c14a15104b9 100644
--- a/openedx/core/djangoapps/credit/models.py
+++ b/openedx/core/djangoapps/credit/models.py
@@ -514,7 +514,6 @@ def remove_requirement_status(cls, username, requirement):
)
)
log.error(log_msg)
- return
@classmethod
def retire_user(cls, retirement):
diff --git a/openedx/core/djangoapps/credit/tasks.py b/openedx/core/djangoapps/credit/tasks.py
index 312e278a985f..79ef613e3d19 100644
--- a/openedx/core/djangoapps/credit/tasks.py
+++ b/openedx/core/djangoapps/credit/tasks.py
@@ -41,8 +41,7 @@ def update_credit_course_requirements(course_id):
except (InvalidKeyError, ItemNotFoundError, InvalidCreditRequirements) as exc:
LOGGER.error('Error on adding the requirements for course %s - %s', course_id, str(exc))
raise update_credit_course_requirements.retry(args=[course_id], exc=exc)
- else:
- LOGGER.info('Requirements added for course %s', course_id)
+ LOGGER.info('Requirements added for course %s', course_id)
def _get_course_credit_requirements(course_key):
diff --git a/openedx/core/djangoapps/enrollments/data.py b/openedx/core/djangoapps/enrollments/data.py
index 9986830a3491..b76042f72c9d 100644
--- a/openedx/core/djangoapps/enrollments/data.py
+++ b/openedx/core/djangoapps/enrollments/data.py
@@ -341,8 +341,7 @@ def get_course_enrollment_info(course_id, include_expired=False):
msg = f"Requested enrollment information for unknown course {course_id}"
log.warning(msg)
raise CourseNotFoundError(msg) # lint-amnesty, pylint: disable=raise-missing-from
- else:
- return CourseSerializer(course, include_expired=include_expired).data
+ return CourseSerializer(course, include_expired=include_expired).data
def get_user_roles(username):
diff --git a/openedx/core/djangoapps/enrollments/tests/test_views.py b/openedx/core/djangoapps/enrollments/tests/test_views.py
index 2318904baf65..1c9d8e460085 100644
--- a/openedx/core/djangoapps/enrollments/tests/test_views.py
+++ b/openedx/core/djangoapps/enrollments/tests/test_views.py
@@ -1245,7 +1245,7 @@ def test_enrollment_with_global_staff_permissions(self, using_global_staff_user,
@httpretty.activate
@override_settings(ENTERPRISE_SERVICE_WORKER_USERNAME='enterprise_worker',
- FEATURES=dict(ENABLE_ENTERPRISE_INTEGRATION=True))
+ FEATURES={"ENABLE_ENTERPRISE_INTEGRATION": True})
@patch('openedx.features.enterprise_support.api.enterprise_customer_from_api')
def test_enterprise_course_enrollment_with_ec_uuid(self, mock_enterprise_customer_from_api):
"""Verify that the enrollment completes when the EnterpriseCourseEnrollment creation succeeds. """
diff --git a/openedx/core/djangoapps/geoinfo/middleware.py b/openedx/core/djangoapps/geoinfo/middleware.py
index ff9ed271bbd1..17d9c9e7bf02 100644
--- a/openedx/core/djangoapps/geoinfo/middleware.py
+++ b/openedx/core/djangoapps/geoinfo/middleware.py
@@ -37,7 +37,7 @@ def process_request(self, request):
old_ip_address = request.session.get('ip_address', None)
- if not new_ip_address and old_ip_address:
+ if not new_ip_address and old_ip_address: # pylint: disable=possibly-used-before-assignment
del request.session['ip_address']
del request.session['country_code']
elif new_ip_address != old_ip_address and new_ip_address_obj.is_global:
diff --git a/openedx/core/djangoapps/models/tests/test_course_details.py b/openedx/core/djangoapps/models/tests/test_course_details.py
index 41e739ecb4c8..09fafe8e9dea 100644
--- a/openedx/core/djangoapps/models/tests/test_course_details.py
+++ b/openedx/core/djangoapps/models/tests/test_course_details.py
@@ -51,9 +51,9 @@ def test_virgin_fetch(self, should_have_default_enroll_start):
assert details.start_date.tzinfo is not None
assert details.end_date is None, ('end date somehow initialized ' + str(details.end_date))
assert details.enrollment_start == course.enrollment_start, wrong_enrollment_start_msg
- assert details.enrollment_end is None,\
+ assert details.enrollment_end is None, \
('enrollment_end date somehow initialized ' + str(details.enrollment_end))
- assert details.certificate_available_date is None,\
+ assert details.certificate_available_date is None, \
('certificate_available_date date somehow initialized ' + str(details.certificate_available_date))
assert details.syllabus is None, ('syllabus somehow initialized' + str(details.syllabus))
assert details.intro_video is None, ('intro_video somehow initialized' + str(details.intro_video))
diff --git a/openedx/core/djangoapps/oauth_dispatch/management/commands/create_dot_application.py b/openedx/core/djangoapps/oauth_dispatch/management/commands/create_dot_application.py
index 4041b00e15ad..b2cc1842d49a 100644
--- a/openedx/core/djangoapps/oauth_dispatch/management/commands/create_dot_application.py
+++ b/openedx/core/djangoapps/oauth_dispatch/management/commands/create_dot_application.py
@@ -145,12 +145,12 @@ def handle(self, *args, **options):
client_id = options['client_id']
client_secret = options['client_secret']
- application_kwargs = dict(
- redirect_uris=redirect_uris,
- client_type=client_type,
- authorization_grant_type=grant_type,
- skip_authorization=skip_authorization
- )
+ application_kwargs = {
+ "redirect_uris": redirect_uris,
+ "client_type": client_type,
+ "authorization_grant_type": grant_type,
+ "skip_authorization": skip_authorization,
+ }
if client_id:
application_kwargs['client_id'] = client_id
if client_secret:
diff --git a/openedx/core/djangoapps/oauth_dispatch/management/commands/tests/test_generate_jwt_signing_key.py b/openedx/core/djangoapps/oauth_dispatch/management/commands/tests/test_generate_jwt_signing_key.py
index 75d45fe883b2..7344328978a8 100644
--- a/openedx/core/djangoapps/oauth_dispatch/management/commands/tests/test_generate_jwt_signing_key.py
+++ b/openedx/core/djangoapps/oauth_dispatch/management/commands/tests/test_generate_jwt_signing_key.py
@@ -72,13 +72,28 @@ def _assert_presence_of_key_id(self, mock_log, output_stream, provide_key_id, ke
assert len(key_id) == (key_id_size or 8)
@ddt.data(
- dict(add_previous_public_keys=True, provide_key_id=False, key_id_size=None, strip_key_prefix=True),
- dict(add_previous_public_keys=True, provide_key_id=False, key_id_size=16, strip_key_prefix=False),
- dict(add_previous_public_keys=False, provide_key_id=True, key_id_size=None, strip_key_prefix=False),
+ {
+ "add_previous_public_keys": True,
+ "provide_key_id": False,
+ "key_id_size": None,
+ "strip_key_prefix": True,
+ },
+ {
+ "add_previous_public_keys": True,
+ "provide_key_id": False,
+ "key_id_size": 16,
+ "strip_key_prefix": False,
+ },
+ {
+ "add_previous_public_keys": False,
+ "provide_key_id": True,
+ "key_id_size": None,
+ "strip_key_prefix": False,
+ },
)
@ddt.unpack
def test_command(self, add_previous_public_keys, provide_key_id, key_id_size, strip_key_prefix):
- command_options = dict(add_previous_public_keys=add_previous_public_keys)
+ command_options = {"add_previous_public_keys": add_previous_public_keys}
if provide_key_id:
command_options['key_id'] = TEST_KEY_IDENTIFIER
if key_id_size:
diff --git a/openedx/core/djangoapps/oauth_dispatch/tests/test_api.py b/openedx/core/djangoapps/oauth_dispatch/tests/test_api.py
index 3c064cc63c55..bb040f99823e 100644
--- a/openedx/core/djangoapps/oauth_dispatch/tests/test_api.py
+++ b/openedx/core/djangoapps/oauth_dispatch/tests/test_api.py
@@ -24,12 +24,12 @@ class TestOAuthDispatchAPI(TestCase):
""" Tests for oauth_dispatch's api.py module. """
def setUp(self):
super().setUp()
- self.adapter = DOTAdapter()
+ self.adapter = DOTAdapter() # pylint: disable=possibly-used-before-assignment
self.user = UserFactory()
self.client = self.adapter.create_public_client(
name='public app',
user=self.user,
- redirect_uri=DUMMY_REDIRECT_URL,
+ redirect_uri=DUMMY_REDIRECT_URL, # pylint: disable=possibly-used-before-assignment
client_id='public-client-id',
)
@@ -40,7 +40,7 @@ def _assert_stored_token(self, stored_token_value, expected_token_user, expected
assert stored_access_token.application.user.id == expected_client.user.id
def test_create_token_success(self):
- token = api.create_dot_access_token(HttpRequest(), self.user, self.client)
+ token = api.create_dot_access_token(HttpRequest(), self.user, self.client) # pylint: disable=possibly-used-before-assignment
assert token['access_token']
assert token['refresh_token']
self.assertDictContainsSubset(
diff --git a/openedx/core/djangoapps/oauth_dispatch/tests/test_dot_adapter.py b/openedx/core/djangoapps/oauth_dispatch/tests/test_dot_adapter.py
index ef30e6d3415d..edd12235c44e 100644
--- a/openedx/core/djangoapps/oauth_dispatch/tests/test_dot_adapter.py
+++ b/openedx/core/djangoapps/oauth_dispatch/tests/test_dot_adapter.py
@@ -30,12 +30,12 @@ class DOTAdapterTestCase(TestCase):
"""
def setUp(self):
super().setUp()
- self.adapter = DOTAdapter()
+ self.adapter = DOTAdapter() # pylint: disable=possibly-used-before-assignment
self.user = UserFactory()
self.public_client = self.adapter.create_public_client(
name='public app',
user=self.user,
- redirect_uri=DUMMY_REDIRECT_URL,
+ redirect_uri=DUMMY_REDIRECT_URL, # pylint: disable=possibly-used-before-assignment
client_id='public-client-id',
)
self.confidential_client = self.adapter.create_confidential_client(
@@ -47,10 +47,10 @@ def setUp(self):
self.restricted_client = self.adapter.create_confidential_client(
name='restricted app',
user=self.user,
- redirect_uri=DUMMY_REDIRECT_URL2,
+ redirect_uri=DUMMY_REDIRECT_URL2, # pylint: disable=possibly-used-before-assignment
client_id='restricted-client-id',
)
- self.restricted_app = RestrictedApplication.objects.create(application=self.restricted_client)
+ self.restricted_app = RestrictedApplication.objects.create(application=self.restricted_client) # pylint: disable=possibly-used-before-assignment
def test_restricted_app_unicode(self):
"""
diff --git a/openedx/core/djangoapps/oauth_dispatch/tests/test_dot_overrides.py b/openedx/core/djangoapps/oauth_dispatch/tests/test_dot_overrides.py
index 52a79615c29d..ebac7116fe1d 100644
--- a/openedx/core/djangoapps/oauth_dispatch/tests/test_dot_overrides.py
+++ b/openedx/core/djangoapps/oauth_dispatch/tests/test_dot_overrides.py
@@ -39,7 +39,7 @@ def setUp(self):
password=self.TEST_PASSWORD,
email='darkhelmet@spaceball_one.org',
)
- self.validator = EdxOAuth2Validator()
+ self.validator = EdxOAuth2Validator() # pylint: disable=possibly-used-before-assignment
def test_authenticate_with_username(self):
user = self.validator._authenticate(username='darkhelmet', password=self.TEST_PASSWORD)
@@ -115,7 +115,7 @@ class CustomAuthorizationViewTestCase(TestCase):
def setUp(self):
super().setUp()
self.TEST_PASSWORD = 'Password1234'
- self.dot_adapter = adapters.DOTAdapter()
+ self.dot_adapter = adapters.DOTAdapter() # pylint: disable=possibly-used-before-assignment
self.user = UserFactory(password=self.TEST_PASSWORD)
self.client.login(username=self.user.username, password=self.TEST_PASSWORD)
@@ -126,15 +126,15 @@ def _create_restricted_app(self): # lint-amnesty, pylint: disable=missing-funct
restricted_app = self.dot_adapter.create_confidential_client(
name='test restricted dot application',
user=self.user,
- redirect_uri=DUMMY_REDIRECT_URL,
+ redirect_uri=DUMMY_REDIRECT_URL, # pylint: disable=possibly-used-before-assignment
client_id='dot-restricted-app-client-id',
)
- models.RestrictedApplication.objects.create(application=restricted_app)
+ models.RestrictedApplication.objects.create(application=restricted_app) # pylint: disable=possibly-used-before-assignment
return restricted_app
def _create_expired_token(self, application):
date_in_the_past = timezone.now() + datetime.timedelta(days=-100)
- dot_models.AccessToken.objects.create(
+ dot_models.AccessToken.objects.create( # pylint: disable=possibly-used-before-assignment
user=self.user,
token='1234567890',
application=application,
diff --git a/openedx/core/djangoapps/oauth_dispatch/tests/test_jwt.py b/openedx/core/djangoapps/oauth_dispatch/tests/test_jwt.py
index da95fd072ded..4bde5bd4d48d 100644
--- a/openedx/core/djangoapps/oauth_dispatch/tests/test_jwt.py
+++ b/openedx/core/djangoapps/oauth_dispatch/tests/test_jwt.py
@@ -45,11 +45,13 @@ def _get_token_dict(self, client_restricted, oauth_adapter, grant_type=None):
client = self._create_client(oauth_adapter, client_restricted, grant_type=grant_type)
expires_in = 60 * 60
expires = now() + timedelta(seconds=expires_in)
- token_dict = dict(
- access_token=oauth_adapter.create_access_token_for_test('token', client, self.user, expires),
- expires_in=expires_in,
- scope=' '.join(self.default_scopes)
- )
+ token_dict = token_dict = {
+ "access_token": oauth_adapter.create_access_token_for_test(
+ "token", client, self.user, expires
+ ),
+ "expires_in": expires_in,
+ "scope": " ".join(self.default_scopes),
+ }
return token_dict
def _create_jwt_for_token(
diff --git a/openedx/core/djangoapps/oauth_dispatch/tests/test_views.py b/openedx/core/djangoapps/oauth_dispatch/tests/test_views.py
index ef03dab0ac8a..973a113de84e 100644
--- a/openedx/core/djangoapps/oauth_dispatch/tests/test_views.py
+++ b/openedx/core/djangoapps/oauth_dispatch/tests/test_views.py
@@ -85,16 +85,16 @@ class _DispatchingViewTestCase(TestCase):
def setUp(self):
super().setUp()
self.TEST_PASSWORD = 'Password1234'
- self.dot_adapter = adapters.DOTAdapter()
+ self.dot_adapter = adapters.DOTAdapter() # pylint: disable=possibly-used-before-assignment
self.user = UserFactory(password=self.TEST_PASSWORD)
self.dot_app = self.dot_adapter.create_public_client(
name='test dot application',
user=self.user,
- redirect_uri=DUMMY_REDIRECT_URL,
+ redirect_uri=DUMMY_REDIRECT_URL, # pylint: disable=possibly-used-before-assignment
client_id='dot-app-client-id',
)
- self.dot_app_access = models.ApplicationAccess.objects.create(
+ self.dot_app_access = models.ApplicationAccess.objects.create( # pylint: disable=possibly-used-before-assignment
application=self.dot_app,
scopes=['grades:read'],
)
@@ -133,7 +133,7 @@ class TestAccessTokenView(AccessTokenLoginMixin, mixins.AccessTokenMixin, _Dispa
def setUp(self):
super().setUp()
self.url = reverse('access_token')
- self.view_class = views.AccessTokenView
+ self.view_class = views.AccessTokenView # pylint: disable=possibly-used-before-assignment
def _post_body(self, user, client, token_type=None, scope=None, asymmetric_jwt=None):
"""
diff --git a/openedx/core/djangoapps/programs/tasks.py b/openedx/core/djangoapps/programs/tasks.py
index d3b4b867e4cd..681fed8a7bdb 100644
--- a/openedx/core/djangoapps/programs/tasks.py
+++ b/openedx/core/djangoapps/programs/tasks.py
@@ -790,5 +790,5 @@ def update_certificate_available_date_on_course_update(self, course_key):
new_certificate_available_date = None
update_credentials_course_certificate_configuration_available_date.delay(
- str(course_key), new_certificate_available_date
+ str(course_key), new_certificate_available_date # pylint: disable=possibly-used-before-assignment
)
diff --git a/openedx/core/djangoapps/programs/tests/test_signals.py b/openedx/core/djangoapps/programs/tests/test_signals.py
index fae9b1dff22a..b57fbc99bc91 100644
--- a/openedx/core/djangoapps/programs/tests/test_signals.py
+++ b/openedx/core/djangoapps/programs/tests/test_signals.py
@@ -48,13 +48,13 @@ def signal_kwargs(self):
"""
DRY helper.
"""
- return dict(
- sender=self.__class__,
- user=UserFactory.create(username=TEST_USERNAME),
- course_key=TEST_COURSE_KEY,
- mode="test-mode",
- status="test-status",
- )
+ return {
+ "sender": self.__class__,
+ "user": UserFactory.create(username=TEST_USERNAME),
+ "course_key": TEST_COURSE_KEY,
+ "mode": "test-mode",
+ "status": "test-status",
+ }
def test_signal_received(self, mock_is_learner_issuance_enabled, mock_task): # pylint: disable=unused-argument
"""
@@ -113,13 +113,13 @@ def signal_kwargs(self):
"""
DRY helper.
"""
- return dict(
- sender=self.__class__,
- user=self.user,
- course_key=TEST_COURSE_KEY,
- mode="test-mode",
- status="test-status",
- )
+ return {
+ "sender": self.__class__,
+ "user": self.user,
+ "course_key": TEST_COURSE_KEY,
+ "mode": "test-mode",
+ "status": "test-status",
+ }
def test_signal_received(self, mock_is_learner_issuance_enabled, mock_task): # pylint: disable=unused-argument
"""
@@ -190,13 +190,13 @@ def signal_kwargs(self):
"""
DRY helper.
"""
- return dict(
- sender=self.__class__,
- user=UserFactory.create(username=TEST_USERNAME),
- course_key=TEST_COURSE_KEY,
- mode="test-mode",
- status="test-status",
- )
+ return {
+ "sender": self.__class__,
+ "user": UserFactory.create(username=TEST_USERNAME),
+ "course_key": TEST_COURSE_KEY,
+ "mode": "test-mode",
+ "status": "test-status",
+ }
def test_signal_received(self, mock_is_learner_issuance_enabled, mock_task): # pylint: disable=unused-argument
"""
diff --git a/openedx/core/djangoapps/programs/utils.py b/openedx/core/djangoapps/programs/utils.py
index 95044a6faeff..f26be5589d56 100644
--- a/openedx/core/djangoapps/programs/utils.py
+++ b/openedx/core/djangoapps/programs/utils.py
@@ -755,14 +755,18 @@ def _collect_one_click_purchase_eligibility_data(self): # lint-amnesty, pylint:
if is_anonymous or ALWAYS_CALCULATE_PROGRAM_PRICE_AS_ANONYMOUS_USER.is_enabled():
# The bundle uuid is necessary to see the program's discounted price
if bundle_uuid:
- params = dict(sku=skus, is_anonymous=True, bundle=bundle_uuid)
+ params = {"sku": skus, "is_anonymous": True, "bundle": bundle_uuid}
else:
- params = dict(sku=skus, is_anonymous=True)
+ params = {"sku": skus, "is_anonymous": True}
else:
if bundle_uuid:
- params = dict(sku=skus, username=self.user.username, bundle=bundle_uuid)
+ params = {
+ "sku": skus,
+ "username": self.user.username,
+ "bundle": bundle_uuid,
+ }
else:
- params = dict(sku=skus, username=self.user.username)
+ params = {"sku": skus, "username": self.user.username}
response = api_client.get(api_url, params=params)
response.raise_for_status()
discount_data = response.json()
diff --git a/openedx/core/djangoapps/safe_sessions/middleware.py b/openedx/core/djangoapps/safe_sessions/middleware.py
index f3948217efd9..3e0948b0a2cc 100644
--- a/openedx/core/djangoapps/safe_sessions/middleware.py
+++ b/openedx/core/djangoapps/safe_sessions/middleware.py
@@ -244,14 +244,14 @@ def parse(cls, safe_cookie_string):
raise SafeCookieError( # lint-amnesty, pylint: disable=raise-missing-from
f"SafeCookieData BWC parse error: {safe_cookie_string!r}."
)
- else:
- if safe_cookie_data.version != cls.CURRENT_VERSION:
- raise SafeCookieError(
- "SafeCookieData version {!r} is not supported. Current version is {}.".format(
- safe_cookie_data.version,
- cls.CURRENT_VERSION,
- ))
- return safe_cookie_data
+
+ if safe_cookie_data.version != cls.CURRENT_VERSION:
+ raise SafeCookieError(
+ "SafeCookieData version {!r} is not supported. Current version is {}.".format(
+ safe_cookie_data.version,
+ cls.CURRENT_VERSION,
+ ))
+ return safe_cookie_data
def __str__(self):
"""
diff --git a/openedx/core/djangoapps/schedules/management/commands/tests/send_email_base.py b/openedx/core/djangoapps/schedules/management/commands/tests/send_email_base.py
index 774f1f418124..77dad3b9cc8b 100644
--- a/openedx/core/djangoapps/schedules/management/commands/tests/send_email_base.py
+++ b/openedx/core/djangoapps/schedules/management/commands/tests/send_email_base.py
@@ -221,9 +221,12 @@ def test_schedule_bin(self, schedule_count, mock_attribute, mock_ace):
is_first_match = False
with self.assertNumQueries(expected_queries, table_ignorelist=WAFFLE_TABLES):
- self.task().apply(kwargs=dict(
- site_id=self.site_config.site.id, target_day_str=target_day_str, day_offset=offset, bin_num=b,
- ))
+ self.task().apply(kwargs={
+ "site_id": self.site_config.site.id,
+ "target_day_str": target_day_str,
+ "day_offset": offset,
+ "bin_num": b,
+ })
num_schedules = mock_attribute.call_args[0][1]
if b in bins_in_use:
@@ -245,12 +248,12 @@ def test_no_course_overview(self):
with patch.object(self.task, 'async_send_task') as mock_schedule_send:
for bin_num in range(self.task().num_bins):
- self.task().apply(kwargs=dict(
- site_id=self.site_config.site.id,
- target_day_str=serialize(target_day),
- day_offset=offset,
- bin_num=bin_num,
- ))
+ self.task().apply(kwargs={
+ "site_id": self.site_config.site.id,
+ "target_day_str": serialize(target_day),
+ "day_offset": offset,
+ "bin_num": bin_num,
+ })
# There is no database constraint that enforces that enrollment.course_id points
# to a valid CourseOverview object. However, in that case, schedules isn't going
@@ -333,9 +336,12 @@ def test_site_config(self, this_org_list, other_org_list, expected_message_count
)
with patch.object(self.task, 'async_send_task') as mock_schedule_send:
- self.task().apply(kwargs=dict(
- site_id=this_config.site.id, target_day_str=serialize(target_day), day_offset=offset, bin_num=0
- ))
+ self.task().apply(kwargs={
+ "site_id": this_config.site.id,
+ "target_day_str": serialize(target_day),
+ "day_offset": offset,
+ "bin_num": 0,
+ })
assert mock_schedule_send.apply_async.call_count == expected_message_count
assert not mock_ace.send.called
@@ -353,9 +359,12 @@ def test_course_end(self, has_course_ended):
)
with patch.object(self.task, 'async_send_task') as mock_schedule_send:
- self.task().apply(kwargs=dict(
- site_id=self.site_config.site.id, target_day_str=serialize(target_day), day_offset=offset, bin_num=0,
- ))
+ self.task().apply(kwargs={
+ "site_id": self.site_config.site.id,
+ "target_day_str": serialize(target_day),
+ "day_offset": offset,
+ "bin_num": 0,
+ })
if has_course_ended:
assert not mock_schedule_send.apply_async.called
@@ -379,10 +388,12 @@ def test_multiple_target_schedules(self, mock_ace):
expected_query_count = NUM_QUERIES_FIRST_MATCH + additional_course_queries
with self.assertNumQueries(expected_query_count, table_ignorelist=WAFFLE_TABLES):
with patch.object(self.task, 'async_send_task') as mock_schedule_send:
- self.task().apply(kwargs=dict(
- site_id=self.site_config.site.id, target_day_str=serialize(target_day), day_offset=offset,
- bin_num=self._calculate_bin_for_user(user),
- ))
+ self.task().apply(kwargs={
+ "site_id": self.site_config.site.id,
+ "target_day_str": serialize(target_day),
+ "day_offset": offset,
+ "bin_num": self._calculate_bin_for_user(user),
+ })
expected_call_count = 1 if self.consolidates_emails_for_learner else num_courses
assert mock_schedule_send.apply_async.call_count == expected_call_count
@@ -432,10 +443,12 @@ def _assert_template_for_offset(self, offset, message_count): # lint-amnesty, p
num_expected_queries += 1
with self.assertNumQueries(num_expected_queries, table_ignorelist=WAFFLE_TABLES):
- self.task().apply(kwargs=dict(
- site_id=self.site_config.site.id, target_day_str=serialize(target_day), day_offset=offset,
- bin_num=self._calculate_bin_for_user(user),
- ))
+ self.task().apply(kwargs={
+ "site_id": self.site_config.site.id,
+ "target_day_str": serialize(target_day),
+ "day_offset": offset,
+ "bin_num": self._calculate_bin_for_user(user),
+ })
num_expected_messages = 1 if self.consolidates_emails_for_learner else message_count
assert len(sent_messages) == num_expected_messages
@@ -467,10 +480,12 @@ def _check_if_email_sent_for_experience(self, test_config): # lint-amnesty, pyl
schedule = self._schedule_factory(**kwargs)
with patch.object(tasks, 'ace') as mock_ace:
- self.task().apply(kwargs=dict(
- site_id=self.site_config.site.id, target_day_str=serialize(target_day), day_offset=offset,
- bin_num=self._calculate_bin_for_user(schedule.enrollment.user),
- ))
+ self.task().apply(kwargs={
+ "site_id": self.site_config.site.id,
+ "target_day_str": serialize(target_day),
+ "day_offset": offset,
+ "bin_num": self._calculate_bin_for_user(schedule.enrollment.user),
+ })
assert mock_ace.send.called == test_config.email_sent
diff --git a/openedx/core/djangoapps/schedules/management/commands/tests/test_send_course_update.py b/openedx/core/djangoapps/schedules/management/commands/tests/test_send_course_update.py
index 72e68b042012..288c16fd7249 100644
--- a/openedx/core/djangoapps/schedules/management/commands/tests/test_send_course_update.py
+++ b/openedx/core/djangoapps/schedules/management/commands/tests/test_send_course_update.py
@@ -96,12 +96,12 @@ def test_with_course_data(self):
offset, target_day, enrollment = self.prepare_course_data()
with patch.object(tasks, 'ace') as mock_ace:
- self.task().apply(kwargs=dict(
- site_id=self.site_config.site.id,
- target_day_str=serialize(target_day),
- day_offset=offset,
- bin_num=self._calculate_bin_for_user(enrollment.user),
- ))
+ self.task().apply(kwargs={
+ "site_id": self.site_config.site.id,
+ "target_day_str": serialize(target_day),
+ "day_offset": offset,
+ "bin_num": self._calculate_bin_for_user(enrollment.user),
+ })
assert mock_ace.send.called
@@ -112,10 +112,10 @@ def test_template_for_instructor_led_courses(self):
"""
offset, target_day, enrollment = self.prepare_course_data(is_self_paced=False)
- self.task().apply(kwargs=dict(
- site_id=self.site_config.site.id,
- target_day_str=serialize(target_day),
- day_offset=offset,
- bin_num=self._calculate_bin_for_user(enrollment.user),
- ))
+ self.task().apply(kwargs={
+ "site_id": self.site_config.site.id,
+ "target_day_str": serialize(target_day),
+ "day_offset": offset,
+ "bin_num": self._calculate_bin_for_user(enrollment.user),
+ })
assert f'{enrollment.course.display_name} Weekly Update' == mail.outbox[0].subject
diff --git a/openedx/core/djangoapps/schedules/management/commands/tests/test_send_upgrade_reminder.py b/openedx/core/djangoapps/schedules/management/commands/tests/test_send_upgrade_reminder.py
index 86e782a13283..5cd232316429 100644
--- a/openedx/core/djangoapps/schedules/management/commands/tests/test_send_upgrade_reminder.py
+++ b/openedx/core/djangoapps/schedules/management/commands/tests/test_send_upgrade_reminder.py
@@ -53,10 +53,12 @@ def test_verified_learner(self, is_verified, mock_ace):
enrollment__mode=CourseMode.VERIFIED if is_verified else CourseMode.AUDIT,
)
- self.task().apply(kwargs=dict(
- site_id=self.site_config.site.id, target_day_str=serialize(target_day), day_offset=offset,
- bin_num=self._calculate_bin_for_user(schedule.enrollment.user),
- ))
+ self.task().apply(kwargs={
+ "site_id": self.site_config.site.id,
+ "target_day_str": serialize(target_day),
+ "day_offset": offset,
+ "bin_num": self._calculate_bin_for_user(schedule.enrollment.user),
+ })
assert mock_ace.send.called == (not is_verified)
@@ -77,10 +79,12 @@ def test_filter_out_verified_schedules(self):
with patch.object(self.task, 'async_send_task') as mock_schedule_send:
mock_schedule_send.apply_async = lambda args, *_a, **_kw: sent_messages.append(args[1])
- self.task().apply(kwargs=dict(
- site_id=self.site_config.site.id, target_day_str=serialize(target_day), day_offset=offset,
- bin_num=self._calculate_bin_for_user(user),
- ))
+ self.task().apply(kwargs={
+ "site_id": self.site_config.site.id,
+ "target_day_str": serialize(target_day),
+ "day_offset": offset,
+ "bin_num": self._calculate_bin_for_user(user),
+ })
messages = [Message.from_string(m) for m in sent_messages]
assert len(messages) == 1
@@ -96,10 +100,13 @@ def test_course_without_verified_mode(self, mock_ace):
schedule = self._schedule_factory()
schedule.enrollment.course.modes.filter(mode_slug=CourseMode.VERIFIED).delete()
- self.task().apply(kwargs=dict(
- site_id=self.site_config.site.id, target_day_str=serialize(target_day), day_offset=offset,
- bin_num=self._calculate_bin_for_user(schedule.enrollment.user),
- ))
+ self.task().apply(kwargs={
+ "site_id": self.site_config.site.id,
+ "target_day_str": serialize(target_day),
+ "day_offset": offset,
+ "bin_num": self._calculate_bin_for_user(schedule.enrollment.user),
+ })
+
assert mock_ace.send.called is False
@ddt.data(
diff --git a/openedx/core/djangoapps/schedules/management/commands/tests/upsell_base.py b/openedx/core/djangoapps/schedules/management/commands/tests/upsell_base.py
index 9b199e5ed189..c84e0735e582 100644
--- a/openedx/core/djangoapps/schedules/management/commands/tests/upsell_base.py
+++ b/openedx/core/djangoapps/schedules/management/commands/tests/upsell_base.py
@@ -45,10 +45,12 @@ def _send_message_task(self, schedule, offset, target_day):
sent_messages = []
with patch.object(self.task, 'async_send_task') as mock_schedule_send:
mock_schedule_send.apply_async = lambda args, *_a, **_kw: sent_messages.append(args[1])
- self.task().apply(kwargs=dict(
- site_id=self.site_config.site.id, target_day_str=serialize(target_day), day_offset=offset,
- bin_num=self._calculate_bin_for_user(schedule.enrollment.user),
- ))
+ self.task().apply(kwargs={
+ "site_id": self.site_config.site.id,
+ "target_day_str": serialize(target_day),
+ "day_offset": offset,
+ "bin_num": self._calculate_bin_for_user(schedule.enrollment.user),
+ })
assert len(sent_messages) == 1
return Message.from_string(sent_messages[0])
diff --git a/openedx/core/djangoapps/schedules/signals.py b/openedx/core/djangoapps/schedules/signals.py
index c88119d83f34..4ff9fd4b74ea 100644
--- a/openedx/core/djangoapps/schedules/signals.py
+++ b/openedx/core/djangoapps/schedules/signals.py
@@ -66,11 +66,11 @@ def update_schedules_on_course_start_changed(sender, updated_course_overview, pr
content_availability_date=updated_course_overview.start,
)
update_course_schedules.apply_async(
- kwargs=dict(
- course_id=str(updated_course_overview.id),
- new_start_date_str=date.serialize(updated_course_overview.start),
- new_upgrade_deadline_str=date.serialize(upgrade_deadline),
- ),
+ kwargs={
+ "course_id": str(updated_course_overview.id),
+ "new_start_date_str": date.serialize(updated_course_overview.start),
+ "new_upgrade_deadline_str": date.serialize(upgrade_deadline),
+ },
)
diff --git a/openedx/core/djangoapps/schedules/tasks.py b/openedx/core/djangoapps/schedules/tasks.py
index 55288d63f1a8..aee1a397bd18 100644
--- a/openedx/core/djangoapps/schedules/tasks.py
+++ b/openedx/core/djangoapps/schedules/tasks.py
@@ -233,7 +233,7 @@ class ScheduleCourseNextSectionUpdate(ScheduleMessageBaseTask): # lint-amnesty,
@classmethod
def enqueue(cls, site, current_date, day_offset, override_recipient_email=None): # lint-amnesty, pylint: disable=missing-function-docstring
set_code_owner_attribute_from_module(__name__)
- target_datetime = (current_date - datetime.timedelta(days=day_offset))
+ target_datetime = current_date - datetime.timedelta(days=day_offset)
if not cls.is_enqueue_enabled(site):
cls.log_info('Message queuing disabled for site %s', site.domain)
diff --git a/openedx/core/djangoapps/user_api/accounts/api.py b/openedx/core/djangoapps/user_api/accounts/api.py
index 6cc466ba0038..ee31f10e28fe 100644
--- a/openedx/core/djangoapps/user_api/accounts/api.py
+++ b/openedx/core/djangoapps/user_api/accounts/api.py
@@ -309,7 +309,7 @@ def _does_name_change_require_verification(user_profile, old_name, new_name):
# at least one seat.
has_verified_enrollments = len(get_verified_enrollments(user.username)) > 0
- validator = NameChangeValidator(old_names_list, num_passing_certs, old_name, new_name)
+ validator = NameChangeValidator(old_names_list, num_passing_certs, old_name, new_name) # pylint: disable=possibly-used-before-assignment
return not validator.validate() and has_verified_enrollments
diff --git a/openedx/core/djangoapps/user_api/accounts/tests/test_api.py b/openedx/core/djangoapps/user_api/accounts/tests/test_api.py
index 5123c4cf41c2..3de2f3c2effe 100644
--- a/openedx/core/djangoapps/user_api/accounts/tests/test_api.py
+++ b/openedx/core/djangoapps/user_api/accounts/tests/test_api.py
@@ -177,7 +177,7 @@ def test_get_empty_social_links(self):
def test_set_single_social_link(self):
social_links = [
- dict(platform="facebook", social_link=f"https://www.facebook.com/{self.user.username}")
+ {"platform": "facebook", "social_link": f"https://www.facebook.com/{self.user.username}"},
]
update_account_settings(self.user, {"social_links": social_links})
account_settings = get_account_settings(self.default_request)[0]
@@ -185,8 +185,8 @@ def test_set_single_social_link(self):
def test_set_multiple_social_links(self):
social_links = [
- dict(platform="facebook", social_link=f"https://www.facebook.com/{self.user.username}"),
- dict(platform="twitter", social_link=f"https://www.twitter.com/{self.user.username}"),
+ {"platform": "facebook", "social_link": f"https://www.facebook.com/{self.user.username}"},
+ {"platform": "twitter", "social_link": f"https://www.twitter.com/{self.user.username}"},
]
update_account_settings(self.user, {"social_links": social_links})
account_settings = get_account_settings(self.default_request)[0]
@@ -194,37 +194,37 @@ def test_set_multiple_social_links(self):
def test_add_social_links(self):
original_social_links = [
- dict(platform="facebook", social_link=f"https://www.facebook.com/{self.user.username}")
+ {"platform": "facebook", "social_link": f"https://www.facebook.com/{self.user.username}"}
]
update_account_settings(self.user, {"social_links": original_social_links})
extra_social_links = [
- dict(platform="twitter", social_link=f"https://www.twitter.com/{self.user.username}"),
- dict(platform="linkedin", social_link=f"https://www.linkedin.com/in/{self.user.username}"),
+ {"platform": "twitter", "social_link": f"https://www.twitter.com/{self.user.username}"},
+ {"platform": "linkedin", "social_link": f"https://www.linkedin.com/in/{self.user.username}"},
]
update_account_settings(self.user, {"social_links": extra_social_links})
account_settings = get_account_settings(self.default_request)[0]
assert account_settings['social_links'] == \
- sorted((original_social_links + extra_social_links), key=(lambda s: s['platform']))
+ sorted((original_social_links + extra_social_links), key=lambda s: s['platform'])
def test_replace_social_links(self):
- original_facebook_link = dict(platform="facebook", social_link="https://www.facebook.com/myself")
- original_twitter_link = dict(platform="twitter", social_link="https://www.twitter.com/myself")
+ original_facebook_link = {"platform": 'facebook', "social_link": 'https://www.facebook.com/myself'}
+ original_twitter_link = {"platform": 'twitter', "social_link": 'https://www.twitter.com/myself'}
update_account_settings(self.user, {"social_links": [original_facebook_link, original_twitter_link]})
- modified_facebook_link = dict(platform="facebook", social_link="https://www.facebook.com/new_me")
+ modified_facebook_link = {"platform": 'facebook', "social_link": 'https://www.facebook.com/new_me'}
update_account_settings(self.user, {"social_links": [modified_facebook_link]})
account_settings = get_account_settings(self.default_request)[0]
assert account_settings['social_links'] == [modified_facebook_link, original_twitter_link]
def test_remove_social_link(self):
- original_facebook_link = dict(platform="facebook", social_link="https://www.facebook.com/myself")
- original_twitter_link = dict(platform="twitter", social_link="https://www.twitter.com/myself")
+ original_facebook_link = {"platform": 'facebook', "social_link": 'https://www.facebook.com/myself'}
+ original_twitter_link = {"platform": 'twitter', "social_link": 'https://www.twitter.com/myself'}
update_account_settings(self.user, {"social_links": [original_facebook_link, original_twitter_link]})
- removed_facebook_link = dict(platform="facebook", social_link="")
+ removed_facebook_link = {"platform": 'facebook', "social_link": ''}
update_account_settings(self.user, {"social_links": [removed_facebook_link]})
account_settings = get_account_settings(self.default_request)[0]
@@ -232,7 +232,7 @@ def test_remove_social_link(self):
def test_unsupported_social_link_platform(self):
social_links = [
- dict(platform="unsupported", social_link=f"https://www.unsupported.com/{self.user.username}")
+ {"platform": "unsupported", "social_link": f"https://www.unsupported.com/{self.user.username}"}
]
with pytest.raises(AccountValidationError):
update_account_settings(self.user, {"social_links": social_links})
@@ -459,7 +459,7 @@ def test_update_sending_email_fails(self, send_mail):
account_settings = get_account_settings(self.default_request)[0]
assert 'Mickey Mouse' == account_settings['name']
- @patch.dict(settings.FEATURES, dict(ALLOW_EMAIL_ADDRESS_CHANGE=False))
+ @patch.dict(settings.FEATURES, {"ALLOW_EMAIL_ADDRESS_CHANGE": False})
def test_email_changes_disabled(self):
"""
Test that email address changes are rejected when ALLOW_EMAIL_ADDRESS_CHANGE is not set.
@@ -470,7 +470,7 @@ def test_email_changes_disabled(self):
update_account_settings(self.user, disabled_update)
assert 'Email address changes have been disabled' in context_manager.value.developer_message
- @patch.dict(settings.FEATURES, dict(ALLOW_EMAIL_ADDRESS_CHANGE=True))
+ @patch.dict(settings.FEATURES, {"ALLOW_EMAIL_ADDRESS_CHANGE": True})
def test_email_changes_blocked_on_retired_email(self):
"""
Test that email address changes are rejected when an email associated with a *partially* retired account is
diff --git a/openedx/core/djangoapps/user_api/management/commands/bulk_user_org_email_optout.py b/openedx/core/djangoapps/user_api/management/commands/bulk_user_org_email_optout.py
index e465ff5610ed..5c873a88eee6 100644
--- a/openedx/core/djangoapps/user_api/management/commands/bulk_user_org_email_optout.py
+++ b/openedx/core/djangoapps/user_api/management/commands/bulk_user_org_email_optout.py
@@ -135,11 +135,11 @@ def handle(self, *args, **options):
optout_rows[end_idx][0], optout_rows[end_idx][1],
str(err))
raise
- else:
- cursor.execute('COMMIT;')
- log.info("Committed opt-out for rows (%s, %s) through (%s, %s).",
- optout_rows[start_idx][0], optout_rows[start_idx][1],
- optout_rows[end_idx][0], optout_rows[end_idx][1])
+
+ cursor.execute('COMMIT;')
+ log.info("Committed opt-out for rows (%s, %s) through (%s, %s).",
+ optout_rows[start_idx][0], optout_rows[start_idx][1],
+ optout_rows[end_idx][0], optout_rows[end_idx][1])
log.info("Sleeping %s seconds...", sleep_between)
time.sleep(sleep_between)
curr_row_idx += chunk_size
diff --git a/openedx/core/djangoapps/user_api/management/tests/test_email_opt_in_list.py b/openedx/core/djangoapps/user_api/management/tests/test_email_opt_in_list.py
index b32a8f723d5e..ceb028921eff 100644
--- a/openedx/core/djangoapps/user_api/management/tests/test_email_opt_in_list.py
+++ b/openedx/core/djangoapps/user_api/management/tests/test_email_opt_in_list.py
@@ -270,7 +270,7 @@ def test_not_enough_args(self, num_args):
expected_msg_regex = (
"^Error: the following arguments are required: OUTPUT_FILENAME, ORG_ALIASES$"
)
- with self.assertRaisesRegex(CommandError, expected_msg_regex):
+ with self.assertRaisesRegex(CommandError, expected_msg_regex): # pylint: disable=possibly-used-before-assignment
call_command('email_opt_in_list', *args)
def test_file_already_exists(self):
diff --git a/openedx/core/djangoapps/user_api/middleware.py b/openedx/core/djangoapps/user_api/middleware.py
index 95bb3d568db6..636cc1dcefd1 100644
--- a/openedx/core/djangoapps/user_api/middleware.py
+++ b/openedx/core/djangoapps/user_api/middleware.py
@@ -41,7 +41,7 @@ def process_request(self, request):
context['course_user_tags'] = dict(
UserCourseTag.objects.filter(
user=request.user.pk,
- course_id=course_key,
+ course_id=course_key, # pylint: disable=possibly-used-before-assignment
).values_list('key', 'value')
)
else:
diff --git a/openedx/core/djangoapps/user_authn/tests/utils.py b/openedx/core/djangoapps/user_authn/tests/utils.py
index 09ca85145f35..363f9441fbe9 100644
--- a/openedx/core/djangoapps/user_authn/tests/utils.py
+++ b/openedx/core/djangoapps/user_authn/tests/utils.py
@@ -91,7 +91,7 @@ def get_response(self, auth_type, requesting_user=None, requested_user=None, url
token = self._create_jwt_token(requesting_user, auth_type)
auth_header = f"JWT {token}"
- extra = dict(HTTP_AUTHORIZATION=auth_header) if auth_header else {}
+ extra = {"HTTP_AUTHORIZATION": auth_header} if auth_header else {}
return self.client.get(
url if url else self.get_url(requested_user.username),
**extra
diff --git a/openedx/core/djangoapps/util/user_messages.py b/openedx/core/djangoapps/util/user_messages.py
index 2b6962f39f55..e8744557c0bd 100644
--- a/openedx/core/djangoapps/util/user_messages.py
+++ b/openedx/core/djangoapps/util/user_messages.py
@@ -224,7 +224,7 @@ def user_messages(cls, request):
notice_type = getattr(UserMessageType, notice_type_str, UserMessageType.INFO)
msgs.append(UserMessage(
- type=notice_type,
+ type=notice_type, # pylint: disable=possibly-used-before-assignment
message_html=str(cls.get_message_html(Text(notice_message))),
))
except BaseException as e:
diff --git a/openedx/core/djangoapps/waffle_utils/views.py b/openedx/core/djangoapps/waffle_utils/views.py
index a630976210f9..b1d0f84f3281 100644
--- a/openedx/core/djangoapps/waffle_utils/views.py
+++ b/openedx/core/djangoapps/waffle_utils/views.py
@@ -138,7 +138,7 @@ def _get_flag_overrides(course_or_org: FlagOverride):
one_override = flag_overrides.setdefault(
override.waffle_flag, OrderedDict()
).setdefault(
- override_match_val, OrderedDict()
+ override_match_val, OrderedDict() # pylint: disable=possibly-used-before-assignment
)
# data is reverse ordered by date, so the first record is the current record
if override_key not in one_override:
diff --git a/openedx/core/djangoapps/xblock/apps.py b/openedx/core/djangoapps/xblock/apps.py
index e4f07666c35e..300c7a0165b5 100644
--- a/openedx/core/djangoapps/xblock/apps.py
+++ b/openedx/core/djangoapps/xblock/apps.py
@@ -48,10 +48,10 @@ def get_runtime_params(self):
Get the LearningCoreXBlockRuntime parameters appropriate for viewing and/or
editing XBlock content in the LMS
"""
- return dict(
- student_data_mode=StudentDataMode.Persisted,
- authored_data_mode=AuthoredDataMode.STRICTLY_PUBLISHED,
- )
+ return {
+ "student_data_mode": StudentDataMode.Persisted,
+ "authored_data_mode": AuthoredDataMode.STRICTLY_PUBLISHED
+ }
def get_site_root_url(self):
"""
@@ -71,10 +71,7 @@ def get_runtime_params(self):
Get the LearningCoreXBlockRuntime parameters appropriate for viewing and/or
editing XBlock content in Studio
"""
- return dict(
- student_data_mode=StudentDataMode.Ephemeral,
- authored_data_mode=AuthoredDataMode.DEFAULT_DRAFT,
- )
+ return {"student_data_mode": StudentDataMode.Ephemeral, "authored_data_mode": AuthoredDataMode.DEFAULT_DRAFT}
def get_site_root_url(self):
"""
diff --git a/openedx/core/lib/api/view_utils.py b/openedx/core/lib/api/view_utils.py
index 054755ae3cc1..d876e49ae579 100644
--- a/openedx/core/lib/api/view_utils.py
+++ b/openedx/core/lib/api/view_utils.py
@@ -265,8 +265,7 @@ def __len__(self):
def __iter__(self):
# Yield all the known data first
- for item in self._data:
- yield item
+ yield from self._data
# Capture and yield data from the underlying iterator
# until it is exhausted
diff --git a/openedx/core/lib/celery/task_utils.py b/openedx/core/lib/celery/task_utils.py
index 738f074be68c..b19caf16142d 100644
--- a/openedx/core/lib/celery/task_utils.py
+++ b/openedx/core/lib/celery/task_utils.py
@@ -50,9 +50,9 @@ def emulate_http_request(site=None, user=None, middleware_classes=None):
for middleware in reversed(middleware_instances):
_run_method_if_implemented(middleware, 'process_exception', request, exc)
raise
- else:
- for middleware in reversed(middleware_instances):
- _run_method_if_implemented(middleware, 'process_response', request, response)
+
+ for middleware in reversed(middleware_instances):
+ _run_method_if_implemented(middleware, 'process_response', request, response)
def _run_method_if_implemented(instance, method_name, *args, **kwargs):
diff --git a/openedx/core/lib/extract_archive.py b/openedx/core/lib/extract_archive.py
index 4706e0caffb7..9f55291e863f 100644
--- a/openedx/core/lib/extract_archive.py
+++ b/openedx/core/lib/extract_archive.py
@@ -81,7 +81,7 @@ def _checkmembers(members: Union[List[ZipInfo], List[TarInfo]], base: str):
elif isinstance(finfo, TarInfo):
filename = finfo.name
_check_tarinfo(finfo, base)
- if _is_bad_path(filename, base):
+ if _is_bad_path(filename, base): # pylint: disable=possibly-used-before-assignment
log.debug("File %r is blocked (illegal path)", filename)
raise SuspiciousOperation("Illegal path")
diff --git a/openedx/core/lib/tests/test_graph_traversals.py b/openedx/core/lib/tests/test_graph_traversals.py
index 47996ccde372..880ba67dbae8 100644
--- a/openedx/core/lib/tests/test_graph_traversals.py
+++ b/openedx/core/lib/tests/test_graph_traversals.py
@@ -71,25 +71,25 @@ def get_child_to_parents_map(parent_to_children_map):
def test_pre_order(self):
assert list(
traverse_pre_order(start_node='b1',
- get_children=(lambda node: self.parent_to_children_map[node]),
- filter_func=(lambda node: (node != 'd3')))
+ get_children=lambda node: self.parent_to_children_map[node],
+ filter_func=lambda node: (node != 'd3'))
) == ['b1', 'c1', 'd1', 'e1', 'd2', 'e2', 'f1', 'c2']
def test_post_order(self):
assert list(
traverse_post_order(
start_node='b1',
- get_children=(lambda node: self.parent_to_children_map[node]),
- filter_func=(lambda node: (node != 'd3')))
+ get_children=lambda node: self.parent_to_children_map[node],
+ filter_func=lambda node: (node != 'd3'))
) == ['e1', 'd1', 'f1', 'e2', 'd2', 'c1', 'c2', 'b1']
def test_topological(self):
assert list(
traverse_topologically(
start_node='b1',
- get_children=(lambda node: self.parent_to_children_map[node]),
- get_parents=(lambda node: self.child_to_parents_map[node]),
- filter_func=(lambda node: (node != 'd3')))
+ get_children=lambda node: self.parent_to_children_map[node],
+ get_parents=lambda node: self.child_to_parents_map[node],
+ filter_func=lambda node: (node != 'd3'))
) == ['b1', 'c1', 'd1', 'd2', 'e1', 'e2', 'f1', 'c2']
def test_topological_yield_descendants(self):
@@ -164,6 +164,6 @@ def test_topological_complex(self):
assert list(
traverse_topologically(
start_node='root',
- get_children=(lambda node: parent_to_children[node]),
- get_parents=(lambda node: child_to_parents[node]))
+ get_children=lambda node: parent_to_children[node],
+ get_parents=lambda node: child_to_parents[node])
) == ['root', 'A', 'D', 'B', 'E', 'F', 'J', 'K', 'M', 'N', 'G', 'C', 'H', 'L', 'O', 'P', 'I']
diff --git a/openedx/core/lib/tests/test_teams_config.py b/openedx/core/lib/tests/test_teams_config.py
index c983e841c50c..68a866cdfba8 100644
--- a/openedx/core/lib/tests/test_teams_config.py
+++ b/openedx/core/lib/tests/test_teams_config.py
@@ -152,23 +152,21 @@ def test_disabled_team_configs(self, data):
"team_sets": [],
}
INPUT_DATA_4 = {
- "team_sets": [dict(id="test-teamset", name="test", description="test")]
+ "team_sets": [{"id": 'test-teamset', "name": 'test', "description": 'test'}]
}
OUTPUT_DATA_4 = {
# If teamsets are provided, but a value for "enabled" isn't, then the presence of teamsets indicates that
# teams should be considered enabled, and the "enabled" field should be set to True.
"enabled": True,
"max_team_size": DEFAULT_COURSE_RUN_MAX_TEAM_SIZE,
- "team_sets": [
- dict(
- id="test-teamset",
- name="test",
- description="test",
- type="open",
- max_team_size=None,
- user_partition_id=None
- ),
- ],
+ "team_sets": [{
+ "id": "test-teamset",
+ "name": "test",
+ "description": "test",
+ "type": "open",
+ "max_team_size": None,
+ "user_partition_id": None,
+ }],
}
@ddt.data(
diff --git a/openedx/features/course_duration_limits/tests/test_course_expiration.py b/openedx/features/course_duration_limits/tests/test_course_expiration.py
index b794ef3076c4..2d1b332db651 100644
--- a/openedx/features/course_duration_limits/tests/test_course_expiration.py
+++ b/openedx/features/course_duration_limits/tests/test_course_expiration.py
@@ -65,7 +65,7 @@ def setUp(self):
display_name='Test Vertical'
)
self.user = UserFactory()
- self.THREE_YEARS_AGO = now() - timedelta(days=(365 * 3))
+ self.THREE_YEARS_AGO = now() - timedelta(days=365 * 3)
# Make this a verified course so we can test expiration date
add_course_mode(self.course, mode_slug=CourseMode.AUDIT)
diff --git a/openedx/features/enterprise_support/tests/mixins/enterprise.py b/openedx/features/enterprise_support/tests/mixins/enterprise.py
index 8b8f420dddfb..ac772aa94f6c 100644
--- a/openedx/features/enterprise_support/tests/mixins/enterprise.py
+++ b/openedx/features/enterprise_support/tests/mixins/enterprise.py
@@ -327,7 +327,7 @@ def mock_consent_reverse(*args, **kwargs):
# Ensure that when consent is necessary, the user is redirected to the consent page.
mock_consent_necessary.return_value = True
response = client.get(url)
- while(response.status_code == 302 and 'grant_data_sharing_permissions' not in response.url):
+ while (response.status_code == 302 and 'grant_data_sharing_permissions' not in response.url):
response = client.get(response.url)
assert response.status_code == 302
assert 'grant_data_sharing_permissions' in response.url
diff --git a/openedx/features/enterprise_support/tests/test_api.py b/openedx/features/enterprise_support/tests/test_api.py
index 40f2c834e6b0..ac1c1ba0e4bd 100644
--- a/openedx/features/enterprise_support/tests/test_api.py
+++ b/openedx/features/enterprise_support/tests/test_api.py
@@ -870,7 +870,7 @@ def view_func(request, course_id, *args, **kwargs):
# Call the wrapped function
args = (mock.MagicMock(), 'course-id', 'another arg', 'and another')
- kwargs = dict(a=1, b=2, c=3)
+ kwargs = {"a": 1, "b": 2, "c": 3}
response = view_func(*args, **kwargs)
# If consent required, then the response should be a redirect to the consent URL, and the view function would
@@ -1068,7 +1068,7 @@ def test_get_dashboard_consent_notification(
else:
assert notification_string == ''
- @override_settings(FEATURES=dict(ENABLE_ENTERPRISE_INTEGRATION=False))
+ @override_settings(FEATURES={"ENABLE_ENTERPRISE_INTEGRATION": False})
def test_utils_with_enterprise_disabled(self):
"""
Test that disabling the enterprise integration flag causes
diff --git a/openedx/features/enterprise_support/utils.py b/openedx/features/enterprise_support/utils.py
index 6b007ebed57b..926c285edf0f 100644
--- a/openedx/features/enterprise_support/utils.py
+++ b/openedx/features/enterprise_support/utils.py
@@ -32,11 +32,7 @@ def get_data_consent_share_cache_key(user_id, course_id, enterprise_customer_uui
"""
Returns cache key for data sharing consent needed against user_id, course_id and enterprise_customer_uuid
"""
- cache_key_params = dict(
- type='data_sharing_consent_needed',
- user_id=user_id,
- course_id=course_id,
- )
+ cache_key_params = {"type": 'data_sharing_consent_needed', "user_id": user_id, "course_id": course_id}
if enterprise_customer_uuid:
cache_key_params['enterprise_customer_uuid'] = enterprise_customer_uuid
diff --git a/openedx/features/learner_profile/views/learner_profile.py b/openedx/features/learner_profile/views/learner_profile.py
index 6a3a251fde9a..9f6f685007b9 100644
--- a/openedx/features/learner_profile/views/learner_profile.py
+++ b/openedx/features/learner_profile/views/learner_profile.py
@@ -77,7 +77,7 @@ def learner_profile_context(request, profile_username, user_is_staff):
profile_user = User.objects.get(username=profile_username)
logged_in_user = request.user
- own_profile = (logged_in_user.username == profile_username)
+ own_profile = logged_in_user.username == profile_username
account_settings_data = get_account_settings(request, [profile_username])[0]
diff --git a/pavelib/paver_tests/test_assets.py b/pavelib/paver_tests/test_assets.py
index f7100a7f03c3..082bc9d780cc 100644
--- a/pavelib/paver_tests/test_assets.py
+++ b/pavelib/paver_tests/test_assets.py
@@ -51,60 +51,66 @@ def tearDown(self):
del os.environ['NO_PREREQ_INSTALL']
@ddt.data(
- dict(
- task_name='pavelib.assets.compile_sass',
- args=[],
- kwargs={},
- expected=["npm run compile-sass --"],
- ),
- dict(
- task_name='pavelib.assets.compile_sass',
- args=[],
- kwargs={"system": "lms,studio"},
- expected=["npm run compile-sass --"],
- ),
- dict(
- task_name='pavelib.assets.compile_sass',
- args=[],
- kwargs={"debug": True},
- expected=["npm run compile-sass-dev --"],
- ),
- dict(
- task_name='pavelib.assets.compile_sass',
- args=[],
- kwargs={"system": "lms"},
- expected=["npm run compile-sass -- --skip-cms"],
- ),
- dict(
- task_name='pavelib.assets.compile_sass',
- args=[],
- kwargs={"system": "studio"},
- expected=["npm run compile-sass -- --skip-lms"],
- ),
- dict(
- task_name='pavelib.assets.compile_sass',
- args=[],
- kwargs={"system": "cms", "theme_dirs": f"{REPO_ROOT}/common/test,{REPO_ROOT}/themes"},
- expected=[
+ {
+ "task_name": "pavelib.assets.compile_sass",
+ "args": [],
+ "kwargs": {},
+ "expected": ["npm run compile-sass --"],
+ },
+ {
+ "task_name": "pavelib.assets.compile_sass",
+ "args": [],
+ "kwargs": {"system": "lms,studio"},
+ "expected": ["npm run compile-sass --"],
+ },
+ {
+ "task_name": "pavelib.assets.compile_sass",
+ "args": [],
+ "kwargs": {"debug": True},
+ "expected": ["npm run compile-sass-dev --"],
+ },
+ {
+ "task_name": "pavelib.assets.compile_sass",
+ "args": [],
+ "kwargs": {"system": "lms"},
+ "expected": ["npm run compile-sass -- --skip-cms"],
+ },
+ {
+ "task_name": "pavelib.assets.compile_sass",
+ "args": [],
+ "kwargs": {"system": "studio"},
+ "expected": ["npm run compile-sass -- --skip-lms"],
+ },
+ {
+ "task_name": "pavelib.assets.compile_sass",
+ "args": [],
+ "kwargs": {
+ "system": "cms",
+ "theme_dirs": f"{REPO_ROOT}/common/test,{REPO_ROOT}/themes",
+ },
+ "expected": [
"npm run compile-sass -- --skip-lms " +
f"--theme-dir {REPO_ROOT}/common/test --theme-dir {REPO_ROOT}/themes"
],
- ),
- dict(
- task_name='pavelib.assets.compile_sass',
- args=[],
- kwargs={"theme_dirs": f"{REPO_ROOT}/common/test,{REPO_ROOT}/themes", "themes": "red-theme,test-theme"},
- expected=[
+ },
+ {
+ "task_name": "pavelib.assets.compile_sass",
+ "args": [],
+ "kwargs": {
+ "theme_dirs": f"{REPO_ROOT}/common/test,{REPO_ROOT}/themes",
+ "themes": "red-theme,test-theme",
+ },
+ "expected": [
"npm run compile-sass -- " +
f"--theme-dir {REPO_ROOT}/common/test --theme-dir {REPO_ROOT}/themes " +
"--theme red-theme --theme test-theme"
],
- ),
- dict(
- task_name='pavelib.assets.update_assets',
- args=["lms", "studio", "--settings=fake.settings"],
- kwargs={},
- expected=[
+ },
+ {
+ "task_name": "pavelib.assets.update_assets",
+ "args": ["lms", "studio", "--settings=fake.settings"],
+ "kwargs": {},
+ "expected": [
(
"WEBPACK_CONFIG_PATH=webpack.fake.config.js " +
"NODE_ENV=production " +
@@ -121,7 +127,7 @@ def tearDown(self):
"( ./manage.py cms --settings=fake.settings collectstatic --noinput )"
),
],
- ),
+ },
)
@ddt.unpack
@patch.object(pavelib.assets, 'sh')
diff --git a/pavelib/paver_tests/utils.py b/pavelib/paver_tests/utils.py
index 1db26cf76a4c..b2278c0d4d8b 100644
--- a/pavelib/paver_tests/utils.py
+++ b/pavelib/paver_tests/utils.py
@@ -93,5 +93,3 @@ def unexpected_fail_on_npm_install(*args, **kwargs): # pylint: disable=unused-a
"""
if ["npm", "install", "--verbose"] == args[0]: # lint-amnesty, pylint: disable=no-else-raise
raise BuildFailure('Subprocess return code: 50')
- else:
- return
diff --git a/pylint_django_settings.py b/pylint_django_settings.py
index 46abfd81f883..6051d9ab4b56 100644
--- a/pylint_django_settings.py
+++ b/pylint_django_settings.py
@@ -1,5 +1,5 @@
-from pylint_django.checkers import ForeignKeyStringsChecker
-from pylint_plugin_utils import get_checker
+import os
+import sys
class ArgumentCompatibilityError(Exception):
@@ -47,6 +47,4 @@ def load_configuration(linter):
"""
Configures the Django settings module based on the command-line arguments passed to pylint.
"""
- name_checker = get_checker(linter, ForeignKeyStringsChecker)
- arguments = linter.cmdline_parser.parse_args()[1]
- name_checker.config.django_settings_module = _get_django_settings_module(arguments)
+ os.environ.setdefault("DJANGO_SETTINGS_MODULE", _get_django_settings_module(sys.argv[1:]))
diff --git a/pylintrc b/pylintrc
index 55a9bbab3b9c..a71b8635e137 100644
--- a/pylintrc
+++ b/pylintrc
@@ -64,7 +64,7 @@
# SERIOUSLY.
#
# ------------------------------
-# Generated by edx-lint version: 5.3.7
+# Generated by edx-lint version: 5.4.1
# ------------------------------
[MASTER]
ignore = ,.git,.tox,migrations,node_modules,.pycharm_helpers
@@ -314,6 +314,7 @@ disable =
c-extension-no-member,
no-name-in-module,
unnecessary-lambda-assignment,
+ too-many-positional-arguments
[REPORTS]
output-format = text
@@ -410,4 +411,4 @@ int-import-graph =
[EXCEPTIONS]
overgeneral-exceptions = builtins.Exception
-# e624ea03d8124aa9cf2e577f830632344a0a07d9
+# 9a6ef98201621694b12a50a2f5b71bd35471700d
diff --git a/pylintrc_tweaks b/pylintrc_tweaks
index 1633da5c10a4..1396fd6b92ed 100644
--- a/pylintrc_tweaks
+++ b/pylintrc_tweaks
@@ -33,6 +33,7 @@ disable+ =
c-extension-no-member,
no-name-in-module,
unnecessary-lambda-assignment,
+ too-many-positional-arguments
[BASIC]
attr-rgx = [a-z_][a-z0-9_]{2,40}$
diff --git a/requirements/constraints.txt b/requirements/constraints.txt
index d7608873644e..66889a3e0902 100644
--- a/requirements/constraints.txt
+++ b/requirements/constraints.txt
@@ -148,16 +148,6 @@ openai<=0.28.1
# Issue for unpinning: https://github.com/openedx/edx-platform/issues/35267
path<16.12.0
-# Date: 2022-08-03
-# pycodestyle==2.9.0 generates false positive error E275.
-# Constraint can be removed once the issue https://github.com/PyCQA/pycodestyle/issues/1090 is fixed.
-pycodestyle<2.9.0
-
-# Date: 2021-07-12
-# Issue for unpinning: https://github.com/openedx/edx-platform/issues/33560
-pylint<2.16.0 # greater version failing quality test. Fix them in seperate ticket.
-astroid<2.14.0
-
# Date: 2021-08-25
# At the time of writing this comment, we do not know whether py2neo>=2022
# will support our currently-deployed Neo4j version (3.5).
@@ -177,7 +167,3 @@ pymongo<4.4.1
# We are pinning this until after all the smaller migrations get handled and then we can migrate this all at once.
# Issue for unpinning: https://github.com/edx/edx-arch-experiments/issues/760
social-auth-app-django<=5.4.1
-
-# # Date: 2024-10-14
-# # The edx-enterprise is currently using edx-rest-api-client==5.7.1, which needs to be updated first.
-# edx-rest-api-client==5.7.1
diff --git a/requirements/edx-sandbox/base.txt b/requirements/edx-sandbox/base.txt
index 60a5eff8a62d..401f74cef400 100644
--- a/requirements/edx-sandbox/base.txt
+++ b/requirements/edx-sandbox/base.txt
@@ -20,7 +20,7 @@ cryptography==44.0.0
# via -r requirements/edx-sandbox/base.in
cycler==0.12.1
# via matplotlib
-fonttools==4.55.2
+fonttools==4.55.3
# via matplotlib
joblib==1.4.2
# via nltk
@@ -37,7 +37,7 @@ markupsafe==3.0.2
# via
# chem
# openedx-calc
-matplotlib==3.9.3
+matplotlib==3.10.0
# via -r requirements/edx-sandbox/base.in
mpmath==1.3.0
# via sympy
diff --git a/requirements/edx/base.txt b/requirements/edx/base.txt
index f95ae8adb2c9..b03843d02d05 100644
--- a/requirements/edx/base.txt
+++ b/requirements/edx/base.txt
@@ -10,11 +10,11 @@ acid-xblock==0.4.1
# via -r requirements/edx/kernel.in
aiohappyeyeballs==2.4.4
# via aiohttp
-aiohttp==3.11.9
+aiohttp==3.11.10
# via
# geoip2
# openai
-aiosignal==1.3.1
+aiosignal==1.3.2
# via aiohttp
algoliasearch==3.0.0
# via
@@ -72,13 +72,13 @@ bleach[css]==6.2.0
# xblock-poll
boto==2.49.0
# via -r requirements/edx/kernel.in
-boto3==1.35.76
+boto3==1.35.81
# via
# -r requirements/edx/kernel.in
# django-ses
# fs-s3fs
# ora2
-botocore==1.35.76
+botocore==1.35.81
# via
# -r requirements/edx/kernel.in
# boto3
@@ -101,7 +101,7 @@ celery==5.4.0
# edx-enterprise
# event-tracking
# openedx-learning
-certifi==2024.8.30
+certifi==2024.12.14
# via
# -r requirements/edx/paver.txt
# elasticsearch
@@ -140,7 +140,7 @@ click-plugins==1.1.1
# via celery
click-repl==0.3.0
# via celery
-code-annotations==2.0.0
+code-annotations==2.1.0
# via
# edx-enterprise
# edx-toggles
@@ -321,7 +321,7 @@ django-oauth-toolkit==1.7.1
# edx-enterprise
django-object-actions==4.3.0
# via edx-enterprise
-django-pipeline==3.1.0
+django-pipeline==4.0.0
# via -r requirements/edx/kernel.in
django-push-notifications==3.1.0
# via edx-ace
@@ -331,7 +331,7 @@ django-sekizai==4.1.0
# via
# -r requirements/edx/kernel.in
# openedx-django-wiki
-django-ses==4.3.0
+django-ses==4.3.1
# via -r requirements/edx/bundled.in
django-simple-history==3.4.0
# via
@@ -434,7 +434,7 @@ edx-celeryutils==1.3.0
# super-csv
edx-codejail==3.5.2
# via -r requirements/edx/kernel.in
-edx-completion==4.7.6
+edx-completion==4.7.7
# via -r requirements/edx/kernel.in
edx-django-release-util==1.4.0
# via
@@ -508,7 +508,7 @@ edx-opaque-keys[django]==2.11.0
# ora2
edx-organizations==6.13.0
# via -r requirements/edx/kernel.in
-edx-proctoring==4.18.4
+edx-proctoring==5.0.1
# via
# -r requirements/edx/kernel.in
# edx-proctoring-proctortrack
@@ -525,7 +525,7 @@ edx-search==4.1.1
# openedx-forum
edx-sga==0.25.0
# via -r requirements/edx/bundled.in
-edx-submissions==3.8.3
+edx-submissions==3.8.4
# via
# -r requirements/edx/kernel.in
# ora2
@@ -593,16 +593,16 @@ geoip2==4.8.1
# via -r requirements/edx/kernel.in
glob2==0.7
# via -r requirements/edx/kernel.in
-google-api-core[grpc]==2.23.0
+google-api-core[grpc]==2.24.0
# via
# firebase-admin
# google-api-python-client
# google-cloud-core
# google-cloud-firestore
# google-cloud-storage
-google-api-python-client==2.154.0
+google-api-python-client==2.155.0
# via firebase-admin
-google-auth==2.36.0
+google-auth==2.37.0
# via
# google-api-core
# google-api-python-client
@@ -734,7 +734,7 @@ lxml-html-clean==0.4.1
# via lxml
mailsnake==1.6.4
# via -r requirements/edx/bundled.in
-mako==1.3.7
+mako==1.3.8
# via
# -r requirements/edx/kernel.in
# acid-xblock
@@ -784,7 +784,7 @@ mysqlclient==2.2.6
# via
# -r requirements/edx/kernel.in
# openedx-forum
-newrelic==10.3.1
+newrelic==10.4.0
# via edx-django-utils
nh3==0.2.19
# via -r requirements/edx/kernel.in
@@ -836,7 +836,7 @@ openedx-events==9.15.0
# edx-name-affirmation
# event-tracking
# ora2
-openedx-filters==1.11.0
+openedx-filters==1.12.0
# via
# -r requirements/edx/kernel.in
# lti-consumer-xblock
@@ -853,7 +853,7 @@ optimizely-sdk==4.1.1
# via
# -c requirements/edx/../constraints.txt
# -r requirements/edx/bundled.in
-ora2==6.14.1
+ora2==6.14.2
# via -r requirements/edx/bundled.in
packaging==24.2
# via
@@ -1062,7 +1062,7 @@ random2==1.0.2
# via -r requirements/edx/kernel.in
recommender-xblock==3.0.0
# via -r requirements/edx/bundled.in
-redis==5.2.0
+redis==5.2.1
# via
# -r requirements/edx/kernel.in
# walrus
@@ -1187,7 +1187,7 @@ sortedcontainers==2.4.0
# snowflake-connector-python
soupsieve==2.6
# via beautifulsoup4
-sqlparse==0.5.2
+sqlparse==0.5.3
# via django
staff-graded-xblock==2.3.0
# via -r requirements/edx/bundled.in
@@ -1279,6 +1279,8 @@ webob==1.8.9
# via
# -r requirements/edx/kernel.in
# xblock
+wheel==0.45.1
+ # via django-pipeline
wrapt==1.17.0
# via -r requirements/edx/paver.txt
xblock[django]==5.1.0
diff --git a/requirements/edx/coverage.txt b/requirements/edx/coverage.txt
index 38acef7c7978..23a32bde5e5c 100644
--- a/requirements/edx/coverage.txt
+++ b/requirements/edx/coverage.txt
@@ -6,9 +6,9 @@
#
chardet==5.2.0
# via diff-cover
-coverage==7.6.8
+coverage==7.6.9
# via -r requirements/edx/coverage.in
-diff-cover==9.2.0
+diff-cover==9.2.1
# via -r requirements/edx/coverage.in
jinja2==3.1.4
# via diff-cover
diff --git a/requirements/edx/development.txt b/requirements/edx/development.txt
index 75c533947407..216acaab3e0b 100644
--- a/requirements/edx/development.txt
+++ b/requirements/edx/development.txt
@@ -21,13 +21,13 @@ aiohappyeyeballs==2.4.4
# -r requirements/edx/doc.txt
# -r requirements/edx/testing.txt
# aiohttp
-aiohttp==3.11.9
+aiohttp==3.11.10
# via
# -r requirements/edx/doc.txt
# -r requirements/edx/testing.txt
# geoip2
# openai
-aiosignal==1.3.1
+aiosignal==1.3.2
# via
# -r requirements/edx/doc.txt
# -r requirements/edx/testing.txt
@@ -81,9 +81,8 @@ asn1crypto==1.5.1
# -r requirements/edx/doc.txt
# -r requirements/edx/testing.txt
# snowflake-connector-python
-astroid==2.13.5
+astroid==3.3.6
# via
- # -c requirements/edx/../constraints.txt
# -r requirements/edx/doc.txt
# -r requirements/edx/testing.txt
# pylint
@@ -144,14 +143,14 @@ boto==2.49.0
# via
# -r requirements/edx/doc.txt
# -r requirements/edx/testing.txt
-boto3==1.35.76
+boto3==1.35.81
# via
# -r requirements/edx/doc.txt
# -r requirements/edx/testing.txt
# django-ses
# fs-s3fs
# ora2
-botocore==1.35.76
+botocore==1.35.81
# via
# -r requirements/edx/doc.txt
# -r requirements/edx/testing.txt
@@ -192,7 +191,7 @@ celery==5.4.0
# edx-enterprise
# event-tracking
# openedx-learning
-certifi==2024.8.30
+certifi==2024.12.14
# via
# -r requirements/edx/doc.txt
# -r requirements/edx/testing.txt
@@ -267,7 +266,7 @@ click-repl==0.3.0
# -r requirements/edx/doc.txt
# -r requirements/edx/testing.txt
# celery
-code-annotations==2.0.0
+code-annotations==2.1.0
# via
# -r requirements/edx/doc.txt
# -r requirements/edx/testing.txt
@@ -282,7 +281,7 @@ colorama==0.4.6
# via
# -r requirements/edx/testing.txt
# tox
-coverage[toml]==7.6.8
+coverage[toml]==7.6.9
# via
# -r requirements/edx/testing.txt
# pytest-cov
@@ -327,7 +326,7 @@ defusedxml==0.7.1
# ora2
# python3-openid
# social-auth-core
-diff-cover==9.2.0
+diff-cover==9.2.1
# via -r requirements/edx/testing.txt
dill==0.3.9
# via
@@ -531,7 +530,7 @@ django-object-actions==4.3.0
# -r requirements/edx/doc.txt
# -r requirements/edx/testing.txt
# edx-enterprise
-django-pipeline==3.1.0
+django-pipeline==4.0.0
# via
# -r requirements/edx/doc.txt
# -r requirements/edx/testing.txt
@@ -549,7 +548,7 @@ django-sekizai==4.1.0
# -r requirements/edx/doc.txt
# -r requirements/edx/testing.txt
# openedx-django-wiki
-django-ses==4.3.0
+django-ses==4.3.1
# via
# -r requirements/edx/doc.txt
# -r requirements/edx/testing.txt
@@ -703,7 +702,7 @@ edx-codejail==3.5.2
# via
# -r requirements/edx/doc.txt
# -r requirements/edx/testing.txt
-edx-completion==4.7.6
+edx-completion==4.7.7
# via
# -r requirements/edx/doc.txt
# -r requirements/edx/testing.txt
@@ -798,7 +797,7 @@ edx-organizations==6.13.0
# via
# -r requirements/edx/doc.txt
# -r requirements/edx/testing.txt
-edx-proctoring==4.18.4
+edx-proctoring==5.0.1
# via
# -r requirements/edx/doc.txt
# -r requirements/edx/testing.txt
@@ -823,7 +822,7 @@ edx-sga==0.25.0
# via
# -r requirements/edx/doc.txt
# -r requirements/edx/testing.txt
-edx-submissions==3.8.3
+edx-submissions==3.8.4
# via
# -r requirements/edx/doc.txt
# -r requirements/edx/testing.txt
@@ -953,7 +952,7 @@ glob2==0.7
# via
# -r requirements/edx/doc.txt
# -r requirements/edx/testing.txt
-google-api-core[grpc]==2.23.0
+google-api-core[grpc]==2.24.0
# via
# -r requirements/edx/doc.txt
# -r requirements/edx/testing.txt
@@ -962,12 +961,12 @@ google-api-core[grpc]==2.23.0
# google-cloud-core
# google-cloud-firestore
# google-cloud-storage
-google-api-python-client==2.154.0
+google-api-python-client==2.155.0
# via
# -r requirements/edx/doc.txt
# -r requirements/edx/testing.txt
# firebase-admin
-google-auth==2.36.0
+google-auth==2.37.0
# via
# -r requirements/edx/doc.txt
# -r requirements/edx/testing.txt
@@ -1175,11 +1174,6 @@ lazy==1.6
# lti-consumer-xblock
# ora2
# xblock
-lazy-object-proxy==1.10.0
- # via
- # -r requirements/edx/doc.txt
- # -r requirements/edx/testing.txt
- # astroid
libsass==0.10.0
# via
# -c requirements/edx/../constraints.txt
@@ -1219,7 +1213,7 @@ mailsnake==1.6.4
# via
# -r requirements/edx/doc.txt
# -r requirements/edx/testing.txt
-mako==1.3.7
+mako==1.3.8
# via
# -r requirements/edx/doc.txt
# -r requirements/edx/testing.txt
@@ -1310,7 +1304,7 @@ mysqlclient==2.2.6
# -r requirements/edx/doc.txt
# -r requirements/edx/testing.txt
# openedx-forum
-newrelic==10.3.1
+newrelic==10.4.0
# via
# -r requirements/edx/doc.txt
# -r requirements/edx/testing.txt
@@ -1390,7 +1384,7 @@ openedx-events==9.15.0
# edx-name-affirmation
# event-tracking
# ora2
-openedx-filters==1.11.0
+openedx-filters==1.12.0
# via
# -r requirements/edx/doc.txt
# -r requirements/edx/testing.txt
@@ -1414,7 +1408,7 @@ optimizely-sdk==4.1.1
# -c requirements/edx/../constraints.txt
# -r requirements/edx/doc.txt
# -r requirements/edx/testing.txt
-ora2==6.14.1
+ora2==6.14.2
# via
# -r requirements/edx/doc.txt
# -r requirements/edx/testing.txt
@@ -1561,10 +1555,8 @@ pyasn1-modules==0.4.1
# -r requirements/edx/doc.txt
# -r requirements/edx/testing.txt
# google-auth
-pycodestyle==2.8.0
- # via
- # -c requirements/edx/../constraints.txt
- # -r requirements/edx/testing.txt
+pycodestyle==2.12.1
+ # via -r requirements/edx/testing.txt
pycountry==24.6.1
# via
# -r requirements/edx/doc.txt
@@ -1630,9 +1622,8 @@ pylatexenc==2.10
# -r requirements/edx/doc.txt
# -r requirements/edx/testing.txt
# olxcleaner
-pylint==2.15.10
+pylint==3.3.2
# via
- # -c requirements/edx/../constraints.txt
# -r requirements/edx/testing.txt
# edx-lint
# pylint-celery
@@ -1643,7 +1634,7 @@ pylint-celery==0.3
# via
# -r requirements/edx/testing.txt
# edx-lint
-pylint-django==2.5.5
+pylint-django==2.6.1
# via
# -r requirements/edx/testing.txt
# edx-lint
@@ -1652,7 +1643,7 @@ pylint-plugin-utils==0.8.2
# -r requirements/edx/testing.txt
# pylint-celery
# pylint-django
-pylint-pytest==0.3.0
+pylint-pytest==1.1.8
# via -r requirements/edx/testing.txt
pylti1p3==2.0.0
# via
@@ -1716,7 +1707,7 @@ pysrt==1.1.2
# -r requirements/edx/doc.txt
# -r requirements/edx/testing.txt
# edxval
-pytest==8.3.4
+pytest==8.2.0
# via
# -r requirements/edx/testing.txt
# pylint-pytest
@@ -1735,7 +1726,7 @@ pytest-django==4.9.0
# via -r requirements/edx/testing.txt
pytest-json-report==1.5.0
# via -r requirements/edx/testing.txt
-pytest-metadata==1.8.0
+pytest-metadata==3.1.1
# via
# -r requirements/edx/testing.txt
# pytest-json-report
@@ -1832,7 +1823,7 @@ recommender-xblock==3.0.0
# via
# -r requirements/edx/doc.txt
# -r requirements/edx/testing.txt
-redis==5.2.0
+redis==5.2.1
# via
# -r requirements/edx/doc.txt
# -r requirements/edx/testing.txt
@@ -2073,7 +2064,7 @@ sphinxcontrib-serializinghtml==2.0.0
# sphinx
sphinxext-rediraffe==0.2.7
# via -r requirements/edx/doc.txt
-sqlparse==0.5.2
+sqlparse==0.5.3
# via
# -r requirements/edx/doc.txt
# -r requirements/edx/testing.txt
@@ -2200,7 +2191,7 @@ user-util==1.1.0
# via
# -r requirements/edx/doc.txt
# -r requirements/edx/testing.txt
-uvicorn==0.32.1
+uvicorn==0.34.0
# via
# -r requirements/edx/testing.txt
# pact-python
@@ -2220,7 +2211,7 @@ voluptuous==0.15.2
# -r requirements/edx/doc.txt
# -r requirements/edx/testing.txt
# ora2
-vulture==2.13
+vulture==2.14
# via -r requirements/edx/development.in
walrus==0.9.4
# via
@@ -2261,12 +2252,14 @@ webob==1.8.9
wheel==0.45.1
# via
# -r requirements/edx/../pip-tools.txt
+ # -r requirements/edx/doc.txt
+ # -r requirements/edx/testing.txt
+ # django-pipeline
# pip-tools
wrapt==1.17.0
# via
# -r requirements/edx/doc.txt
# -r requirements/edx/testing.txt
- # astroid
xblock[django]==5.1.0
# via
# -r requirements/edx/doc.txt
diff --git a/requirements/edx/doc.txt b/requirements/edx/doc.txt
index f7031d349784..980cc42044a2 100644
--- a/requirements/edx/doc.txt
+++ b/requirements/edx/doc.txt
@@ -14,12 +14,12 @@ aiohappyeyeballs==2.4.4
# via
# -r requirements/edx/base.txt
# aiohttp
-aiohttp==3.11.9
+aiohttp==3.11.10
# via
# -r requirements/edx/base.txt
# geoip2
# openai
-aiosignal==1.3.1
+aiosignal==1.3.2
# via
# -r requirements/edx/base.txt
# aiohttp
@@ -57,10 +57,8 @@ asn1crypto==1.5.1
# via
# -r requirements/edx/base.txt
# snowflake-connector-python
-astroid==2.13.5
- # via
- # -c requirements/edx/../constraints.txt
- # sphinx-autoapi
+astroid==3.3.6
+ # via sphinx-autoapi
attrs==24.2.0
# via
# -r requirements/edx/base.txt
@@ -107,13 +105,13 @@ bleach[css]==6.2.0
# xblock-poll
boto==2.49.0
# via -r requirements/edx/base.txt
-boto3==1.35.76
+boto3==1.35.81
# via
# -r requirements/edx/base.txt
# django-ses
# fs-s3fs
# ora2
-botocore==1.35.76
+botocore==1.35.81
# via
# -r requirements/edx/base.txt
# boto3
@@ -142,7 +140,7 @@ celery==5.4.0
# edx-enterprise
# event-tracking
# openedx-learning
-certifi==2024.8.30
+certifi==2024.12.14
# via
# -r requirements/edx/base.txt
# elasticsearch
@@ -191,7 +189,7 @@ click-repl==0.3.0
# via
# -r requirements/edx/base.txt
# celery
-code-annotations==2.0.0
+code-annotations==2.1.0
# via
# -r requirements/edx/base.txt
# -r requirements/edx/doc.in
@@ -392,7 +390,7 @@ django-object-actions==4.3.0
# via
# -r requirements/edx/base.txt
# edx-enterprise
-django-pipeline==3.1.0
+django-pipeline==4.0.0
# via -r requirements/edx/base.txt
django-push-notifications==3.1.0
# via
@@ -404,7 +402,7 @@ django-sekizai==4.1.0
# via
# -r requirements/edx/base.txt
# openedx-django-wiki
-django-ses==4.3.0
+django-ses==4.3.1
# via -r requirements/edx/base.txt
django-simple-history==3.4.0
# via
@@ -517,7 +515,7 @@ edx-celeryutils==1.3.0
# super-csv
edx-codejail==3.5.2
# via -r requirements/edx/base.txt
-edx-completion==4.7.6
+edx-completion==4.7.7
# via -r requirements/edx/base.txt
edx-django-release-util==1.4.0
# via
@@ -590,7 +588,7 @@ edx-opaque-keys[django]==2.11.0
# ora2
edx-organizations==6.13.0
# via -r requirements/edx/base.txt
-edx-proctoring==4.18.4
+edx-proctoring==5.0.1
# via
# -r requirements/edx/base.txt
# edx-proctoring-proctortrack
@@ -609,7 +607,7 @@ edx-search==4.1.1
# openedx-forum
edx-sga==0.25.0
# via -r requirements/edx/base.txt
-edx-submissions==3.8.3
+edx-submissions==3.8.4
# via
# -r requirements/edx/base.txt
# ora2
@@ -695,7 +693,7 @@ gitpython==3.1.43
# via -r requirements/edx/doc.in
glob2==0.7
# via -r requirements/edx/base.txt
-google-api-core[grpc]==2.23.0
+google-api-core[grpc]==2.24.0
# via
# -r requirements/edx/base.txt
# firebase-admin
@@ -703,11 +701,11 @@ google-api-core[grpc]==2.23.0
# google-cloud-core
# google-cloud-firestore
# google-cloud-storage
-google-api-python-client==2.154.0
+google-api-python-client==2.155.0
# via
# -r requirements/edx/base.txt
# firebase-admin
-google-auth==2.36.0
+google-auth==2.37.0
# via
# -r requirements/edx/base.txt
# google-api-core
@@ -853,8 +851,6 @@ lazy==1.6
# lti-consumer-xblock
# ora2
# xblock
-lazy-object-proxy==1.10.0
- # via astroid
libsass==0.10.0
# via
# -c requirements/edx/../constraints.txt
@@ -884,7 +880,7 @@ lxml-html-clean==0.4.1
# lxml
mailsnake==1.6.4
# via -r requirements/edx/base.txt
-mako==1.3.7
+mako==1.3.8
# via
# -r requirements/edx/base.txt
# acid-xblock
@@ -946,7 +942,7 @@ mysqlclient==2.2.6
# via
# -r requirements/edx/base.txt
# openedx-forum
-newrelic==10.3.1
+newrelic==10.4.0
# via
# -r requirements/edx/base.txt
# edx-django-utils
@@ -1005,7 +1001,7 @@ openedx-events==9.15.0
# edx-name-affirmation
# event-tracking
# ora2
-openedx-filters==1.11.0
+openedx-filters==1.12.0
# via
# -r requirements/edx/base.txt
# lti-consumer-xblock
@@ -1022,7 +1018,7 @@ optimizely-sdk==4.1.1
# via
# -c requirements/edx/../constraints.txt
# -r requirements/edx/base.txt
-ora2==6.14.1
+ora2==6.14.2
# via -r requirements/edx/base.txt
packaging==24.2
# via
@@ -1279,7 +1275,7 @@ random2==1.0.2
# via -r requirements/edx/base.txt
recommender-xblock==3.0.0
# via -r requirements/edx/base.txt
-redis==5.2.0
+redis==5.2.1
# via
# -r requirements/edx/base.txt
# walrus
@@ -1466,7 +1462,7 @@ sphinxcontrib-serializinghtml==2.0.0
# via sphinx
sphinxext-rediraffe==0.2.7
# via -r requirements/edx/doc.in
-sqlparse==0.5.2
+sqlparse==0.5.3
# via
# -r requirements/edx/base.txt
# django
@@ -1583,10 +1579,12 @@ webob==1.8.9
# via
# -r requirements/edx/base.txt
# xblock
-wrapt==1.17.0
+wheel==0.45.1
# via
# -r requirements/edx/base.txt
- # astroid
+ # django-pipeline
+wrapt==1.17.0
+ # via -r requirements/edx/base.txt
xblock[django]==5.1.0
# via
# -r requirements/edx/base.txt
diff --git a/requirements/edx/paver.txt b/requirements/edx/paver.txt
index c9ee8f3aff49..6c3d7272b47e 100644
--- a/requirements/edx/paver.txt
+++ b/requirements/edx/paver.txt
@@ -4,7 +4,7 @@
#
# make upgrade
#
-certifi==2024.8.30
+certifi==2024.12.14
# via requests
charset-normalizer==2.0.12
# via
diff --git a/requirements/edx/semgrep.txt b/requirements/edx/semgrep.txt
index c244159342bc..9f7f2a04faae 100644
--- a/requirements/edx/semgrep.txt
+++ b/requirements/edx/semgrep.txt
@@ -4,7 +4,7 @@
#
# make upgrade
#
-attrs==24.2.0
+attrs==24.3.0
# via
# glom
# jsonschema
@@ -17,7 +17,7 @@ boltons==21.0.0
# semgrep
bracex==2.5.post1
# via wcmatch
-certifi==2024.8.30
+certifi==2024.12.14
# via requests
charset-normalizer==2.0.12
# via
@@ -112,11 +112,11 @@ rpds-py==0.22.3
# via
# jsonschema
# referencing
-ruamel-yaml==0.17.40
+ruamel-yaml==0.18.6
# via semgrep
ruamel-yaml-clib==0.2.12
# via ruamel-yaml
-semgrep==1.97.0
+semgrep==1.100.0
# via -r requirements/edx/semgrep.in
tomli==2.0.2
# via semgrep
diff --git a/requirements/edx/testing.in b/requirements/edx/testing.in
index b903768f4de6..e74a2cd918f2 100644
--- a/requirements/edx/testing.in
+++ b/requirements/edx/testing.in
@@ -23,7 +23,6 @@ cssselect # Used to extract HTML fragments via CSS selectors in
ddt # Run a test case multiple times with different input; used in many, many of our tests
edx-lint # pylint extensions for Open edX repositories
factory-boy # Library for creating test fixtures, used in many tests
-# Pinning the freezegun version because 0.3.13 is causing failures which have also been reported on the git repo by public.
freezegun # Allows tests to mock the output of assorted datetime module functions
httpretty # Library for mocking HTTP requests, used in many tests
import-linter # Tool for making assertions about which modules can import which others
@@ -36,13 +35,13 @@ pytest-attrib # Select tests based on attributes
pytest-cov # pytest plugin for measuring code coverage
pytest-django # Django support for pytest
pytest-json-report # Output json formatted warnings after running pytest
-pytest-metadata==1.8.0 # To prevent 'make upgrade' failure, dependency of pytest-json-report
+pytest-metadata # To prevent 'make upgrade' failure, dependency of pytest-json-report
pytest-randomly # pytest plugin to randomly order tests
pytest-xdist[psutil] # Parallel execution of tests on multiple CPU cores or hosts
singledispatch # Backport of functools.singledispatch from Python 3.4+, used in tests of XBlock rendering
-testfixtures # Provides a LogCapture utility used by several tests
+testfixtures # Provides a LogCapture utility used by several tests
tox # virtualenv management for tests
unidiff # Required by coverage_pytest_plugin
-pylint-pytest==0.3.0 # A Pylint plugin to suppress pytest-related false positives.
+pylint-pytest # A Pylint plugin to suppress pytest-related false positives.
pact-python # Library for contract testing
py # Needed for pytest configurations, was previously been fetched through tox
diff --git a/requirements/edx/testing.txt b/requirements/edx/testing.txt
index 57a0dc6341ad..868f40987d32 100644
--- a/requirements/edx/testing.txt
+++ b/requirements/edx/testing.txt
@@ -12,12 +12,12 @@ aiohappyeyeballs==2.4.4
# via
# -r requirements/edx/base.txt
# aiohttp
-aiohttp==3.11.9
+aiohttp==3.11.10
# via
# -r requirements/edx/base.txt
# geoip2
# openai
-aiosignal==1.3.1
+aiosignal==1.3.2
# via
# -r requirements/edx/base.txt
# aiohttp
@@ -55,9 +55,8 @@ asn1crypto==1.5.1
# via
# -r requirements/edx/base.txt
# snowflake-connector-python
-astroid==2.13.5
+astroid==3.3.6
# via
- # -c requirements/edx/../constraints.txt
# pylint
# pylint-celery
attrs==24.2.0
@@ -104,13 +103,13 @@ bleach[css]==6.2.0
# xblock-poll
boto==2.49.0
# via -r requirements/edx/base.txt
-boto3==1.35.76
+boto3==1.35.81
# via
# -r requirements/edx/base.txt
# django-ses
# fs-s3fs
# ora2
-botocore==1.35.76
+botocore==1.35.81
# via
# -r requirements/edx/base.txt
# boto3
@@ -140,7 +139,7 @@ celery==5.4.0
# edx-enterprise
# event-tracking
# openedx-learning
-certifi==2024.8.30
+certifi==2024.12.14
# via
# -r requirements/edx/base.txt
# elasticsearch
@@ -200,7 +199,7 @@ click-repl==0.3.0
# via
# -r requirements/edx/base.txt
# celery
-code-annotations==2.0.0
+code-annotations==2.1.0
# via
# -r requirements/edx/base.txt
# -r requirements/edx/testing.in
@@ -211,7 +210,7 @@ codejail-includes==1.0.0
# via -r requirements/edx/base.txt
colorama==0.4.6
# via tox
-coverage[toml]==7.6.8
+coverage[toml]==7.6.9
# via
# -r requirements/edx/coverage.txt
# pytest-cov
@@ -247,7 +246,7 @@ defusedxml==0.7.1
# ora2
# python3-openid
# social-auth-core
-diff-cover==9.2.0
+diff-cover==9.2.1
# via -r requirements/edx/coverage.txt
dill==0.3.9
# via pylint
@@ -418,7 +417,7 @@ django-object-actions==4.3.0
# via
# -r requirements/edx/base.txt
# edx-enterprise
-django-pipeline==3.1.0
+django-pipeline==4.0.0
# via -r requirements/edx/base.txt
django-push-notifications==3.1.0
# via
@@ -430,7 +429,7 @@ django-sekizai==4.1.0
# via
# -r requirements/edx/base.txt
# openedx-django-wiki
-django-ses==4.3.0
+django-ses==4.3.1
# via -r requirements/edx/base.txt
django-simple-history==3.4.0
# via
@@ -538,7 +537,7 @@ edx-celeryutils==1.3.0
# super-csv
edx-codejail==3.5.2
# via -r requirements/edx/base.txt
-edx-completion==4.7.6
+edx-completion==4.7.7
# via -r requirements/edx/base.txt
edx-django-release-util==1.4.0
# via
@@ -613,7 +612,7 @@ edx-opaque-keys[django]==2.11.0
# ora2
edx-organizations==6.13.0
# via -r requirements/edx/base.txt
-edx-proctoring==4.18.4
+edx-proctoring==5.0.1
# via
# -r requirements/edx/base.txt
# edx-proctoring-proctortrack
@@ -632,7 +631,7 @@ edx-search==4.1.1
# openedx-forum
edx-sga==0.25.0
# via -r requirements/edx/base.txt
-edx-submissions==3.8.3
+edx-submissions==3.8.4
# via
# -r requirements/edx/base.txt
# ora2
@@ -726,7 +725,7 @@ geoip2==4.8.1
# via -r requirements/edx/base.txt
glob2==0.7
# via -r requirements/edx/base.txt
-google-api-core[grpc]==2.23.0
+google-api-core[grpc]==2.24.0
# via
# -r requirements/edx/base.txt
# firebase-admin
@@ -734,11 +733,11 @@ google-api-core[grpc]==2.23.0
# google-cloud-core
# google-cloud-firestore
# google-cloud-storage
-google-api-python-client==2.154.0
+google-api-python-client==2.155.0
# via
# -r requirements/edx/base.txt
# firebase-admin
-google-auth==2.36.0
+google-auth==2.37.0
# via
# -r requirements/edx/base.txt
# google-api-core
@@ -896,8 +895,6 @@ lazy==1.6
# lti-consumer-xblock
# ora2
# xblock
-lazy-object-proxy==1.10.0
- # via astroid
libsass==0.10.0
# via
# -c requirements/edx/../constraints.txt
@@ -928,7 +925,7 @@ lxml-html-clean==0.4.1
# lxml
mailsnake==1.6.4
# via -r requirements/edx/base.txt
-mako==1.3.7
+mako==1.3.8
# via
# -r requirements/edx/base.txt
# acid-xblock
@@ -991,7 +988,7 @@ mysqlclient==2.2.6
# via
# -r requirements/edx/base.txt
# openedx-forum
-newrelic==10.3.1
+newrelic==10.4.0
# via
# -r requirements/edx/base.txt
# edx-django-utils
@@ -1050,7 +1047,7 @@ openedx-events==9.15.0
# edx-name-affirmation
# event-tracking
# ora2
-openedx-filters==1.11.0
+openedx-filters==1.12.0
# via
# -r requirements/edx/base.txt
# lti-consumer-xblock
@@ -1067,7 +1064,7 @@ optimizely-sdk==4.1.1
# via
# -c requirements/edx/../constraints.txt
# -r requirements/edx/base.txt
-ora2==6.14.1
+ora2==6.14.2
# via -r requirements/edx/base.txt
packaging==24.2
# via
@@ -1182,10 +1179,8 @@ pyasn1-modules==0.4.1
# via
# -r requirements/edx/base.txt
# google-auth
-pycodestyle==2.8.0
- # via
- # -c requirements/edx/../constraints.txt
- # -r requirements/edx/testing.in
+pycodestyle==2.12.1
+ # via -r requirements/edx/testing.in
pycountry==24.6.1
# via -r requirements/edx/base.txt
pycparser==2.22
@@ -1234,9 +1229,8 @@ pylatexenc==2.10
# via
# -r requirements/edx/base.txt
# olxcleaner
-pylint==2.15.10
+pylint==3.3.2
# via
- # -c requirements/edx/../constraints.txt
# edx-lint
# pylint-celery
# pylint-django
@@ -1244,13 +1238,13 @@ pylint==2.15.10
# pylint-pytest
pylint-celery==0.3
# via edx-lint
-pylint-django==2.5.5
+pylint-django==2.6.1
# via edx-lint
pylint-plugin-utils==0.8.2
# via
# pylint-celery
# pylint-django
-pylint-pytest==0.3.0
+pylint-pytest==1.1.8
# via -r requirements/edx/testing.in
pylti1p3==2.0.0
# via -r requirements/edx/base.txt
@@ -1295,7 +1289,7 @@ pysrt==1.1.2
# via
# -r requirements/edx/base.txt
# edxval
-pytest==8.3.4
+pytest==8.2.0
# via
# -r requirements/edx/testing.in
# pylint-pytest
@@ -1314,7 +1308,7 @@ pytest-django==4.9.0
# via -r requirements/edx/testing.in
pytest-json-report==1.5.0
# via -r requirements/edx/testing.in
-pytest-metadata==1.8.0
+pytest-metadata==3.1.1
# via
# -r requirements/edx/testing.in
# pytest-json-report
@@ -1390,7 +1384,7 @@ random2==1.0.2
# via -r requirements/edx/base.txt
recommender-xblock==3.0.0
# via -r requirements/edx/base.txt
-redis==5.2.0
+redis==5.2.1
# via
# -r requirements/edx/base.txt
# walrus
@@ -1538,7 +1532,7 @@ soupsieve==2.6
# via
# -r requirements/edx/base.txt
# beautifulsoup4
-sqlparse==0.5.2
+sqlparse==0.5.3
# via
# -r requirements/edx/base.txt
# django
@@ -1629,7 +1623,7 @@ urllib3==2.2.3
# requests
user-util==1.1.0
# via -r requirements/edx/base.txt
-uvicorn==0.32.1
+uvicorn==0.34.0
# via pact-python
vine==5.1.0
# via
@@ -1671,10 +1665,12 @@ webob==1.8.9
# via
# -r requirements/edx/base.txt
# xblock
-wrapt==1.17.0
+wheel==0.45.1
# via
# -r requirements/edx/base.txt
- # astroid
+ # django-pipeline
+wrapt==1.17.0
+ # via -r requirements/edx/base.txt
xblock[django]==5.1.0
# via
# -r requirements/edx/base.txt
diff --git a/scripts/user_retirement/requirements/base.txt b/scripts/user_retirement/requirements/base.txt
index 622ffd2bc135..0149ec4e7e83 100644
--- a/scripts/user_retirement/requirements/base.txt
+++ b/scripts/user_retirement/requirements/base.txt
@@ -6,19 +6,19 @@
#
asgiref==3.8.1
# via django
-attrs==24.2.0
+attrs==24.3.0
# via zeep
backoff==2.2.1
# via -r scripts/user_retirement/requirements/base.in
-boto3==1.35.76
+boto3==1.35.81
# via -r scripts/user_retirement/requirements/base.in
-botocore==1.35.76
+botocore==1.35.81
# via
# boto3
# s3transfer
cachetools==5.5.0
# via google-auth
-certifi==2024.8.30
+certifi==2024.12.14
# via requests
cffi==1.17.1
# via
@@ -50,11 +50,11 @@ edx-django-utils==7.1.0
# via edx-rest-api-client
edx-rest-api-client==6.0.0
# via -r scripts/user_retirement/requirements/base.in
-google-api-core==2.23.0
+google-api-core==2.24.0
# via google-api-python-client
-google-api-python-client==2.154.0
+google-api-python-client==2.155.0
# via -r scripts/user_retirement/requirements/base.in
-google-auth==2.36.0
+google-auth==2.37.0
# via
# google-api-core
# google-api-python-client
@@ -81,7 +81,7 @@ lxml==5.3.0
# via zeep
more-itertools==10.5.0
# via simple-salesforce
-newrelic==10.3.1
+newrelic==10.4.0
# via edx-django-utils
pbr==6.1.0
# via stevedore
@@ -146,7 +146,7 @@ six==1.17.0
# via
# jenkinsapi
# python-dateutil
-sqlparse==0.5.2
+sqlparse==0.5.3
# via django
stevedore==5.4.0
# via edx-django-utils
diff --git a/scripts/user_retirement/requirements/testing.txt b/scripts/user_retirement/requirements/testing.txt
index efaa4369170f..95751081eac0 100644
--- a/scripts/user_retirement/requirements/testing.txt
+++ b/scripts/user_retirement/requirements/testing.txt
@@ -8,17 +8,17 @@ asgiref==3.8.1
# via
# -r scripts/user_retirement/requirements/base.txt
# django
-attrs==24.2.0
+attrs==24.3.0
# via
# -r scripts/user_retirement/requirements/base.txt
# zeep
backoff==2.2.1
# via -r scripts/user_retirement/requirements/base.txt
-boto3==1.35.76
+boto3==1.35.81
# via
# -r scripts/user_retirement/requirements/base.txt
# moto
-botocore==1.35.76
+botocore==1.35.81
# via
# -r scripts/user_retirement/requirements/base.txt
# boto3
@@ -28,7 +28,7 @@ cachetools==5.5.0
# via
# -r scripts/user_retirement/requirements/base.txt
# google-auth
-certifi==2024.8.30
+certifi==2024.12.14
# via
# -r scripts/user_retirement/requirements/base.txt
# requests
@@ -72,13 +72,13 @@ edx-django-utils==7.1.0
# edx-rest-api-client
edx-rest-api-client==6.0.0
# via -r scripts/user_retirement/requirements/base.txt
-google-api-core==2.23.0
+google-api-core==2.24.0
# via
# -r scripts/user_retirement/requirements/base.txt
# google-api-python-client
-google-api-python-client==2.154.0
+google-api-python-client==2.155.0
# via -r scripts/user_retirement/requirements/base.txt
-google-auth==2.36.0
+google-auth==2.37.0
# via
# -r scripts/user_retirement/requirements/base.txt
# google-api-core
@@ -132,7 +132,7 @@ more-itertools==10.5.0
# simple-salesforce
moto==4.2.14
# via -r scripts/user_retirement/requirements/testing.in
-newrelic==10.3.1
+newrelic==10.4.0
# via
# -r scripts/user_retirement/requirements/base.txt
# edx-django-utils
@@ -248,7 +248,7 @@ six==1.17.0
# -r scripts/user_retirement/requirements/base.txt
# jenkinsapi
# python-dateutil
-sqlparse==0.5.2
+sqlparse==0.5.3
# via
# -r scripts/user_retirement/requirements/base.txt
# django
diff --git a/scripts/xblock/requirements.txt b/scripts/xblock/requirements.txt
index 920cf0cf6ac1..470964021355 100644
--- a/scripts/xblock/requirements.txt
+++ b/scripts/xblock/requirements.txt
@@ -4,7 +4,7 @@
#
# make upgrade
#
-certifi==2024.8.30
+certifi==2024.12.14
# via requests
charset-normalizer==2.0.12
# via
diff --git a/xmodule/capa/checker.py b/xmodule/capa/checker.py
index bcbdd85e5260..aa7252f9ff79 100755
--- a/xmodule/capa/checker.py
+++ b/xmodule/capa/checker.py
@@ -132,8 +132,7 @@ def check_that_suggested_answers_work(problem):
in problem.grade_answers(all_answers).items()
if answer_id in real_answers)
log.debug(real_results)
- assert(all(result == 'correct'
- for answer_id, result in real_results.items()))
+ assert (all(result == 'correct' for answer_id, result in real_results.items()))
except UndefinedVariable as uv_exc:
log.error("The variable \"{0}\" specified in the ".format(uv_exc) + # lint-amnesty, pylint: disable=logging-not-lazy
"solution isn't recognized (is it a units measure?).")
diff --git a/xmodule/capa/inputtypes.py b/xmodule/capa/inputtypes.py
index 8dff57768688..2628d58b6395 100644
--- a/xmodule/capa/inputtypes.py
+++ b/xmodule/capa/inputtypes.py
@@ -906,7 +906,7 @@ def ungraded_response(self, queue_msg, queuekey):
nothing
"""
# check the queuekey against the saved queuekey
- if('queuestate' in self.input_state and self.input_state['queuestate'] == 'queued'
+ if ('queuestate' in self.input_state and self.input_state['queuestate'] == 'queued'
and self.input_state['queuekey'] == queuekey):
msg = self._parse_data(queue_msg)
# save the queue message so that it can be rendered later
diff --git a/xmodule/capa/tests/test_input_templates.py b/xmodule/capa/tests/test_input_templates.py
index 4b14bd5ef86c..156921bf5301 100644
--- a/xmodule/capa/tests/test_input_templates.py
+++ b/xmodule/capa/tests/test_input_templates.py
@@ -76,8 +76,8 @@ def render_to_xml(self, context_dict):
except Exception as exc:
raise TemplateError("Could not parse XML from '{0}': {1}".format( # lint-amnesty, pylint: disable=raise-missing-from
xml_str, str(exc)))
- else:
- return xml
+
+ return xml
def assert_has_xpath(self, xml_root, xpath, context_dict, exact_num=1):
"""
diff --git a/xmodule/capa/tests/test_responsetypes.py b/xmodule/capa/tests/test_responsetypes.py
index e8df8894c78f..65caefde320b 100644
--- a/xmodule/capa/tests/test_responsetypes.py
+++ b/xmodule/capa/tests/test_responsetypes.py
@@ -2483,7 +2483,7 @@ def test_grade(self):
actual_correctness = correct_map.get_correctness(answer_id)
actual_points = correct_map.get_npoints(answer_id)
- assert expected_correctness == actual_correctness,\
+ assert expected_correctness == actual_correctness, \
('%s should be marked %s' % (answer_id, expected_correctness))
assert expected_points == actual_points, ('%s should have %d points' % (answer_id, expected_points))
diff --git a/xmodule/capa/xqueue_interface.py b/xmodule/capa/xqueue_interface.py
index aee7232a4133..054d409f2f9b 100644
--- a/xmodule/capa/xqueue_interface.py
+++ b/xmodule/capa/xqueue_interface.py
@@ -186,12 +186,12 @@ def construct_callback(self, dispatch: str = 'score_update') -> str:
"""
relative_xqueue_callback_url = reverse(
'xqueue_callback',
- kwargs=dict(
- course_id=str(self._block.scope_ids.usage_id.context_key),
- userid=str(self._block.scope_ids.user_id),
- mod_id=str(self._block.scope_ids.usage_id),
- dispatch=dispatch,
- ),
+ kwargs={
+ "course_id": str(self._block.scope_ids.usage_id.context_key),
+ "userid": str(self._block.scope_ids.user_id),
+ "mod_id": str(self._block.scope_ids.usage_id),
+ "dispatch": dispatch,
+ },
)
xqueue_callback_url_prefix = settings.XQUEUE_INTERFACE.get('callback_url', settings.LMS_ROOT_URL)
return xqueue_callback_url_prefix + relative_xqueue_callback_url
diff --git a/xmodule/capa_block.py b/xmodule/capa_block.py
index fa0e87325bb7..fdc3f12edebd 100644
--- a/xmodule/capa_block.py
+++ b/xmodule/capa_block.py
@@ -999,7 +999,7 @@ def get_html(self):
def handle_fatal_lcp_error(self, error): # lint-amnesty, pylint: disable=missing-function-docstring
log.exception(f"LcpFatalError Encountered for {str(self.location)}")
if error:
- return(
+ return (
HTML('
Error formatting HTML for problem:
{msg}
').format(
msg=str(error))
)
@@ -1050,7 +1050,7 @@ def should_show_reset_button(self):
"""
Return True/False to indicate whether to show the "Reset" button.
"""
- is_survey_question = (self.max_attempts == 0)
+ is_survey_question = self.max_attempts == 0
# If the problem is closed (and not a survey question with max_attempts==0),
# then do NOT show the reset button.
@@ -1078,7 +1078,7 @@ def should_show_save_button(self):
if self.force_save_button:
return not self.closed()
else:
- is_survey_question = (self.max_attempts == 0)
+ is_survey_question = self.max_attempts == 0
needs_reset = self.is_submitted() and self.rerandomize == RANDOMIZATION.ALWAYS
# If the student has unlimited attempts, and their answers
@@ -1720,7 +1720,7 @@ def make_dict_of_responses(data):
try:
val = json.loads(data[key])
# If the submission wasn't deserializable, raise an error.
- except(KeyError, ValueError):
+ except (KeyError, ValueError):
raise ValueError( # lint-amnesty, pylint: disable=raise-missing-from
f"Invalid submission: {data[key]} for {key}"
)
diff --git a/xmodule/course_block.py b/xmodule/course_block.py
index 5b1f92d77734..2767b9804653 100644
--- a/xmodule/course_block.py
+++ b/xmodule/course_block.py
@@ -864,13 +864,11 @@ class CourseFields: # lint-amnesty, pylint: disable=missing-class-docstring
help=_(
"Enter the proctoring provider you want to use for this course run. "
"Choose from the following options: {available_providers}."),
- help_format_args=dict(
+ help_format_args={
# Put the available providers into a format variable so that translators
# don't translate them.
- available_providers=(
- ', '.join(get_available_providers())
- ),
- ),
+ "available_providers": ", ".join(get_available_providers()),
+ },
scope=Scope.settings,
deprecated=EXAM_SETTINGS_HTML_VIEW_ENABLED
)
diff --git a/xmodule/item_bank_block.py b/xmodule/item_bank_block.py
index 7adf935e48ee..b783ef5a5c9b 100644
--- a/xmodule/item_bank_block.py
+++ b/xmodule/item_bank_block.py
@@ -136,7 +136,7 @@ def make_selection(cls, selected, children, max_count):
valid_block_keys = {(c.block_type, c.block_id) for c in children}
# Remove any selected blocks that are no longer valid:
- invalid_block_keys = (selected_keys - valid_block_keys)
+ invalid_block_keys = selected_keys - valid_block_keys
if invalid_block_keys:
selected_keys -= invalid_block_keys
diff --git a/xmodule/library_content_block.py b/xmodule/library_content_block.py
index 52e33108027c..27044bf75ff7 100644
--- a/xmodule/library_content_block.py
+++ b/xmodule/library_content_block.py
@@ -390,8 +390,8 @@ def post_editor_saved(self, user, old_metadata, old_content): # pylint: disable
"""
If source library or capa_type have been edited, upgrade library & sync automatically.
"""
- source_lib_changed = (self.source_library_id != old_metadata.get("source_library_id", ""))
- capa_filter_changed = (self.capa_type != old_metadata.get("capa_type", ANY_CAPA_TYPE_VALUE))
+ source_lib_changed = self.source_library_id != old_metadata.get("source_library_id", "")
+ capa_filter_changed = self.capa_type != old_metadata.get("capa_type", ANY_CAPA_TYPE_VALUE)
if source_lib_changed or capa_filter_changed:
try:
self.sync_from_library(upgrade_to_latest=True)
diff --git a/xmodule/library_tools.py b/xmodule/library_tools.py
index 52a31c0608ea..457b00d021c1 100644
--- a/xmodule/library_tools.py
+++ b/xmodule/library_tools.py
@@ -105,11 +105,11 @@ def trigger_library_sync(self, dest_block: LegacyLibraryContentBlock, library_ve
# These race conditions lead to failed imports of library content from course import.
# See: TNL-11339, https://github.com/openedx/edx-platform/issues/34029 for more info.
library_tasks.sync_from_library.apply(
- kwargs=dict(
- user_id=self.user_id,
- dest_block_id=str(dest_block.scope_ids.usage_id),
- library_version=library_version,
- ),
+ kwargs={
+ "user_id": self.user_id,
+ "dest_block_id": str(dest_block.scope_ids.usage_id),
+ "library_version": library_version,
+ },
)
def trigger_duplication(
diff --git a/xmodule/modulestore/inheritance.py b/xmodule/modulestore/inheritance.py
index 4c5a14b769cb..b6ce5727316c 100644
--- a/xmodule/modulestore/inheritance.py
+++ b/xmodule/modulestore/inheritance.py
@@ -178,24 +178,24 @@ class InheritanceMixin(XBlockMixin):
scope=Scope.settings,
default=False
)
- video_bumper = Dict(
- display_name=_("Video Pre-Roll"),
- help=_(
+ video_bumper = {
+ "display_name": _("Video Pre-Roll"),
+ "help": _(
"Identify a video, 5-10 seconds in length, to play before course videos. Enter the video ID from "
"the Video Uploads page and one or more transcript files in the following format: {format}. "
"For example, an entry for a video with two transcripts looks like this: {example}"
),
- help_format_args=dict(
- format='{"video_id": "ID", "transcripts": {"language": "/static/filename.srt"}}',
- example=(
+ "help_format_args": {
+ "format": '{"video_id": "ID", "transcripts": {"language": "/static/filename.srt"}}',
+ "example": (
'{'
'"video_id": "77cef264-d6f5-4cf2-ad9d-0178ab8c77be", '
'"transcripts": {"en": "/static/DemoX-D01_1.srt", "uk": "/static/DemoX-D01_1_uk.srt"}'
'}'
),
- ),
- scope=Scope.settings
- )
+ },
+ "scope": Scope.settings,
+ }
show_reset_button = Boolean(
display_name=_("Show Reset Button for Problems"),
diff --git a/xmodule/modulestore/mongo/draft.py b/xmodule/modulestore/mongo/draft.py
index 5e171e36daf6..255c4bffd85f 100644
--- a/xmodule/modulestore/mongo/draft.py
+++ b/xmodule/modulestore/mongo/draft.py
@@ -35,7 +35,7 @@ def wrap_draft(item):
Sets `item.is_draft` to `True` if the item is DRAFT, and `False` otherwise.
Sets the item's location to the non-draft location in either case.
"""
- item.is_draft = (item.location.branch == MongoRevisionKey.draft)
+ item.is_draft = item.location.branch == MongoRevisionKey.draft
item.location = item.location.replace(revision=MongoRevisionKey.published)
return item
diff --git a/xmodule/modulestore/perf_tests/generate_report.py b/xmodule/modulestore/perf_tests/generate_report.py
index fbecd33bbbd9..9387b1f311a0 100644
--- a/xmodule/modulestore/perf_tests/generate_report.py
+++ b/xmodule/modulestore/perf_tests/generate_report.py
@@ -167,7 +167,7 @@ def generate_html(self):
value = 0
else:
value = (per_amount[modulestore] - per_phase['0'][modulestore]) / float(amount)
- row.append(f"{value}")
+ row.append(f"{value}") # pylint: disable=possibly-used-before-assignment
phase_table.add_row(row)
# Add the table title and the table.
@@ -282,7 +282,7 @@ def cli(outfile, db_name, data_type):
elif data_type == 'find':
f_gen = FindReportGen(db_name)
html = f_gen.generate_html()
- click.echo(html.tostring(), file=outfile)
+ click.echo(html.tostring(), file=outfile) # pylint: disable=possibly-used-before-assignment
if __name__ == '__main__':
if click is not None:
diff --git a/xmodule/modulestore/split_mongo/split_draft.py b/xmodule/modulestore/split_mongo/split_draft.py
index 62ee4166df9d..8a234147360a 100644
--- a/xmodule/modulestore/split_mongo/split_draft.py
+++ b/xmodule/modulestore/split_mongo/split_draft.py
@@ -235,7 +235,7 @@ def delete_item(self, location, user_id, revision=None, skip_auto_publish=False,
)
self._flag_publish_event(location.course_key)
- for branch in branches_to_delete:
+ for branch in branches_to_delete: # pylint: disable=possibly-used-before-assignment
branched_location = location.for_branch(branch)
super().delete_item(branched_location, user_id)
diff --git a/xmodule/modulestore/tests/test_contentstore.py b/xmodule/modulestore/tests/test_contentstore.py
index b5d755a8bea1..73519e5fe2b3 100644
--- a/xmodule/modulestore/tests/test_contentstore.py
+++ b/xmodule/modulestore/tests/test_contentstore.py
@@ -122,7 +122,7 @@ def test_find(self, deprecated):
unknown_asset = self.course1_key.make_asset_key('asset', 'no_such_file.gif')
with pytest.raises(NotFoundError):
self.contentstore.find(unknown_asset)
- assert self.contentstore.find(unknown_asset, throw_on_not_found=False) is None,\
+ assert self.contentstore.find(unknown_asset, throw_on_not_found=False) is None, \
f'Found unknown asset {unknown_asset}'
@ddt.data(True, False)
diff --git a/xmodule/modulestore/tests/test_split_modulestore.py b/xmodule/modulestore/tests/test_split_modulestore.py
index bee57733acee..f493baced9e8 100644
--- a/xmodule/modulestore/tests/test_split_modulestore.py
+++ b/xmodule/modulestore/tests/test_split_modulestore.py
@@ -1166,7 +1166,7 @@ def test_create_minimal_item(self):
# check that course version changed and course's previous is the other one
assert new_block.location.course == 'GreekHero'
assert new_block.location.version_guid != premod_course.location.version_guid
- assert locator.version_guid is None,\
+ assert locator.version_guid is None, \
'Version inadvertently filled in' # lint-amnesty, pylint: disable=no-member
current_course = modulestore().get_course(locator)
assert new_block.location.version_guid == current_course.location.version_guid
@@ -2001,9 +2001,9 @@ def _check_course(self, source_course_loc, dest_course_loc, expected_blocks, une
pub_copy = modulestore().get_item(dest_course_loc.make_usage_key(expected.type, expected.id))
# everything except previous_version & children should be the same
assert source.category == pub_copy.category
- assert source.update_version == pub_copy.source_version,\
+ assert source.update_version == pub_copy.source_version, \
f"Versions don't match for {expected}: {source.update_version} != {pub_copy.update_version}"
- assert self.user_id == pub_copy.edited_by,\
+ assert self.user_id == pub_copy.edited_by, \
f'{pub_copy.location} edited_by {pub_copy.edited_by} not {self.user_id}'
for field in source.fields.values():
if field.name == 'children':
diff --git a/xmodule/modulestore/tests/utils.py b/xmodule/modulestore/tests/utils.py
index 8cac4bf72831..0414dc77bf39 100644
--- a/xmodule/modulestore/tests/utils.py
+++ b/xmodule/modulestore/tests/utils.py
@@ -245,12 +245,12 @@ def build_with_contentstore(self, contentstore, **kwargs):
contentstore: The contentstore that this modulestore should use to store
all of its assets.
"""
- doc_store_config = dict(
- db=f'modulestore{THIS_UUID}',
- collection='xmodule',
- asset_collection='asset_metadata',
- **COMMON_DOCSTORE_CONFIG
- )
+ doc_store_config = {
+ "db": f"modulestore{THIS_UUID}",
+ "collection": "xmodule",
+ "asset_collection": "asset_metadata",
+ **COMMON_DOCSTORE_CONFIG,
+ }
# Set up a temp directory for storing filesystem content created during import
fs_root = mkdtemp()
@@ -293,11 +293,11 @@ def build_with_contentstore(self, contentstore, **kwargs):
contentstore: The contentstore that this modulestore should use to store
all of its assets.
"""
- doc_store_config = dict(
- db=f'modulestore{THIS_UUID}',
- collection='split_module',
- **COMMON_DOCSTORE_CONFIG
- )
+ doc_store_config = {
+ "db": f"modulestore{THIS_UUID}",
+ "collection": "split_module",
+ **COMMON_DOCSTORE_CONFIG,
+ }
# Set up a temp directory for storing filesystem content created during import
fs_root = mkdtemp()
diff --git a/xmodule/split_test_block.py b/xmodule/split_test_block.py
index 05ca3a5db454..2ec49f0a80e6 100644
--- a/xmodule/split_test_block.py
+++ b/xmodule/split_test_block.py
@@ -419,9 +419,9 @@ def log_child_render(self, request, suffix=''): # lint-amnesty, pylint: disable
)
)
raise
- else:
- self.runtime.publish(self, 'xblock.split_test.child_render', {'child_id': child_id})
- return Response()
+
+ self.runtime.publish(self, 'xblock.split_test.child_render', {'child_id': child_id})
+ return Response()
def get_icon_class(self):
return self.child.get_icon_class() if self.child else 'other'
diff --git a/xmodule/tests/__init__.py b/xmodule/tests/__init__.py
index b2cdd67b71ba..abb0120c9dc1 100644
--- a/xmodule/tests/__init__.py
+++ b/xmodule/tests/__init__.py
@@ -362,7 +362,7 @@ def extract_key(usage_key):
elif isinstance(reference_field, ReferenceValueDict):
expected = {key: extract_key(val) for (key, val) in expected.items()}
actual = {key: extract_key(val) for (key, val) in actual.items()}
- assert expected == actual,\
+ assert expected == actual, \
LazyFormat("Field {} doesn't match between usages {} and {}: {!r} != {!r}",
reference_field.name,
expected_block.scope_ids.usage_id,
@@ -386,7 +386,7 @@ def assertFieldEqual(self, field, expected_block, actual_block):
else:
expected = field.read_from(expected_block)
actual = field.read_from(actual_block)
- assert expected == actual,\
+ assert expected == actual, \
LazyFormat("Field {} doesn't match between usages {} and {}: {!r} != {!r}",
field.name,
expected_block.scope_ids.usage_id,
diff --git a/xmodule/tests/test_graders.py b/xmodule/tests/test_graders.py
index 5073052b1ba8..d78ad2c17629 100644
--- a/xmodule/tests/test_graders.py
+++ b/xmodule/tests/test_graders.py
@@ -21,8 +21,13 @@ class GradesheetTest(unittest.TestCase):
def test_weighted_grading(self):
scores = []
- agg_fields = dict(first_attempted=None)
- prob_fields = dict(raw_earned=0, raw_possible=0, weight=0, first_attempted=None)
+ agg_fields = {"first_attempted": None}
+ prob_fields = {
+ "raw_earned": 0,
+ "raw_possible": 0,
+ "weight": 0,
+ "first_attempted": None,
+ }
# No scores
all_total, graded_total = aggregate_scores(scores)
@@ -78,7 +83,7 @@ def __init__(self, graded_total, display_name):
def percent_graded(self):
return compute_percent(self.graded_total.earned, self.graded_total.possible)
- common_fields = dict(graded=True, first_attempted=datetime.now())
+ common_fields = {"graded": True, "first_attempted": datetime.now()}
test_gradesheet = {
'Homework': {
'hw1': MockGrade(AggregatedScore(tw_earned=2, tw_possible=20.0, **common_fields), display_name='hw1'),
diff --git a/xmodule/tests/test_html_block.py b/xmodule/tests/test_html_block.py
index 8cca7acc0499..c4b242adcdbf 100644
--- a/xmodule/tests/test_html_block.py
+++ b/xmodule/tests/test_html_block.py
@@ -38,8 +38,8 @@ class HtmlBlockCourseApiTestCase(unittest.TestCase):
@ddt.data(
{},
- dict(FEATURES={}),
- dict(FEATURES=dict(ENABLE_HTML_XBLOCK_STUDENT_VIEW_DATA=False))
+ {"FEATURES": {}},
+ {"FEATURES": {"ENABLE_HTML_XBLOCK_STUDENT_VIEW_DATA": False}}
)
def test_disabled(self, settings):
"""
@@ -52,7 +52,7 @@ def test_disabled(self, settings):
with override_settings(**settings):
assert block.student_view_data() ==\
- dict(enabled=False, message='To enable, set FEATURES["ENABLE_HTML_XBLOCK_STUDENT_VIEW_DATA"]')
+ {"enabled": False, "message": 'To enable, set FEATURES["ENABLE_HTML_XBLOCK_STUDENT_VIEW_DATA"]'}
@ddt.data(
'
Some content
', # Valid HTML
@@ -63,7 +63,7 @@ def test_disabled(self, settings):
'
', # Images allowed
'short string ' * 100, # May contain long strings
)
- @override_settings(FEATURES=dict(ENABLE_HTML_XBLOCK_STUDENT_VIEW_DATA=True))
+ @override_settings(FEATURES={"ENABLE_HTML_XBLOCK_STUDENT_VIEW_DATA": True})
def test_common_values(self, html):
"""
Ensure that student_view_data will return HTML data when enabled,
@@ -77,7 +77,7 @@ def test_common_values(self, html):
field_data = DictFieldData({'data': html})
module_system = get_test_system()
block = HtmlBlock(module_system, field_data, Mock())
- assert block.student_view_data() == dict(enabled=True, html=html)
+ assert block.student_view_data() == {"enabled": True, "html": html}
@ddt.data(
STUDENT_VIEW,
diff --git a/xmodule/tests/test_sequence.py b/xmodule/tests/test_sequence.py
index be773865a717..731d6eeedc76 100644
--- a/xmodule/tests/test_sequence.py
+++ b/xmodule/tests/test_sequence.py
@@ -149,7 +149,7 @@ def test_student_view_init(self):
def test_render_student_view(self, view):
html = self._get_rendered_view(
self.sequence_3_1,
- extra_context=dict(next_url='NextSequential', prev_url='PrevSequential'),
+ extra_context={"next_url": 'NextSequential', "prev_url": 'PrevSequential'},
view=view
)
self._assert_view_at_position(html, expected_position=1)
@@ -171,7 +171,7 @@ def test_timed_exam_gating_waffle_flag(self, mocked_function): # pylint: disabl
with override_waffle_flag(TIMED_EXAM_GATING_WAFFLE_FLAG, active=False):
self._get_rendered_view(
self.sequence_5_1,
- extra_context=dict(next_url='NextSequential', prev_url='PrevSequential'),
+ extra_context={"next_url": 'NextSequential', "prev_url": 'PrevSequential'},
view=STUDENT_VIEW
)
mocked_function.assert_not_called()
@@ -179,7 +179,7 @@ def test_timed_exam_gating_waffle_flag(self, mocked_function): # pylint: disabl
with override_waffle_flag(TIMED_EXAM_GATING_WAFFLE_FLAG, active=True):
self._get_rendered_view(
self.sequence_5_1,
- extra_context=dict(next_url='NextSequential', prev_url='PrevSequential'),
+ extra_context={"next_url": 'NextSequential', "prev_url": 'PrevSequential'},
view=STUDENT_VIEW
)
mocked_function.assert_called_once()
@@ -199,7 +199,7 @@ def test_that_timed_sequence_gating_respects_access_configurations(self):
))
view = self._get_rendered_view(
self.sequence_5_1,
- extra_context=dict(next_url='NextSequential', prev_url='PrevSequential'),
+ extra_context={"next_url": 'NextSequential', "prev_url": 'PrevSequential'},
view=STUDENT_VIEW
)
assert 'i_am_gated' in view
@@ -243,7 +243,7 @@ def test_hidden_content_past_due(self):
progress_url = 'http://test_progress_link'
html = self._get_rendered_view(
self.sequence_4_1,
- extra_context=dict(progress_url=progress_url),
+ extra_context={"progress_url": progress_url},
)
assert 'hidden_content.html' in html
assert progress_url in html
@@ -252,7 +252,7 @@ def test_masquerade_hidden_content_past_due(self):
with freeze_time(COURSE_END_DATE):
html = self._get_rendered_view(
self.sequence_4_1,
- extra_context=dict(specific_masquerade=True),
+ extra_context={"specific_masquerade": True},
)
assert 'seq_block.html' in html
html = self.get_context_dict_from_string(html)
@@ -269,7 +269,7 @@ def test_hidden_content_self_paced_past_end(self):
progress_url = 'http://test_progress_link'
html = self._get_rendered_view(
self.sequence_4_1,
- extra_context=dict(progress_url=progress_url),
+ extra_context={"progress_url": progress_url},
self_paced=True,
)
assert 'hidden_content.html' in html
@@ -335,7 +335,7 @@ def test_gated_content(self):
html = self._get_rendered_view(
self.sequence_1_2,
- extra_context=dict(next_url='NextSequential', prev_url='PrevSequential'),
+ extra_context={"next_url": 'NextSequential', "prev_url": 'PrevSequential'},
)
# expect content to be gated, with no banner
@@ -348,7 +348,7 @@ def test_gated_content(self):
html = self._get_rendered_view(
self.sequence_1_2,
- extra_context=dict(next_url='NextSequential', prev_url='PrevSequential'),
+ extra_context={"next_url": 'NextSequential', "prev_url": 'PrevSequential'},
)
# assert that content and preq banner is shown
self._assert_prereq(html, self.sequence_1_2)
@@ -360,7 +360,7 @@ def test_gated_content(self):
html = self._get_rendered_view(
self.sequence_1_2,
- extra_context=dict(next_url='NextSequential', prev_url='PrevSequential'),
+ extra_context={"next_url": 'NextSequential', "prev_url": 'PrevSequential'},
)
# assert content shown as normal
diff --git a/xmodule/tests/test_transcripts_utils.py b/xmodule/tests/test_transcripts_utils.py
index bb4141f06c81..ffe2b9e582d4 100644
--- a/xmodule/tests/test_transcripts_utils.py
+++ b/xmodule/tests/test_transcripts_utils.py
@@ -123,7 +123,7 @@ def test_get_transcript_link_from_youtube(self, language_code, mock_get):
{language_code: CAPTION_URL_UTF8_DECODED_TEMPLATE.format(language_code)}
)
- @ mock.patch('requests.get')
+ @mock.patch('requests.get')
@ddt.data(None)
def test_get_caption_no_caption(self, language_code, mock_get):
"""
@@ -134,7 +134,7 @@ def test_get_caption_no_caption(self, language_code, mock_get):
english_language_caption_link = get_transcript_link_from_youtube(YOUTUBE_VIDEO_ID)
self.assertIsNone(english_language_caption_link)
- @ mock.patch('requests.get')
+ @mock.patch('requests.get')
def test_get_caption_malformed_caption_locator(self, mock_get):
"""
Caption track provided on video page for the selected language, but with broken syntax
diff --git a/xmodule/tests/test_video.py b/xmodule/tests/test_video.py
index 5e95f77082b1..76e8a8ca5564 100644
--- a/xmodule/tests/test_video.py
+++ b/xmodule/tests/test_video.py
@@ -690,10 +690,7 @@ def test_export_to_xml(self, mock_val_api):
"""
edx_video_id = 'test_edx_video_id'
mock_val_api.export_to_xml = Mock(
- return_value=dict(
- xml=etree.Element('video_asset'),
- transcripts={}
- )
+ return_value={"xml": etree.Element('video_asset'), "transcripts": {}}
)
self.block.youtube_id_0_75 = 'izygArpw-Qo'
self.block.youtube_id_1_0 = 'p2Q6BrNhdh8'
diff --git a/xmodule/tests/test_xml_block.py b/xmodule/tests/test_xml_block.py
index 7f33aad0f998..c12bb7baeb39 100644
--- a/xmodule/tests/test_xml_block.py
+++ b/xmodule/tests/test_xml_block.py
@@ -189,8 +189,8 @@ def test_non_defaults_inherited_across_lib(self):
parent_block = self.get_block_using_split_kvs(
block_type="library_content",
block_id="parent",
- fields=dict(inherited="changed!"),
- defaults=dict(inherited="parent's default"),
+ fields={"inherited": 'changed!'},
+ defaults={"inherited": "parent's default"},
)
assert parent_block.inherited == 'changed!'
@@ -211,8 +211,8 @@ def test_defaults_not_inherited_across_lib(self):
parent_block = self.get_block_using_split_kvs(
block_type="library_content",
block_id="parent",
- fields=dict(inherited="changed!"),
- defaults=dict(inherited="parent's default"),
+ fields={"inherited": 'changed!'},
+ defaults={"inherited": "parent's default"},
)
assert parent_block.inherited == 'changed!'
@@ -220,7 +220,7 @@ def test_defaults_not_inherited_across_lib(self):
block_type="library_content",
block_id="parent",
fields={},
- defaults=dict(inherited="child's default"),
+ defaults={"inherited": "child's default"},
)
child.parent = parent_block.location
assert child.inherited == "child's default"
diff --git a/xmodule/vertical_block.py b/xmodule/vertical_block.py
index 150e6310853e..b0db520350f5 100644
--- a/xmodule/vertical_block.py
+++ b/xmodule/vertical_block.py
@@ -116,7 +116,7 @@ def _student_or_public_view(self, context, view): # lint-amnesty, pylint: disab
child_block_context = copy(child_context)
if child in list(child_blocks_to_complete_on_view):
child_block_context['wrap_xblock_data'] = {
- 'mark-completed-on-view-after-delay': complete_on_view_delay
+ 'mark-completed-on-view-after-delay': complete_on_view_delay # pylint: disable=possibly-used-before-assignment
}
try:
# .. filter_implemented_name: VerticalBlockChildRenderStarted
diff --git a/xmodule/video_block/transcripts_utils.py b/xmodule/video_block/transcripts_utils.py
index 866edf596812..0f5a653751dc 100644
--- a/xmodule/video_block/transcripts_utils.py
+++ b/xmodule/video_block/transcripts_utils.py
@@ -639,10 +639,10 @@ def get_video_transcript_content(edx_video_id, language_code):
f"Error getting transcript from edx-val id: {edx_video_id}: language code {language_code}"
)
content = '{"start": [1],"end": [2],"text": ["An error occured obtaining the transcript."]}'
- transcript = dict(
- file_name='error-{edx_video_id}-{language_code}.srt',
- content=Transcript.convert(content, 'sjson', 'srt')
- )
+ transcript = {
+ "file_name": f"error-{edx_video_id}-{language_code}.srt",
+ "content": Transcript.convert(content, "sjson", "srt"),
+ }
return transcript
@@ -681,7 +681,10 @@ def convert_video_transcript(file_name, content, output_format):
filename = f'{basename}.{output_format}'
converted_transcript = Transcript.convert(content, input_format=input_format, output_format=output_format)
- return dict(filename=filename, content=converted_transcript)
+ return {
+ "filename": filename,
+ "content": converted_transcript,
+ }
class Transcript:
@@ -835,7 +838,7 @@ def available_translations(self, transcripts, verify_assets=None, is_bumper=Fals
sub, other_langs = transcripts["sub"], transcripts["transcripts"]
if verify_assets:
- all_langs = dict(**other_langs)
+ all_langs = {**other_langs}
if sub:
all_langs.update({'en': sub})