lint: Clean up E121 PEP-8 rule.

This commit is contained in:
Tim Abbott 2017-01-23 21:02:39 -08:00
parent 6f0d2a9445
commit e9158dd520
15 changed files with 37 additions and 38 deletions

View File

@ -150,10 +150,10 @@ else:
for status in statuses[::-1][:options.limit_tweets]:
composed = "%s (%s)" % (status.user.name, status.user.screen_name)
message = {
"type": "stream",
"to": [options.stream],
"subject": composed,
"content": status.text,
"type": "stream",
"to": [options.stream],
"subject": composed,
"content": status.text,
}
ret = client.send_message(message)

View File

@ -176,10 +176,10 @@ for status in statuses[::-1][:opts.limit_tweets]:
search_term_used = "mentions"
message = {
"type": "stream",
"to": [opts.stream],
"subject": search_term_used,
"content": url,
"type": "stream",
"to": [opts.stream],
"subject": search_term_used,
"content": url,
}
ret = client.send_message(message)

View File

@ -32,12 +32,12 @@ def create_chat_bot(no_learn):
storage_adapter="chatterbot.storage.JsonFileStorageAdapter",
logic_adapters=
[
"chatterbot.logic.MathematicalEvaluation",
{
"import_path": "chatterbot.logic.BestMatch",
"response_selection_method": "chatterbot.response_selection.get_random_response",
"statement_comparison_function": "chatterbot.comparisons.levenshtein_distance"
}],
"chatterbot.logic.MathematicalEvaluation",
{
"import_path": "chatterbot.logic.BestMatch",
"response_selection_method": "chatterbot.response_selection.get_random_response",
"statement_comparison_function": "chatterbot.comparisons.levenshtein_distance"
}],
output_adapter="chatterbot.output.OutputFormatAdapter",
output_format='text',
database=DATABASE_PATH,

View File

@ -232,8 +232,8 @@ latex_elements = {
# (source start file, target name, title,
# author, documentclass [howto, manual, or own class]).
latex_documents = [
(master_doc, 'zulip-contributor-docs.tex', u'Zulip Documentation',
u'The Zulip Team', 'manual'),
(master_doc, 'zulip-contributor-docs.tex', u'Zulip Documentation',
u'The Zulip Team', 'manual'),
]
# The name of an image file (relative to this directory) to place at the top of
@ -276,9 +276,9 @@ man_pages = [
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents = [
(master_doc, 'zulip-contributor-docs', u'Zulip Documentation',
author, 'zulip-contributor-docs', 'Documentation for contributing to Zulip.',
'Miscellaneous'),
(master_doc, 'zulip-contributor-docs', u'Zulip Documentation',
author, 'zulip-contributor-docs', 'Documentation for contributing to Zulip.',
'Miscellaneous'),
]
# Documents to append as an appendix to all manuals.

View File

@ -12,7 +12,7 @@ sys.path.insert(0, root_dir)
from tools.lib.test_script import (
get_provisioning_status,
)
)
def run():
# type: () -> None

View File

@ -87,7 +87,7 @@ def check_pep8(files):
# ignored. It either doesn't fit with the style of the project or should
# actually be cleaned up.
#
'E121', 'E123', 'E126', 'E226', 'E241', 'E261', 'E302',
'E123', 'E126', 'E226', 'E241', 'E261', 'E302',
'E305', 'E306', 'E401', 'E501', 'E702', 'E711', 'E712', 'E713', 'E714',
'E741',
@ -235,7 +235,7 @@ def build_custom_checkers(by_lang):
{'pattern': '^#+[A-Za-z0-9]',
'strip': '\n',
'description': 'Missing space after # in heading'},
] # type: RuleList
] # type: RuleList
js_rules = cast(RuleList, [
{'pattern': '[^_]function\(',
'description': 'The keyword "function" should be followed by a space'},

View File

@ -403,8 +403,7 @@ def flush_stream(sender, **kwargs):
if kwargs.get('update_fields') is None or 'name' in kwargs['update_fields'] and \
UserProfile.objects.filter(
Q(default_sending_stream=stream) |
Q(default_events_register_stream=stream)
).exists():
Q(default_events_register_stream=stream)).exists():
cache_delete(active_bot_dicts_in_realm_cache_key(stream.realm))
# TODO: Rename to_dict_cache_key_id and to_dict_cache_key

View File

@ -88,13 +88,13 @@ def gather_hot_conversations(user_profile, stream_messages):
# We'll display up to 2 messages from the conversation.
first_few_messages = [user_message.message for user_message in
stream_messages.filter(
message__recipient__type_id=stream_id,
message__subject=subject)[:2]]
message__recipient__type_id=stream_id,
message__subject=subject)[:2]]
teaser_data = {"participants": users,
"count": count - len(first_few_messages),
"first_few_messages": build_message_list(
user_profile, first_few_messages)}
user_profile, first_few_messages)}
hot_conversation_render_payloads.append(teaser_data)
return hot_conversation_render_payloads

