mirror of
https://github.com/zulip/zulip.git
synced 2025-11-02 13:03:29 +00:00
python: Convert function type annotations to Python 3 style.
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>
This commit is contained in:
committed by
Tim Abbott
parent
43ac901ad9
commit
5901e7ba7e
@@ -10,8 +10,7 @@ os.chdir(os.path.join(os.path.dirname(__file__), '..'))
|
||||
STATIC_PATH = 'static/'
|
||||
|
||||
|
||||
def build_for_prod_or_casper(quiet):
|
||||
# type: (bool) -> NoReturn
|
||||
def build_for_prod_or_casper(quiet: bool) -> NoReturn:
|
||||
"""Builds for production, writing the output to disk"""
|
||||
|
||||
webpack_args = ['node', 'node_modules/.bin/webpack-cli',
|
||||
@@ -22,8 +21,7 @@ def build_for_prod_or_casper(quiet):
|
||||
print('Starting webpack compilation')
|
||||
os.execvp(webpack_args[0], webpack_args)
|
||||
|
||||
def build_for_dev_server(host, port, minify, disable_host_check):
|
||||
# type: (str, str, bool, bool) -> None
|
||||
def build_for_dev_server(host: str, port: str, minify: bool, disable_host_check: bool) -> None:
|
||||
"""watches and rebuilds on changes, serving files from memory via webpack-dev-server"""
|
||||
|
||||
# This is our most dynamic configuration, which we use for our
|
||||
@@ -68,8 +66,7 @@ def build_for_dev_server(host, port, minify, disable_host_check):
|
||||
webpack_process = subprocess.Popen(webpack_args)
|
||||
|
||||
class WebpackConfigFileChangeHandler(pyinotify.ProcessEvent):
|
||||
def process_default(self, event):
|
||||
# type: (pyinotify.Event) -> None
|
||||
def process_default(self, event: pyinotify.Event) -> None:
|
||||
nonlocal webpack_process
|
||||
print('Restarting webpack-dev-server due to config changes...')
|
||||
webpack_process.terminate()
|
||||
@@ -86,8 +83,7 @@ def build_for_dev_server(host, port, minify, disable_host_check):
|
||||
webpack_process.terminate()
|
||||
webpack_process.wait()
|
||||
|
||||
def build_for_most_tests():
|
||||
# type: () -> None
|
||||
def build_for_most_tests() -> None:
|
||||
"""Generates a stub asset stat file for django so backend test can render a page"""
|
||||
|
||||
# Tests like test-backend, test-api, and test-home-documentation use
|
||||
|
||||
Reference in New Issue
Block a user