pep8: Fix E125.

This commit is contained in:
Bickio 2016-12-01 09:54:51 +13:00 committed by Tim Abbott
parent e009383460
commit 6b0df43463
9 changed files with 23 additions and 20 deletions

View File

@ -103,9 +103,9 @@ def unwrap_lines(body):
and re.match(r'^\W', previous_line, flags=re.UNICODE)): and re.match(r'^\W', previous_line, flags=re.UNICODE)):
result += previous_line + "\n" result += previous_line + "\n"
elif (line == "" or elif (line == "" or
previous_line == "" or previous_line == "" or
re.match(r'^\W', line, flags=re.UNICODE) or re.match(r'^\W', line, flags=re.UNICODE) or
different_paragraph(previous_line, line)): different_paragraph(previous_line, line)):
# Use 2 newlines to separate sections so that we # Use 2 newlines to separate sections so that we
# trigger proper Markdown processing on things like # trigger proper Markdown processing on things like
# bulleted lists # bulleted lists
@ -622,7 +622,7 @@ Feedback button or at support@zulipchat.com."""
# appropriate WHITESPACE instance for bidirectional mirroring # appropriate WHITESPACE instance for bidirectional mirroring
instance = match_whitespace_instance.group(1) instance = match_whitespace_instance.group(1)
elif (instance == "instance %s" % (zephyr_class,) or elif (instance == "instance %s" % (zephyr_class,) or
instance == "test instance %s" % (zephyr_class,)): instance == "test instance %s" % (zephyr_class,)):
# Forward messages to e.g. -c -i white-magic back from the # Forward messages to e.g. -c -i white-magic back from the
# place we forward them to # place we forward them to
if instance.startswith("test"): if instance.startswith("test"):

View File

@ -121,7 +121,7 @@ def get_zulips():
return [event['message'] for event in res['events']] return [event['message'] for event in res['events']]
if "staging" in options.site and settings.NAGIOS_STAGING_SEND_BOT is not None and \ if "staging" in options.site and settings.NAGIOS_STAGING_SEND_BOT is not None and \
settings.NAGIOS_STAGING_RECEIVE_BOT is not None: settings.NAGIOS_STAGING_RECEIVE_BOT is not None:
sender = get_user_profile_by_email(settings.NAGIOS_STAGING_SEND_BOT) sender = get_user_profile_by_email(settings.NAGIOS_STAGING_SEND_BOT)
recipient = get_user_profile_by_email(settings.NAGIOS_STAGING_RECEIVE_BOT) recipient = get_user_profile_by_email(settings.NAGIOS_STAGING_RECEIVE_BOT)
else: else:

View File

@ -82,7 +82,7 @@ def check_pep8(files):
# type: (List[str]) -> bool # type: (List[str]) -> bool
failed = False failed = False
ignored_rules = [ ignored_rules = [
'E402', 'E501', 'W503', 'E711', 'E201', 'E203', 'E202', 'E128', 'E226', 'E124', 'E125', 'E402', 'E501', 'W503', 'E711', 'E201', 'E203', 'E202', 'E128', 'E226', 'E124',
'E126', 'E127', 'E121', 'E122', 'E123', 'E266', 'E265', 'E261', 'E221', 'E303', 'E126', 'E127', 'E121', 'E122', 'E123', 'E266', 'E265', 'E261', 'E221', 'E303',
'E241', 'E712', 'E702', 'E401', 'E115', 'E114', 'E111', 'E731', 'E302', 'E129', 'E241', 'E712', 'E702', 'E401', 'E115', 'E114', 'E111', 'E731', 'E302', 'E129',
'E741', 'E714', 'W391', 'E211', 'E713', 'E502', 'E131', 'E305', 'E251', 'E306', 'E741', 'E714', 'W391', 'E211', 'E713', 'E502', 'E131', 'E305', 'E251', 'E306',

View File

@ -816,8 +816,10 @@ class BugdownUListPreprocessor(markdown.preprocessors.Preprocessor):
# If we're not in a fenced block and we detect an upcoming list # If we're not in a fenced block and we detect an upcoming list
# hanging off a paragraph, add a newline # hanging off a paragraph, add a newline
if not fence and lines[i] and \ if (not fence and lines[i] and
self.LI_RE.match(lines[i+1]) and not self.LI_RE.match(lines[i]): self.LI_RE.match(lines[i+1]) and
not self.LI_RE.match(lines[i])):
copy.insert(i+inserts+1, '') copy.insert(i+inserts+1, '')
inserts += 1 inserts += 1
return copy return copy

View File

@ -335,7 +335,8 @@ def flush_user_profile(sender, **kwargs):
# Invalidate our active_users_in_realm info dict if any user has changed # Invalidate our active_users_in_realm info dict if any user has changed
# the fields in the dict or become (in)active # the fields in the dict or become (in)active
if kwargs.get('update_fields') is None or \ if kwargs.get('update_fields') is None or \
len(set(active_user_dict_fields + ['is_active']) & set(kwargs['update_fields'])) > 0: len(set(active_user_dict_fields + ['is_active']) &
set(kwargs['update_fields'])) > 0:
cache_delete(active_user_dicts_in_realm_cache_key(user_profile.realm)) cache_delete(active_user_dicts_in_realm_cache_key(user_profile.realm))
# Invalidate our active_bots_in_realm info dict if any bot has # Invalidate our active_bots_in_realm info dict if any bot has
@ -399,4 +400,3 @@ def flush_message(sender, **kwargs):
message = kwargs['instance'] message = kwargs['instance']
cache_delete(to_dict_cache_key(message, False)) cache_delete(to_dict_cache_key(message, False))
cache_delete(to_dict_cache_key(message, True)) cache_delete(to_dict_cache_key(message, True))

View File

@ -98,8 +98,7 @@ def is_template_database_current(
database_name='zulip_test_template', database_name='zulip_test_template',
migration_status='var/migration-status', migration_status='var/migration-status',
settings='zproject.test_settings', settings='zproject.test_settings',
check_files=None check_files=None):
):
# type: (Optional[text_type], Optional[text_type], Optional[text_type], Optional[List[str]]) -> bool # type: (Optional[text_type], Optional[text_type], Optional[text_type], Optional[List[str]]) -> bool
# Using str type for check_files because re.split doesn't accept unicode # Using str type for check_files because re.split doesn't accept unicode
if check_files is None: if check_files is None:

View File

@ -137,8 +137,7 @@ def upload_image_to_s3(
file_name, file_name,
content_type, content_type,
user_profile, user_profile,
contents, contents):
):
# type: (NonBinaryStr, text_type, Optional[text_type], UserProfile, binary_type) -> None # type: (NonBinaryStr, text_type, Optional[text_type], UserProfile, binary_type) -> None
conn = S3Connection(settings.S3_KEY, settings.S3_SECRET_KEY) conn = S3Connection(settings.S3_KEY, settings.S3_SECRET_KEY)

View File

@ -93,7 +93,7 @@ def json_time_setting(request, user_profile, twenty_four_hour_time=REQ(validator
# type: (HttpRequest, UserProfile, Optional[bool]) -> HttpResponse # type: (HttpRequest, UserProfile, Optional[bool]) -> HttpResponse
result = {} result = {}
if twenty_four_hour_time is not None and \ if twenty_four_hour_time is not None and \
user_profile.twenty_four_hour_time != twenty_four_hour_time: user_profile.twenty_four_hour_time != twenty_four_hour_time:
do_change_twenty_four_hour_time(user_profile, twenty_four_hour_time) do_change_twenty_four_hour_time(user_profile, twenty_four_hour_time)
result['twenty_four_hour_time'] = twenty_four_hour_time result['twenty_four_hour_time'] = twenty_four_hour_time
@ -105,8 +105,9 @@ def json_time_setting(request, user_profile, twenty_four_hour_time=REQ(validator
def json_left_side_userlist(request, user_profile, left_side_userlist=REQ(validator=check_bool, default=None)): def json_left_side_userlist(request, user_profile, left_side_userlist=REQ(validator=check_bool, default=None)):
# type: (HttpRequest, UserProfile, Optional[bool]) -> HttpResponse # type: (HttpRequest, UserProfile, Optional[bool]) -> HttpResponse
result = {} result = {}
if left_side_userlist is not None and \ if (left_side_userlist is not None and \
user_profile.left_side_userlist != left_side_userlist: user_profile.left_side_userlist != left_side_userlist):
do_change_left_side_userlist(user_profile, left_side_userlist) do_change_left_side_userlist(user_profile, left_side_userlist)
result['left_side_userlist'] = left_side_userlist result['left_side_userlist'] = left_side_userlist

View File

@ -228,8 +228,10 @@ def add_bot_backend(request, user_profile, full_name=REQ(), short_name=REQ(),
default_sending_stream = None default_sending_stream = None
if default_sending_stream_name is not None: if default_sending_stream_name is not None:
default_sending_stream = stream_or_none(default_sending_stream_name, user_profile.realm) default_sending_stream = stream_or_none(default_sending_stream_name, user_profile.realm)
if default_sending_stream and not default_sending_stream.is_public() and not \ if (default_sending_stream and not
subscribed_to_stream(user_profile, default_sending_stream): default_sending_stream.is_public() and not \
subscribed_to_stream(user_profile, default_sending_stream)):
return json_error(_('Insufficient permission')) return json_error(_('Insufficient permission'))
default_events_register_stream = None default_events_register_stream = None
@ -237,7 +239,7 @@ def add_bot_backend(request, user_profile, full_name=REQ(), short_name=REQ(),
default_events_register_stream = stream_or_none(default_events_register_stream_name, default_events_register_stream = stream_or_none(default_events_register_stream_name,
user_profile.realm) user_profile.realm)
if default_events_register_stream and not default_events_register_stream.is_public() and not \ if default_events_register_stream and not default_events_register_stream.is_public() and not \
subscribed_to_stream(user_profile, default_events_register_stream): subscribed_to_stream(user_profile, default_events_register_stream):
return json_error(_('Insufficient permission')) return json_error(_('Insufficient permission'))