mirror of https://github.com/zulip/zulip.git
pep8: Fix E701 violations.
This commit is contained in:
parent
ba7d4e7452
commit
46b7d54b3e
|
@ -11,7 +11,8 @@ import subprocess
|
||||||
import hashlib
|
import hashlib
|
||||||
from six.moves import range
|
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 = optparse.OptionParser()
|
||||||
parser.add_option('--verbose',
|
parser.add_option('--verbose',
|
||||||
|
|
|
@ -13,7 +13,8 @@ from irc.client import ip_numstr_to_quad, ip_quad_to_numstr, Event, ServerConnec
|
||||||
import zulip
|
import zulip
|
||||||
import optparse
|
import optparse
|
||||||
|
|
||||||
if False: from typing import Any
|
if False:
|
||||||
|
from typing import Any
|
||||||
|
|
||||||
IRC_DOMAIN = "irc.example.com"
|
IRC_DOMAIN = "irc.example.com"
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,8 @@
|
||||||
# Leaving all the instructions out of this file to avoid having to
|
# Leaving all the instructions out of this file to avoid having to
|
||||||
# sync them as we update the comments.
|
# 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_USER = "commit-bot@zulip.com"
|
||||||
ZULIP_API_KEY = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
|
ZULIP_API_KEY = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
|
||||||
|
|
|
@ -15,7 +15,8 @@
|
||||||
import sys
|
import sys
|
||||||
import os
|
import os
|
||||||
import shlex
|
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,
|
# 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
|
# add these directories to sys.path here. If the directory is relative to the
|
||||||
|
|
|
@ -8,7 +8,8 @@ import sys
|
||||||
import time
|
import time
|
||||||
|
|
||||||
# Avoid requiring the typing module to be installed
|
# 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):
|
def nagios_from_file(results_file):
|
||||||
# type: (str) -> Tuple[int, str]
|
# type: (str) -> Tuple[int, str]
|
||||||
|
|
|
@ -10,7 +10,8 @@ import logging
|
||||||
import dateutil.parser
|
import dateutil.parser
|
||||||
import pytz
|
import pytz
|
||||||
from datetime import datetime, timedelta
|
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")
|
logging.basicConfig(format="%(asctime)s %(levelname)s: %(message)s")
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
import time
|
import time
|
||||||
|
|
||||||
# Avoid requiring the typing module to be installed
|
# 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):
|
def nagios_from_file(results_file):
|
||||||
# type: (str) -> Tuple[int, str]
|
# type: (str) -> Tuple[int, str]
|
||||||
|
|
|
@ -4,7 +4,8 @@
|
||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
import sys, os, os.path
|
import sys, os, os.path
|
||||||
from os.path import dirname, abspath
|
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__))))
|
BASE_DIR = dirname(dirname(dirname(abspath(__file__))))
|
||||||
sys.path.append(BASE_DIR)
|
sys.path.append(BASE_DIR)
|
||||||
|
|
|
@ -83,7 +83,7 @@ def check_pep8(files):
|
||||||
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', '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',
|
'E241', 'E712', 'E702', 'E401', 'E115', 'E114', 'E111', 'E222', 'E731', 'E302', 'E129',
|
||||||
'E741', 'E714', 'W391', 'E211', 'E713', 'E502', 'E131', 'E305', 'E251', 'E306', 'E231',
|
'E741', 'E714', 'W391', 'E211', 'E713', 'E502', 'E131', 'E305', 'E251', 'E306', 'E231',
|
||||||
]
|
]
|
||||||
|
|
|
@ -19,7 +19,8 @@ from tornado import web
|
||||||
from tornado.ioloop import IOLoop
|
from tornado.ioloop import IOLoop
|
||||||
from tornado.websocket import WebSocketHandler, websocket_connect
|
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:
|
if 'posix' in os.name and os.geteuid() == 0:
|
||||||
raise RuntimeError("run-dev.py should not be run as root.")
|
raise RuntimeError("run-dev.py should not be run as root.")
|
||||||
|
|
|
@ -91,17 +91,23 @@ class TypesPrintTest(TestCase):
|
||||||
|
|
||||||
def test_class(self):
|
def test_class(self):
|
||||||
# type: () -> None
|
# 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>(A) -> str", 'A', (lambda x: x.__class__.__name__), A())
|
||||||
self.check_signature("<lambda>(B) -> int", 5, (lambda x: len(x)), B("hello"))
|
self.check_signature("<lambda>(B) -> int", 5, (lambda x: len(x)), B("hello"))
|
||||||
|
|
||||||
def test_sequence(self):
|
def test_sequence(self):
|
||||||
# type: () -> None
|
# 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]",
|
self.check_signature("add(A([]), B([str])) -> [str]",
|
||||||
['two'], add, A([]), B(['two']))
|
['two'], add, A([]), B(['two']))
|
||||||
self.check_signature("add(A([int]), B([str])) -> [int, ...]",
|
self.check_signature("add(A([int]), B([str])) -> [int, ...]",
|
||||||
|
@ -111,11 +117,13 @@ class TypesPrintTest(TestCase):
|
||||||
|
|
||||||
def test_mapping(self):
|
def test_mapping(self):
|
||||||
# type: () -> None
|
# type: () -> None
|
||||||
class A(dict): pass
|
class A(dict):
|
||||||
|
pass
|
||||||
|
|
||||||
def to_A(l=[]):
|
def to_A(l=[]):
|
||||||
# type: (Iterable[Tuple[Any, Any]]) -> A
|
# type: (Iterable[Tuple[Any, Any]]) -> A
|
||||||
return A(l)
|
return A(l)
|
||||||
|
|
||||||
self.check_signature("to_A() -> A([])", A(()), to_A)
|
self.check_signature("to_A() -> A([])", A(()), to_A)
|
||||||
self.check_signature("to_A([(int, str)]) -> A([(int, str)])",
|
self.check_signature("to_A([(int, str)]) -> A([(int, str)])",
|
||||||
{2: 'two'}, to_A, [(2, 'two')])
|
{2: 'two'}, to_A, [(2, 'two')])
|
||||||
|
|
|
@ -3,7 +3,8 @@ from __future__ import print_function
|
||||||
|
|
||||||
from typing import Any, Optional
|
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]
|
descriptors_by_handler_id = {} # type: Dict[int, zerver.tornado.event_queue.ClientDescriptor]
|
||||||
|
|
||||||
|
|
|
@ -252,7 +252,8 @@ def parse_message(message):
|
||||||
if message["change"]["diff"]:
|
if message["change"]["diff"]:
|
||||||
for value in message["change"]["diff"]:
|
for value in message["change"]["diff"]:
|
||||||
parsed_event = parse_change_event(value, message)
|
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"]:
|
if message["change"]["comment"]:
|
||||||
events.append(parse_comment(message))
|
events.append(parse_comment(message))
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue