lint: Fix lines in Python codebase longer than 120 characters.

This commit is contained in:
Tim Abbott 2017-10-26 17:47:30 -07:00
parent b936e8c24b
commit 8e2cdedf9a
10 changed files with 27 additions and 15 deletions

View File

@ -586,7 +586,7 @@ def build_custom_checkers(by_lang):
for fn in by_lang['py']:
if 'custom_check.py' in fn:
continue
if custom_check_file(fn, 'py', python_rules, color, max_length=125):
if custom_check_file(fn, 'py', python_rules, color, max_length=120):
failed = True
return failed

View File

@ -458,7 +458,8 @@ def apply_event(state, event, user_profile, include_subscribers):
elif event['type'] == "presence":
# TODO: Add user_id to presence update events / state format!
presence_user_profile = get_user(event['email'], user_profile.realm)
state['presences'][event['email']] = UserPresence.get_status_dict_by_user(presence_user_profile)[event['email']]
state['presences'][event['email']] = UserPresence.get_status_dict_by_user(
presence_user_profile)[event['email']]
elif event['type'] == "update_message":
# We don't return messages in /register, so we don't need to
# do anything for content updates, but we may need to update

View File

@ -294,7 +294,8 @@ class MessageDict(object):
if rendered_content is not None:
obj['rendered_content'] = rendered_content
else:
obj['rendered_content'] = u'<p>[Zulip note: Sorry, we could not understand the formatting of your message]</p>'
obj['rendered_content'] = (u'<p>[Zulip note: Sorry, we could not ' +
u'understand the formatting of your message]</p>')
if rendered_content is not None:
obj['is_me_message'] = Message.is_status_message(content, rendered_content)

View File

@ -12,11 +12,13 @@ COMMIT_OR_COMMITS = u"commit{}"
PUSH_PUSHED_TEXT_WITH_URL = u"[pushed]({compare_url}) {number_of_commits} {commit_or_commits}"
PUSH_PUSHED_TEXT_WITHOUT_URL = u"pushed {number_of_commits} {commit_or_commits}"
PUSH_COMMITS_MESSAGE_TEMPLATE_WITH_COMMITTERS = u"""{user_name} {pushed_text} to branch {branch_name}. {committers_details}.
PUSH_COMMITS_BASE = '{user_name} {pushed_text} to branch {branch_name}.'
PUSH_COMMITS_MESSAGE_TEMPLATE_WITH_COMMITTERS = PUSH_COMMITS_BASE + u""" {committers_details}.
{commits_data}
"""
PUSH_COMMITS_MESSAGE_TEMPLATE_WITHOUT_COMMITTERS = u"""{user_name} {pushed_text} to branch {branch_name}.
PUSH_COMMITS_MESSAGE_TEMPLATE_WITHOUT_COMMITTERS = PUSH_COMMITS_BASE + u"""
{commits_data}
"""
@ -45,7 +47,8 @@ TAG_WITH_URL_TEMPLATE = u"[{tag_name}]({tag_url})"
TAG_WITHOUT_URL_TEMPLATE = u"{tag_name}"
def get_push_commits_event_message(user_name, compare_url, branch_name, commits_data, is_truncated=False, deleted=False):
def get_push_commits_event_message(user_name, compare_url, branch_name,
commits_data, is_truncated=False, deleted=False):
# type: (Text, Optional[Text], Text, List[Dict[str, Any]], Optional[bool], Optional[bool]) -> Text
if not commits_data and deleted:
return PUSH_DELETE_BRANCH_MESSAGE_TEMPLATE.format(

View File

@ -54,7 +54,8 @@ class Command(BaseCommand):
email_gateway_bot.save()
self.stdout.write("Successfully populated database with initial data.\n")
self.stdout.write("Please run ./manage.py generate_realm_creation_link to generate link for creating organization")
self.stdout.write("Please run ./manage.py generate_realm_creation_link "
"to generate link for creating organization")
site = Site.objects.get_current()
site.domain = settings.EXTERNAL_HOST

View File

@ -17,7 +17,8 @@ NOTE: Regexes must be simple enough that they can be easily translated to JavaSc
* Named groups will be converted to numbered groups automatically
* Inline-regex flags will be stripped, and where possible translated to RegExp-wide flags
Example: ./manage.py realm_filters --realm=zulip --op=add '#(?P<id>[0-9]{2,8})' 'https://trac.humbughq.com/ticket/%(id)s'
Example: ./manage.py realm_filters --realm=zulip --op=add '#(?P<id>[0-9]{2,8})' \
'https://support.example.com/ticket/%(id)s'
Example: ./manage.py realm_filters --realm=zulip --op=remove '#(?P<id>[0-9]{2,8})'
Example: ./manage.py realm_filters --realm=zulip --op=show
"""

View File

@ -83,7 +83,8 @@ class Command(ZulipBaseCommand):
user_emails_found = [user.email for user in users_to_deactivate]
for user in user_emails:
if user not in user_emails_found:
raise Exception('User with email %s was not found. Check if the email is correct.' % (user))
raise Exception('User with email %s was not found. '
'Check if the email is correct.' % (user,))
print('Soft deactivating forcefully...')
else:
if realm is not None:

View File

@ -151,10 +151,12 @@ def api_endpoint_docs(request):
calls = ujson.loads(raw_calls)
langs = set()
for call in calls:
call["endpoint"] = "%s/v1/%s" % (context["external_api_uri_subdomain"],
call["endpoint"])
call["example_request"]["curl"] = call["example_request"]["curl"].replace("https://api.zulip.com",
context["external_api_uri_subdomain"])
call["endpoint"] = "%s/v1/%s" % (
context["external_api_uri_subdomain"],
call["endpoint"])
call["example_request"]["curl"] = call["example_request"]["curl"].replace(
"https://api.zulip.com",
context["external_api_uri_subdomain"])
response = call['example_response']
if '\n' not in response:
# For 1-line responses, pretty-print them

View File

@ -40,7 +40,8 @@ def api_opsgenie_webhook(request, user_profile,
if 'message' in payload['alert']:
info['additional_info'] += "Message: *{}*\n".format(payload['alert']['message'])
body = ''
body_template = "**OpsGenie: [Alert for {integration_name}.](https://app.opsgenie.com/alert/V2#/show/{alert_id})**\n" \
body_template = "**OpsGenie: [Alert for {integration_name}.]" \
"(https://app.opsgenie.com/alert/V2#/show/{alert_id})**\n" \
"Type: *{alert_type}*\n" \
"{additional_info}" \
"{tags}"

View File

@ -447,7 +447,8 @@ class ZulipLDAPAuthBackend(ZulipLDAPAuthBackendBase):
if settings.LDAP_EMAIL_ATTR is not None:
# Get email from ldap attributes.
if settings.LDAP_EMAIL_ATTR not in ldap_user.attrs:
raise ZulipLDAPException("LDAP user doesn't have the needed %s attribute" % (settings.LDAP_EMAIL_ATTR,))
raise ZulipLDAPException("LDAP user doesn't have the needed %s attribute" % (
settings.LDAP_EMAIL_ATTR,))
username = ldap_user.attrs[settings.LDAP_EMAIL_ATTR][0]