lint: Fix % comprehensions being used without a tuple.

This commit is contained in:
Tim Abbott 2017-01-09 11:45:11 -08:00
parent 494c1a2b55
commit 3f8d4193da
9 changed files with 13 additions and 11 deletions

View File

@ -942,7 +942,7 @@ def get_realm_activity(request, realm_str):
data += [(page_title, content)]
realm_link = 'https://stats1.zulip.net:444/render/?from=-7days'
realm_link += '&target=stats.gauges.staging.users.active.%s.0_16hr' % (realm_str)
realm_link += '&target=stats.gauges.staging.users.active.%s.0_16hr' % (realm_str,)
title = realm_str
return render_to_response(

View File

@ -143,7 +143,7 @@ def send_reminders():
key = (id, start)
if key not in sent:
if start.hour == 0 and start.minute == 0:
line = '%s is today.' % (summary)
line = '%s is today.' % (summary,)
else:
line = '%s starts at %s' % (summary, start.strftime('%H:%M'))
print('Sending reminder:', line)

View File

@ -87,7 +87,7 @@ def get_xkcd_bot_response(message):
except XkcdNotFoundError:
logging.exception('XKCD server responded 404 when trying to fetch comic with id %s'
% (command))
return 'Sorry, there is likely no xkcd comic strip with id: #%s' % (command)
return 'Sorry, there is likely no xkcd comic strip with id: #%s' % (command,)
else:
return ("#%s: **%s**\n[%s](%s)" % (fetched['num'],
fetched['title'],

View File

@ -292,6 +292,8 @@ def build_custom_checkers(by_lang):
('tools/tests/test_template_parser.py', '{% foo'),
]),
'description': 'Used % comprehension without a tuple'},
{'pattern': '.*%s.* % \([a-zA-Z0-9_.]*\)$',
'description': 'Used % comprehension without a tuple'},
{'pattern': 'json_success\({}\)',
'description': 'Use json_success() to return nothing'},
# To avoid json_error(_variable) and json_error(_(variable))

View File

@ -658,7 +658,7 @@ class UnicodeEmoji(markdown.inlinepatterns.Pattern):
orig_syntax = match.group('syntax')
name = hex(ord(orig_syntax))[2:]
if name in unicode_emoji_list:
src = '/static/generated/emoji/images/emoji/unicode/%s.png' % (name)
src = '/static/generated/emoji/images/emoji/unicode/%s.png' % (name,)
return make_emoji(name, src, orig_syntax)
else:
return None
@ -676,7 +676,7 @@ class Emoji(markdown.inlinepatterns.Pattern):
if current_message and name in realm_emoji:
return make_emoji(name, realm_emoji[name]['display_url'], orig_syntax)
elif name in emoji_list:
src = '/static/generated/emoji/images/emoji/%s.png' % (name)
src = '/static/generated/emoji/images/emoji/%s.png' % (name,)
return make_emoji(name, src, orig_syntax)
else:
return None

View File

@ -147,7 +147,7 @@ def build_message_list(user_profile, messages):
# type: (UserProfile, Message) -> Dict[str, Any]
disp_recipient = get_display_recipient(message.recipient)
if message.recipient.type == Recipient.PERSONAL:
header = u"You and %s" % (message.sender.full_name)
header = u"You and %s" % (message.sender.full_name,)
html_link = pm_narrow_url(user_profile.realm, [message.sender.email])
header_html = u"<a style='color: #ffffff;' href='%s'>%s</a>" % (html_link, header)
elif message.recipient.type == Recipient.HUDDLE:

View File

@ -195,7 +195,7 @@ class S3UploadBackend(ZulipUploadBackend):
random_name(18),
sanitize_name(uploaded_file_name)
])
url = "/user_uploads/%s" % (s3_file_name)
url = "/user_uploads/%s" % (s3_file_name,)
upload_image_to_s3(
bucket_name,

View File

@ -44,7 +44,7 @@ def api_solano_webhook(request, user_profile, client,
elif status in neutral_status:
emoji = ':arrows_counterclockwise:'
else:
emoji = "(No emoji specified for status '%s'.)" % (status)
emoji = "(No emoji specified for status '%s'.)" % (status,)
template = (
u'Author: {}\n'

View File

@ -59,13 +59,13 @@ def api_teamcity_webhook(request, user_profile, client, payload=REQ(argument_typ
status = 'was successful! :thumbsup:'
elif build_result == 'failure':
if build_result_delta == 'broken':
status = 'is broken with status %s! :thumbsdown:' % (build_status)
status = 'is broken with status %s! :thumbsdown:' % (build_status,)
else:
status = 'is still broken with status %s! :thumbsdown:' % (build_status)
status = 'is still broken with status %s! :thumbsdown:' % (build_status,)
elif build_result == 'running':
status = 'has started.'
else:
status = '(has no message specified for status %s)' % (build_status)
status = '(has no message specified for status %s)' % (build_status,)
template = (
u'%s build %s %s\n'