fix: bump pylint version (#31084)

This commit is contained in:
Usama Sadiq
2022-10-27 12:19:09 +05:00
committed by GitHub
parent ce9abc94da
commit 4734f9f16e
30 changed files with 99 additions and 80 deletions

View File

@@ -343,8 +343,8 @@ def get_metadata_from_index(queryset, text_search=None):
type=lib.type,
description=metadata[i]['description'],
version=metadata[i]['version'],
allow_public_learning=queryset[i].allow_public_learning,
allow_public_read=queryset[i].allow_public_read,
allow_public_learning=lib.allow_public_learning,
allow_public_read=lib.allow_public_read,
num_blocks=metadata[i].get('num_blocks'),
last_published=metadata[i].get('last_published'),
has_unpublished_changes=metadata[i].get('has_unpublished_changes'),

View File

@@ -122,7 +122,7 @@ class Model:
def _update_from_response(self, response_data):
for k, v in response_data.items():
if k in self.accessible_fields:
self.__setattr__(k, v)
setattr(self, k, v)
else:
log.warning(
"Unexpected field {field_name} in model {model_name}".format(

View File

@@ -392,7 +392,7 @@ class ProgramProgressMeter:
certificate
)
earliest_course_run_date = min(
[date for date in [available_date, earliest_course_run_date] if date]
date for date in [available_date, earliest_course_run_date] if date
)
# If we're missing a cert for a course, the program isn't completed and we should just bail now
@@ -400,7 +400,7 @@ class ProgramProgressMeter:
return None
# Keep the catalog course date if it's the latest one
program_available_date = max([date for date in [earliest_course_run_date, program_available_date] if date])
program_available_date = max(date for date in [earliest_course_run_date, program_available_date] if date)
return program_available_date

View File

@@ -23,8 +23,8 @@ class AuthFailedError(Exception):
""" Returns a dict representation of the error. """
resp = {'success': False}
for attr in ('value', 'redirect', 'redirect_url', 'error_code', 'context'):
if self.__getattribute__(attr):
resp[attr] = self.__getattribute__(attr)
if getattr(self, attr):
resp[attr] = getattr(self, attr)
return resp

View File

@@ -101,7 +101,7 @@ class CacheIsolationMixin:
cls.__old_settings.append(copy.deepcopy(settings.CACHES))
override = override_settings(CACHES=cache_settings)
override.__enter__()
override.__enter__() # pylint: disable=unnecessary-dunder-call
cls.__settings_overrides.append(override)
assert settings.CACHES == cache_settings

View File

@@ -166,10 +166,10 @@ class EffortEstimationTransformer(BlockStructureTransformer):
def _gather_child_values(self, block_structure, block_key, field, default=0):
"""Collects and sums all child values for field."""
return sum([
return sum(
block_structure.get_xblock_field(child_key, field, default=default)
for child_key in block_structure.get_children(block_key)
])
)
def _estimate_children_effort(self, _usage_info, block_structure, block_key):
"""Collects time and activity counts for children."""