From 46b7d54b3e3d3627f271cef03d71e5bfdfa8638e Mon Sep 17 00:00:00 2001 From: Tommy Ip Date: Wed, 30 Nov 2016 20:45:02 +0000 Subject: [PATCH] pep8: Fix E701 violations. --- bots/check-mirroring | 3 ++- bots/irc-mirror.py | 3 ++- bots/zulip_git_config.py | 3 ++- docs/conf.py | 3 ++- .../zulip_app_frontend/check_cron_file | 3 ++- .../files/postgresql/pg_backup_and_purge.py | 3 ++- scripts/nagios/cron_file_helper.py | 3 ++- scripts/setup/generate_secrets.py | 3 ++- tools/lint-all | 2 +- tools/run-dev.py | 3 ++- zerver/tests/test_type_debug.py | 18 +++++++++++++----- zerver/tornado/descriptors.py | 3 ++- zerver/views/webhooks/taiga.py | 3 ++- 13 files changed, 36 insertions(+), 17 deletions(-) diff --git a/bots/check-mirroring b/bots/check-mirroring index 7562ca024e..c4ec5c01db 100755 --- a/bots/check-mirroring +++ b/bots/check-mirroring @@ -11,7 +11,8 @@ import subprocess import hashlib from six.moves import range -if False: from typing import Any, Dict, List, Set, Tuple +if False: + from typing import Any, Dict, List, Set, Tuple parser = optparse.OptionParser() parser.add_option('--verbose', diff --git a/bots/irc-mirror.py b/bots/irc-mirror.py index 5185b91016..9d5c5cb78d 100755 --- a/bots/irc-mirror.py +++ b/bots/irc-mirror.py @@ -13,7 +13,8 @@ from irc.client import ip_numstr_to_quad, ip_quad_to_numstr, Event, ServerConnec import zulip import optparse -if False: from typing import Any +if False: + from typing import Any IRC_DOMAIN = "irc.example.com" diff --git a/bots/zulip_git_config.py b/bots/zulip_git_config.py index 4a05ab01e0..4c93be8853 100644 --- a/bots/zulip_git_config.py +++ b/bots/zulip_git_config.py @@ -4,7 +4,8 @@ # Leaving all the instructions out of this file to avoid having to # sync them as we update the comments. -if False: from typing import Dict, Optional, Text +if False: + from typing import Dict, Optional, Text ZULIP_USER = "commit-bot@zulip.com" ZULIP_API_KEY = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" diff --git a/docs/conf.py b/docs/conf.py index 9ca38d3aa5..46371e3393 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -15,7 +15,8 @@ import sys import os import shlex -if False: from typing import Any, Dict, List, Optional +if False: + from typing import Any, Dict, List, Optional # If extensions (or modules to document with autodoc) are in another directory, # add these directories to sys.path here. If the directory is relative to the diff --git a/puppet/zulip/files/nagios_plugins/zulip_app_frontend/check_cron_file b/puppet/zulip/files/nagios_plugins/zulip_app_frontend/check_cron_file index 5fb5003a7c..91933bfffb 100755 --- a/puppet/zulip/files/nagios_plugins/zulip_app_frontend/check_cron_file +++ b/puppet/zulip/files/nagios_plugins/zulip_app_frontend/check_cron_file @@ -8,7 +8,8 @@ import sys import time # Avoid requiring the typing module to be installed -if False: from typing import Tuple +if False: + from typing import Tuple def nagios_from_file(results_file): # type: (str) -> Tuple[int, str] diff --git a/puppet/zulip/files/postgresql/pg_backup_and_purge.py b/puppet/zulip/files/postgresql/pg_backup_and_purge.py index 7470401478..9822f2e67b 100755 --- a/puppet/zulip/files/postgresql/pg_backup_and_purge.py +++ b/puppet/zulip/files/postgresql/pg_backup_and_purge.py @@ -10,7 +10,8 @@ import logging import dateutil.parser import pytz from datetime import datetime, timedelta -if False: from typing import List +if False: + from typing import List logging.basicConfig(format="%(asctime)s %(levelname)s: %(message)s") logger = logging.getLogger(__name__) diff --git a/scripts/nagios/cron_file_helper.py b/scripts/nagios/cron_file_helper.py index abf82f79d4..092c665cfa 100644 --- a/scripts/nagios/cron_file_helper.py +++ b/scripts/nagios/cron_file_helper.py @@ -1,7 +1,8 @@ import time # Avoid requiring the typing module to be installed -if False: from typing import Tuple +if False: + from typing import Tuple def nagios_from_file(results_file): # type: (str) -> Tuple[int, str] diff --git a/scripts/setup/generate_secrets.py b/scripts/setup/generate_secrets.py index 5cf448308b..f6310d0b91 100755 --- a/scripts/setup/generate_secrets.py +++ b/scripts/setup/generate_secrets.py @@ -4,7 +4,8 @@ from __future__ import print_function import sys, os, os.path from os.path import dirname, abspath -if False: from typing import Dict, Optional +if False: + from typing import Dict, Optional BASE_DIR = dirname(dirname(dirname(abspath(__file__)))) sys.path.append(BASE_DIR) diff --git a/tools/lint-all b/tools/lint-all index 0e09361fa8..b04e8a20ff 100755 --- a/tools/lint-all +++ b/tools/lint-all @@ -83,7 +83,7 @@ def check_pep8(files): failed = False ignored_rules = [ 'E402', 'E501', 'W503', 'E711', 'E201', 'E203', 'E202', 'E128', 'E226', 'E124', 'E125', - 'E126', 'E127', 'E121', 'E122', 'E123', 'E266', 'E265', 'E261', 'E701', 'E221', 'E303', + 'E126', 'E127', 'E121', 'E122', 'E123', 'E266', 'E265', 'E261', 'E221', 'E303', 'E241', 'E712', 'E702', 'E401', 'E115', 'E114', 'E111', 'E222', 'E731', 'E302', 'E129', 'E741', 'E714', 'W391', 'E211', 'E713', 'E502', 'E131', 'E305', 'E251', 'E306', 'E231', ] diff --git a/tools/run-dev.py b/tools/run-dev.py index 2339635873..015b551148 100755 --- a/tools/run-dev.py +++ b/tools/run-dev.py @@ -19,7 +19,8 @@ from tornado import web from tornado.ioloop import IOLoop from tornado.websocket import WebSocketHandler, websocket_connect -if False: from typing import Any, Callable, Generator, Optional +if False: + from typing import Any, Callable, Generator, Optional if 'posix' in os.name and os.geteuid() == 0: raise RuntimeError("run-dev.py should not be run as root.") diff --git a/zerver/tests/test_type_debug.py b/zerver/tests/test_type_debug.py index b442746ea8..265812c935 100644 --- a/zerver/tests/test_type_debug.py +++ b/zerver/tests/test_type_debug.py @@ -91,17 +91,23 @@ class TypesPrintTest(TestCase): def test_class(self): # type: () -> None - class A(object): pass + class A(object): + pass + + class B(str): + pass - class B(str): pass self.check_signature("(A) -> str", 'A', (lambda x: x.__class__.__name__), A()) self.check_signature("(B) -> int", 5, (lambda x: len(x)), B("hello")) def test_sequence(self): # type: () -> None - class A(list): pass + class A(list): + pass + + class B(list): + pass - class B(list): pass self.check_signature("add(A([]), B([str])) -> [str]", ['two'], add, A([]), B(['two'])) self.check_signature("add(A([int]), B([str])) -> [int, ...]", @@ -111,11 +117,13 @@ class TypesPrintTest(TestCase): def test_mapping(self): # type: () -> None - class A(dict): pass + class A(dict): + pass def to_A(l=[]): # type: (Iterable[Tuple[Any, Any]]) -> A return A(l) + self.check_signature("to_A() -> A([])", A(()), to_A) self.check_signature("to_A([(int, str)]) -> A([(int, str)])", {2: 'two'}, to_A, [(2, 'two')]) diff --git a/zerver/tornado/descriptors.py b/zerver/tornado/descriptors.py index d3594ac1f6..b20708ebba 100644 --- a/zerver/tornado/descriptors.py +++ b/zerver/tornado/descriptors.py @@ -3,7 +3,8 @@ from __future__ import print_function from typing import Any, Optional -if False: import zerver.tornado.event_queue +if False: + import zerver.tornado.event_queue descriptors_by_handler_id = {} # type: Dict[int, zerver.tornado.event_queue.ClientDescriptor] diff --git a/zerver/views/webhooks/taiga.py b/zerver/views/webhooks/taiga.py index 1725d2b1fb..898316a078 100644 --- a/zerver/views/webhooks/taiga.py +++ b/zerver/views/webhooks/taiga.py @@ -252,7 +252,8 @@ def parse_message(message): if message["change"]["diff"]: for value in message["change"]["diff"]: parsed_event = parse_change_event(value, message) - if parsed_event: events.append(parsed_event) + if parsed_event: + events.append(parsed_event) if message["change"]["comment"]: events.append(parse_comment(message))