fix: Remove pylint constraint and fix warnings (#28646)

This commit is contained in:
Usama Sadiq
2021-10-20 23:00:13 +05:00
committed by GitHub
parent 4854af6336
commit 9ee8df0980
42 changed files with 95 additions and 84 deletions

View File

@@ -152,7 +152,7 @@ def course_info_to_ccxcon(course_key):
if resp.status_code >= 400:
log.error("Error creating course on ccxcon. Status: %s, Content: %s", resp.status_code, resp.content)
# this API performs a POST request both for POST and PATCH, but the POST returns 201 and the PATCH returns 200
elif resp.status_code != HTTP_200_OK and resp.status_code != HTTP_201_CREATED:
elif resp.status_code not in (HTTP_200_OK, HTTP_201_CREATED):
log.error('Server returned unexpected status code %s', resp.status_code)
else:
log.debug('Request successful. Status: %s, Content: %s', resp.status_code, resp.content)

View File

@@ -179,7 +179,7 @@ class LibraryBundle:
Get the set of usage keys in this bundle that have no parent.
"""
own_usage_keys = self.get_all_usages()
usage_keys_with_parents = self.get_bundle_includes().keys() # lint-amnesty, pylint: disable=dict-keys-not-iterating
usage_keys_with_parents = self.get_bundle_includes().keys()
return [usage_key for usage_key in own_usage_keys if usage_key not in usage_keys_with_parents]
def get_bundle_includes(self):

View File

@@ -74,7 +74,7 @@ class Features(Enum):
self.feature_support_type = feature_support_type
@property
def value(self):
def value(self): # pylint: disable=invalid-overridden-method
return self.feature_id
@property

View File

@@ -17,7 +17,7 @@ class SendEmailBaseCommand(PrefixedDebugLoggerMixin, BaseCommand): # lint-amnes
# An iterable of day offsets (e.g. -7, -14, -21, -28, ...) that defines the days for
# which emails are sent out, relative to the 'date' parameter
offsets = range(-7, -77, -7) # lint-amnesty, pylint: disable=range-builtin-not-iterating
offsets = range(-7, -77, -7)
def add_arguments(self, parser):
parser.add_argument(
@@ -42,7 +42,7 @@ class SendEmailBaseCommand(PrefixedDebugLoggerMixin, BaseCommand): # lint-amnes
num_weeks = options.get('weeks')
if num_weeks:
num_days = (7 * num_weeks) + 1
self.offsets = range(-7, -num_days, -7) # lint-amnesty, pylint: disable=range-builtin-not-iterating
self.offsets = range(-7, -num_days, -7)
current_date = datetime.datetime(
*[int(x) for x in options['date'].split('-')],

View File

@@ -546,7 +546,7 @@ class DeactivateLogoutView(APIView):
ace.send(notification)
except Exception as exc:
log.exception('Error sending out deletion notification email')
raise
raise exc
# Log the user out.
logout(request)

View File

@@ -145,7 +145,7 @@ class Command(BaseCommand):
return len(contacts)
except (HttpClientError, HttpServerError) as ex:
message = 'An error occurred while syncing batch of contacts for site {domain}, {message}'.format(
domain=site_conf.site.domain, message=ex.message # lint-amnesty, pylint: disable=no-member, exception-message-attribute
domain=site_conf.site.domain, message=ex.message # lint-amnesty, pylint: disable=no-member
)
self.stderr.write(message)
return 0

View File

@@ -423,7 +423,7 @@ class RegistrationFormFactory:
FormDescription.FIELD_TYPE_MAP.get(field.__class__))
if not field_type:
raise ImproperlyConfigured(
u"Field type '{}' not recognized for registration extension field '{}'.".format(
"Field type '{}' not recognized for registration extension field '{}'.".format(
field_type,
field_name
)

View File

@@ -660,12 +660,12 @@ class RegistrationViewTestV1(
self._assert_reg_absent_field(
no_extra_fields_setting,
{
"name": u"favorite_editor",
"type": u"select",
"name": "favorite_editor",
"type": "select",
"required": False,
"label": u"Favorite Editor",
"placeholder": u"cat",
"defaultValue": u"vim",
"label": "Favorite Editor",
"placeholder": "cat",
"defaultValue": "vim",
"errorMessages": {
'required': 'This field is required.',
'invalid_choice': 'Select a valid choice. %(value)s is not one of the available choices.',