mirror of
https://github.com/zulip/zulip.git
synced 2025-11-04 14:03:30 +00:00
Generated by com2ann (slightly patched to avoid also converting assignment type annotations, which require Python 3.6), followed by some manual whitespace adjustment, and six fixes for runtime issues: - def __init__(self, token: Token, parent: Optional[Node]) -> None: + def __init__(self, token: Token, parent: "Optional[Node]") -> None: -def main(options: argparse.Namespace) -> NoReturn: +def main(options: argparse.Namespace) -> "NoReturn": -def fetch_request(url: str, callback: Any, **kwargs: Any) -> Generator[Callable[..., Any], Any, None]: +def fetch_request(url: str, callback: Any, **kwargs: Any) -> "Generator[Callable[..., Any], Any, None]": -def assert_server_running(server: subprocess.Popen[bytes], log_file: Optional[str]) -> None: +def assert_server_running(server: "subprocess.Popen[bytes]", log_file: Optional[str]) -> None: -def server_is_up(server: subprocess.Popen[bytes], log_file: Optional[str]) -> bool: +def server_is_up(server: "subprocess.Popen[bytes]", log_file: Optional[str]) -> bool: - method_kwarg_pairs: List[FuncKwargPair], + method_kwarg_pairs: "List[FuncKwargPair]", Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
31 lines
1.1 KiB
Python
31 lines
1.1 KiB
Python
import argparse
|
|
|
|
from typing import List
|
|
|
|
from zulint.linters import run_pyflakes
|
|
|
|
|
|
def check_pyflakes(files: List[str], options: argparse.Namespace) -> bool:
|
|
suppress_patterns = [
|
|
("scripts/lib/pythonrc.py", "imported but unused"),
|
|
# Intentionally imported by zerver/lib/webhooks/common.py
|
|
('', "'zerver.lib.exceptions.UnexpectedWebhookEventType' imported but unused"),
|
|
|
|
|
|
# Our ipython startup pythonrc file intentionally imports *
|
|
("scripts/lib/pythonrc.py",
|
|
" import *' used; unable to detect undefined names"),
|
|
|
|
# Special dev_settings.py import
|
|
('', "from .prod_settings_template import *"),
|
|
|
|
("settings.py", "settings import *' used; unable to detect undefined names"),
|
|
("settings.py", "may be undefined, or defined from star imports"),
|
|
|
|
# Sphinx adds `tags` specially to the environment when running conf.py.
|
|
("docs/conf.py", "undefined name 'tags'"),
|
|
]
|
|
if options.full:
|
|
suppress_patterns = []
|
|
return run_pyflakes(files, options, suppress_patterns)
|