Ignore pylint error 7610 (translation-of-non-string) on where it is intended to do
As some i18n features need ```ugettext``` or its shorcut ```_``` to be called on a non-string-literal, so the pylint check of ```translation-of-non-string``` should be explicitly disabled in such situations.
This commit is contained in:
@@ -132,12 +132,12 @@ def localize_checklist_text(checklist):
|
||||
The method does an in-place operation so the input checklist is modified directly.
|
||||
"""
|
||||
# Localize checklist name
|
||||
checklist['short_description'] = ugettext(checklist['short_description'])
|
||||
checklist['short_description'] = ugettext(checklist['short_description']) # pylint: disable=translation-of-non-string
|
||||
|
||||
# Localize checklist items
|
||||
for item in checklist.get('items'):
|
||||
item['short_description'] = ugettext(item['short_description'])
|
||||
item['long_description'] = ugettext(item['long_description'])
|
||||
item['action_text'] = ugettext(item['action_text'])
|
||||
item['short_description'] = ugettext(item['short_description']) # pylint: disable=translation-of-non-string
|
||||
item['long_description'] = ugettext(item['long_description']) # pylint: disable=translation-of-non-string
|
||||
item['action_text'] = ugettext(item['action_text']) # pylint: disable=translation-of-non-string
|
||||
|
||||
return checklist
|
||||
|
||||
@@ -275,7 +275,7 @@ def get_component_templates(courselike, library=False):
|
||||
if not filter_templates or filter_templates(template, courselike):
|
||||
templates_for_category.append(
|
||||
create_template_dict(
|
||||
_(template['metadata'].get('display_name')),
|
||||
_(template['metadata'].get('display_name')), # pylint: disable=translation-of-non-string
|
||||
category,
|
||||
template.get('template_id'),
|
||||
template['metadata'].get('markdown') is not None
|
||||
|
||||
@@ -73,7 +73,7 @@ class StatusDisplayStrings(object):
|
||||
@staticmethod
|
||||
def get(val_status):
|
||||
"""Map a VAL status string to a localized display string"""
|
||||
return _(StatusDisplayStrings._STATUS_MAP.get(val_status, StatusDisplayStrings._UNKNOWN))
|
||||
return _(StatusDisplayStrings._STATUS_MAP.get(val_status, StatusDisplayStrings._UNKNOWN)) # pylint: disable=translation-of-non-string
|
||||
|
||||
|
||||
@expect_json
|
||||
|
||||
@@ -96,8 +96,8 @@ class CourseMetadata(object):
|
||||
continue
|
||||
result[field.name] = {
|
||||
'value': field.read_json(descriptor),
|
||||
'display_name': _(field.display_name),
|
||||
'help': _(field.help),
|
||||
'display_name': _(field.display_name), # pylint: disable=translation-of-non-string
|
||||
'help': _(field.help), # pylint: disable=translation-of-non-string
|
||||
'deprecated': field.runtime_options.get('deprecated', False)
|
||||
}
|
||||
return result
|
||||
|
||||
Reference in New Issue
Block a user