View File

@ -260,7 +260,7 @@ class Config(object):
self.table,
self.id_source[0],
self.virtual_parent.table,
))
))
def export_from_config(response, config, seed_object=None, context=None):

View File

@ -40,7 +40,7 @@ class Command(BaseCommand):
UserProfile.objects.filter(
is_bot=True, is_active=True, bot_owner=user_profile
).count()
))
))
if not options["for_real"]:
print("This was a dry run. Pass -f to actually deactivate.")

View File

@ -479,7 +479,7 @@ earl-test@zulip.com""", ["Denmark"]))
"We weren't able to invite anyone.")
self.assertRaises(PreregistrationUser.DoesNotExist,
lambda: PreregistrationUser.objects.get(
email="hamlet@zulip.com"))
email="hamlet@zulip.com"))
self.check_sent_emails([])
def test_invite_some_existing_some_new(self):
@ -503,7 +503,7 @@ so we didn't send them an invitation. We did send invitations to everyone else!"
for email in existing:
self.assertRaises(PreregistrationUser.DoesNotExist,
lambda: PreregistrationUser.objects.get(
email=email))
email=email))
for email in new:
self.assertTrue(PreregistrationUser.objects.get(email=email))

View File

@ -992,7 +992,7 @@ class BotTest(ZulipTestCase):
'full_name': 'The Bot of Hamlet',
'short_name': 'hambot',
'default_sending_stream': 'Denmark',
}
}
result = self.client_post("/json/bots", bot_info)
self.assert_json_error(result, 'Insufficient permission')
@ -1055,7 +1055,7 @@ class BotTest(ZulipTestCase):
'full_name': 'The Bot of Hamlet',
'short_name': 'hambot',
'default_events_register_stream': 'Denmark',
}
}
result = self.client_post("/json/bots", bot_info)
self.assert_json_error(result, 'Insufficient permission')

View File

@ -49,7 +49,7 @@ def github_pull_request_content(payload):
action,
pull_request['html_url'],
pull_request['number']
)
)
def github_issues_content(payload):
# type: (Mapping[Text, Any]) -> Text
@ -70,7 +70,7 @@ def github_issues_content(payload):
action,
issue['html_url'],
issue['number'],
)
)
def github_object_commented_content(payload, type):
# type: (Mapping[Text, Any], Text) -> Text
@ -104,7 +104,7 @@ def get_pull_request_or_issue_subject(repository, payload_object, type):
type=type,
id=payload_object['number'],
title=payload_object['title']
)
)
def github_generic_subject(noun, topic_focus, blob):
# type: (Text, Text, Mapping[Text, Any]) -> Text

View File

@ -98,7 +98,7 @@ def zulip_server_error(report):
internal_send_message(realm, settings.ERROR_BOT,
"stream", "errors", format_subject(subject),
"Error generated by %s\n\n~~~~ pytb\n%s\n\n~~~~\n%s" % (
user_info, stack_trace, request_repr))
user_info, stack_trace, request_repr))
def email_server_error(report):
# type: (Dict[str, Any]) -> None

View File

@ -558,7 +558,7 @@ if PRODUCTION:
{'var_name': 'NAGIOS_STAGING_RECEIVE_BOT',
'email_template': 'nagios-staging-receive-bot@%s',
'name': 'Nagios Staging Receive Bot'},
]
]
INTERNAL_BOT_DOMAIN = "zulip.com"