pep8: Fix E701 violations.

This commit is contained in:
Tommy Ip 2016-11-30 20:45:02 +00:00
parent ba7d4e7452
commit 46b7d54b3e
13 changed files with 36 additions and 17 deletions

View File

@ -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',

View File

@ -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"

View File

@ -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"

View File

@ -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

View 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]

View File

@ -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__)

View File

@ -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]

View File

@ -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)

View File

@ -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',
]

View File

@ -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.")

View File

@ -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("<lambda>(A) -> str", 'A', (lambda x: x.__class__.__name__), A())
self.check_signature("<lambda>(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')])

View File

@ -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]

View File

@ -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))