mirror of https://github.com/zulip/zulip.git
lint: Clean up E121 PEP-8 rule.
This commit is contained in:
parent
6f0d2a9445
commit
e9158dd520
|
@ -150,10 +150,10 @@ else:
|
||||||
for status in statuses[::-1][:options.limit_tweets]:
|
for status in statuses[::-1][:options.limit_tweets]:
|
||||||
composed = "%s (%s)" % (status.user.name, status.user.screen_name)
|
composed = "%s (%s)" % (status.user.name, status.user.screen_name)
|
||||||
message = {
|
message = {
|
||||||
"type": "stream",
|
"type": "stream",
|
||||||
"to": [options.stream],
|
"to": [options.stream],
|
||||||
"subject": composed,
|
"subject": composed,
|
||||||
"content": status.text,
|
"content": status.text,
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = client.send_message(message)
|
ret = client.send_message(message)
|
||||||
|
|
|
@ -176,10 +176,10 @@ for status in statuses[::-1][:opts.limit_tweets]:
|
||||||
search_term_used = "mentions"
|
search_term_used = "mentions"
|
||||||
|
|
||||||
message = {
|
message = {
|
||||||
"type": "stream",
|
"type": "stream",
|
||||||
"to": [opts.stream],
|
"to": [opts.stream],
|
||||||
"subject": search_term_used,
|
"subject": search_term_used,
|
||||||
"content": url,
|
"content": url,
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = client.send_message(message)
|
ret = client.send_message(message)
|
||||||
|
|
|
@ -32,12 +32,12 @@ def create_chat_bot(no_learn):
|
||||||
storage_adapter="chatterbot.storage.JsonFileStorageAdapter",
|
storage_adapter="chatterbot.storage.JsonFileStorageAdapter",
|
||||||
logic_adapters=
|
logic_adapters=
|
||||||
[
|
[
|
||||||
"chatterbot.logic.MathematicalEvaluation",
|
"chatterbot.logic.MathematicalEvaluation",
|
||||||
{
|
{
|
||||||
"import_path": "chatterbot.logic.BestMatch",
|
"import_path": "chatterbot.logic.BestMatch",
|
||||||
"response_selection_method": "chatterbot.response_selection.get_random_response",
|
"response_selection_method": "chatterbot.response_selection.get_random_response",
|
||||||
"statement_comparison_function": "chatterbot.comparisons.levenshtein_distance"
|
"statement_comparison_function": "chatterbot.comparisons.levenshtein_distance"
|
||||||
}],
|
}],
|
||||||
output_adapter="chatterbot.output.OutputFormatAdapter",
|
output_adapter="chatterbot.output.OutputFormatAdapter",
|
||||||
output_format='text',
|
output_format='text',
|
||||||
database=DATABASE_PATH,
|
database=DATABASE_PATH,
|
||||||
|
|
10
docs/conf.py
10
docs/conf.py
|
@ -232,8 +232,8 @@ latex_elements = {
|
||||||
# (source start file, target name, title,
|
# (source start file, target name, title,
|
||||||
# author, documentclass [howto, manual, or own class]).
|
# author, documentclass [howto, manual, or own class]).
|
||||||
latex_documents = [
|
latex_documents = [
|
||||||
(master_doc, 'zulip-contributor-docs.tex', u'Zulip Documentation',
|
(master_doc, 'zulip-contributor-docs.tex', u'Zulip Documentation',
|
||||||
u'The Zulip Team', 'manual'),
|
u'The Zulip Team', 'manual'),
|
||||||
]
|
]
|
||||||
|
|
||||||
# The name of an image file (relative to this directory) to place at the top of
|
# 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,
|
# (source start file, target name, title, author,
|
||||||
# dir menu entry, description, category)
|
# dir menu entry, description, category)
|
||||||
texinfo_documents = [
|
texinfo_documents = [
|
||||||
(master_doc, 'zulip-contributor-docs', u'Zulip Documentation',
|
(master_doc, 'zulip-contributor-docs', u'Zulip Documentation',
|
||||||
author, 'zulip-contributor-docs', 'Documentation for contributing to Zulip.',
|
author, 'zulip-contributor-docs', 'Documentation for contributing to Zulip.',
|
||||||
'Miscellaneous'),
|
'Miscellaneous'),
|
||||||
]
|
]
|
||||||
|
|
||||||
# Documents to append as an appendix to all manuals.
|
# Documents to append as an appendix to all manuals.
|
||||||
|
|
|
@ -12,7 +12,7 @@ sys.path.insert(0, root_dir)
|
||||||
|
|
||||||
from tools.lib.test_script import (
|
from tools.lib.test_script import (
|
||||||
get_provisioning_status,
|
get_provisioning_status,
|
||||||
)
|
)
|
||||||
|
|
||||||
def run():
|
def run():
|
||||||
# type: () -> None
|
# type: () -> None
|
||||||
|
|
|
@ -87,7 +87,7 @@ def check_pep8(files):
|
||||||
# ignored. It either doesn't fit with the style of the project or should
|
# ignored. It either doesn't fit with the style of the project or should
|
||||||
# actually be cleaned up.
|
# 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',
|
'E305', 'E306', 'E401', 'E501', 'E702', 'E711', 'E712', 'E713', 'E714',
|
||||||
'E741',
|
'E741',
|
||||||
|
|
||||||
|
@ -235,7 +235,7 @@ def build_custom_checkers(by_lang):
|
||||||
{'pattern': '^#+[A-Za-z0-9]',
|
{'pattern': '^#+[A-Za-z0-9]',
|
||||||
'strip': '\n',
|
'strip': '\n',
|
||||||
'description': 'Missing space after # in heading'},
|
'description': 'Missing space after # in heading'},
|
||||||
] # type: RuleList
|
] # type: RuleList
|
||||||
js_rules = cast(RuleList, [
|
js_rules = cast(RuleList, [
|
||||||
{'pattern': '[^_]function\(',
|
{'pattern': '[^_]function\(',
|
||||||
'description': 'The keyword "function" should be followed by a space'},
|
'description': 'The keyword "function" should be followed by a space'},
|
||||||
|
|
|
@ -403,8 +403,7 @@ def flush_stream(sender, **kwargs):
|
||||||
if kwargs.get('update_fields') is None or 'name' in kwargs['update_fields'] and \
|
if kwargs.get('update_fields') is None or 'name' in kwargs['update_fields'] and \
|
||||||
UserProfile.objects.filter(
|
UserProfile.objects.filter(
|
||||||
Q(default_sending_stream=stream) |
|
Q(default_sending_stream=stream) |
|
||||||
Q(default_events_register_stream=stream)
|
Q(default_events_register_stream=stream)).exists():
|
||||||
).exists():
|
|
||||||
cache_delete(active_bot_dicts_in_realm_cache_key(stream.realm))
|
cache_delete(active_bot_dicts_in_realm_cache_key(stream.realm))
|
||||||
|
|
||||||
# TODO: Rename to_dict_cache_key_id and to_dict_cache_key
|
# TODO: Rename to_dict_cache_key_id and to_dict_cache_key
|
||||||
|
|
|
@ -88,13 +88,13 @@ def gather_hot_conversations(user_profile, stream_messages):
|
||||||
# We'll display up to 2 messages from the conversation.
|
# We'll display up to 2 messages from the conversation.
|
||||||
first_few_messages = [user_message.message for user_message in
|
first_few_messages = [user_message.message for user_message in
|
||||||
stream_messages.filter(
|
stream_messages.filter(
|
||||||
message__recipient__type_id=stream_id,
|
message__recipient__type_id=stream_id,
|
||||||
message__subject=subject)[:2]]
|
message__subject=subject)[:2]]
|
||||||
|
|
||||||
teaser_data = {"participants": users,
|
teaser_data = {"participants": users,
|
||||||
"count": count - len(first_few_messages),
|
"count": count - len(first_few_messages),
|
||||||
"first_few_messages": build_message_list(
|
"first_few_messages": build_message_list(
|
||||||
user_profile, first_few_messages)}
|
user_profile, first_few_messages)}
|
||||||
|
|
||||||
hot_conversation_render_payloads.append(teaser_data)
|
hot_conversation_render_payloads.append(teaser_data)
|
||||||
return hot_conversation_render_payloads
|
return hot_conversation_render_payloads
|
||||||
|
|
|
@ -260,7 +260,7 @@ class Config(object):
|
||||||
self.table,
|
self.table,
|
||||||
self.id_source[0],
|
self.id_source[0],
|
||||||
self.virtual_parent.table,
|
self.virtual_parent.table,
|
||||||
))
|
))
|
||||||
|
|
||||||
|
|
||||||
def export_from_config(response, config, seed_object=None, context=None):
|
def export_from_config(response, config, seed_object=None, context=None):
|
||||||
|
|
|
@ -40,7 +40,7 @@ class Command(BaseCommand):
|
||||||
UserProfile.objects.filter(
|
UserProfile.objects.filter(
|
||||||
is_bot=True, is_active=True, bot_owner=user_profile
|
is_bot=True, is_active=True, bot_owner=user_profile
|
||||||
).count()
|
).count()
|
||||||
))
|
))
|
||||||
|
|
||||||
if not options["for_real"]:
|
if not options["for_real"]:
|
||||||
print("This was a dry run. Pass -f to actually deactivate.")
|
print("This was a dry run. Pass -f to actually deactivate.")
|
||||||
|
|
|
@ -479,7 +479,7 @@ earl-test@zulip.com""", ["Denmark"]))
|
||||||
"We weren't able to invite anyone.")
|
"We weren't able to invite anyone.")
|
||||||
self.assertRaises(PreregistrationUser.DoesNotExist,
|
self.assertRaises(PreregistrationUser.DoesNotExist,
|
||||||
lambda: PreregistrationUser.objects.get(
|
lambda: PreregistrationUser.objects.get(
|
||||||
email="hamlet@zulip.com"))
|
email="hamlet@zulip.com"))
|
||||||
self.check_sent_emails([])
|
self.check_sent_emails([])
|
||||||
|
|
||||||
def test_invite_some_existing_some_new(self):
|
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:
|
for email in existing:
|
||||||
self.assertRaises(PreregistrationUser.DoesNotExist,
|
self.assertRaises(PreregistrationUser.DoesNotExist,
|
||||||
lambda: PreregistrationUser.objects.get(
|
lambda: PreregistrationUser.objects.get(
|
||||||
email=email))
|
email=email))
|
||||||
for email in new:
|
for email in new:
|
||||||
self.assertTrue(PreregistrationUser.objects.get(email=email))
|
self.assertTrue(PreregistrationUser.objects.get(email=email))
|
||||||
|
|
||||||
|
|
|
@ -992,7 +992,7 @@ class BotTest(ZulipTestCase):
|
||||||
'full_name': 'The Bot of Hamlet',
|
'full_name': 'The Bot of Hamlet',
|
||||||
'short_name': 'hambot',
|
'short_name': 'hambot',
|
||||||
'default_sending_stream': 'Denmark',
|
'default_sending_stream': 'Denmark',
|
||||||
}
|
}
|
||||||
result = self.client_post("/json/bots", bot_info)
|
result = self.client_post("/json/bots", bot_info)
|
||||||
self.assert_json_error(result, 'Insufficient permission')
|
self.assert_json_error(result, 'Insufficient permission')
|
||||||
|
|
||||||
|
@ -1055,7 +1055,7 @@ class BotTest(ZulipTestCase):
|
||||||
'full_name': 'The Bot of Hamlet',
|
'full_name': 'The Bot of Hamlet',
|
||||||
'short_name': 'hambot',
|
'short_name': 'hambot',
|
||||||
'default_events_register_stream': 'Denmark',
|
'default_events_register_stream': 'Denmark',
|
||||||
}
|
}
|
||||||
result = self.client_post("/json/bots", bot_info)
|
result = self.client_post("/json/bots", bot_info)
|
||||||
self.assert_json_error(result, 'Insufficient permission')
|
self.assert_json_error(result, 'Insufficient permission')
|
||||||
|
|
||||||
|
|
|
@ -49,7 +49,7 @@ def github_pull_request_content(payload):
|
||||||
action,
|
action,
|
||||||
pull_request['html_url'],
|
pull_request['html_url'],
|
||||||
pull_request['number']
|
pull_request['number']
|
||||||
)
|
)
|
||||||
|
|
||||||
def github_issues_content(payload):
|
def github_issues_content(payload):
|
||||||
# type: (Mapping[Text, Any]) -> Text
|
# type: (Mapping[Text, Any]) -> Text
|
||||||
|
@ -70,7 +70,7 @@ def github_issues_content(payload):
|
||||||
action,
|
action,
|
||||||
issue['html_url'],
|
issue['html_url'],
|
||||||
issue['number'],
|
issue['number'],
|
||||||
)
|
)
|
||||||
|
|
||||||
def github_object_commented_content(payload, type):
|
def github_object_commented_content(payload, type):
|
||||||
# type: (Mapping[Text, Any], Text) -> Text
|
# type: (Mapping[Text, Any], Text) -> Text
|
||||||
|
@ -104,7 +104,7 @@ def get_pull_request_or_issue_subject(repository, payload_object, type):
|
||||||
type=type,
|
type=type,
|
||||||
id=payload_object['number'],
|
id=payload_object['number'],
|
||||||
title=payload_object['title']
|
title=payload_object['title']
|
||||||
)
|
)
|
||||||
|
|
||||||
def github_generic_subject(noun, topic_focus, blob):
|
def github_generic_subject(noun, topic_focus, blob):
|
||||||
# type: (Text, Text, Mapping[Text, Any]) -> Text
|
# type: (Text, Text, Mapping[Text, Any]) -> Text
|
||||||
|
|
|
@ -98,7 +98,7 @@ def zulip_server_error(report):
|
||||||
internal_send_message(realm, settings.ERROR_BOT,
|
internal_send_message(realm, settings.ERROR_BOT,
|
||||||
"stream", "errors", format_subject(subject),
|
"stream", "errors", format_subject(subject),
|
||||||
"Error generated by %s\n\n~~~~ pytb\n%s\n\n~~~~\n%s" % (
|
"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):
|
def email_server_error(report):
|
||||||
# type: (Dict[str, Any]) -> None
|
# type: (Dict[str, Any]) -> None
|
||||||
|
|
|
@ -558,7 +558,7 @@ if PRODUCTION:
|
||||||
{'var_name': 'NAGIOS_STAGING_RECEIVE_BOT',
|
{'var_name': 'NAGIOS_STAGING_RECEIVE_BOT',
|
||||||
'email_template': 'nagios-staging-receive-bot@%s',
|
'email_template': 'nagios-staging-receive-bot@%s',
|
||||||
'name': 'Nagios Staging Receive Bot'},
|
'name': 'Nagios Staging Receive Bot'},
|
||||||
]
|
]
|
||||||
|
|
||||||
INTERNAL_BOT_DOMAIN = "zulip.com"
|
INTERNAL_BOT_DOMAIN = "zulip.com"
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue