Mach: introduce Pyrefly for Python type checking, starting with the wpt folder (#37953)

This is the first stage of adopting Pyrefly. It introduces the Python
folder and focuses on fixing issues around it.

Testing: *Describe how this pull request is tested or why it doesn't
require tests*
Fixes: *Link to an issue this pull requests fixes or remove this line if
there is no issue*

---------

Signed-off-by: Jerens Lensun <jerensslensun@gmail.com>
This commit is contained in:
Jerens Lensun 2025-07-11 21:07:36 +08:00 committed by GitHub
parent 2366a8bf9e
commit 55fd7b862f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
14 changed files with 303 additions and 154 deletions

View file

@ -12,6 +12,8 @@ from wptrunner.update import setup_logging, WPTUpdate # noqa: F401
from wptrunner.update.base import exit_unclean # noqa: F401
from wptrunner import wptcommandline # noqa: F401
from argparse import ArgumentParser
from . import WPT_PATH
from . import manifestupdate
@ -49,7 +51,7 @@ def do_sync(**kwargs) -> int:
return 0
def remove_unused_metadata():
def remove_unused_metadata() -> None:
print("Removing unused results...")
unused_files = []
unused_dirs = []
@ -93,7 +95,7 @@ def remove_unused_metadata():
def update_tests(**kwargs) -> int:
def set_if_none(args: dict, key: str, value):
def set_if_none(args: dict, key: str, value: str) -> None:
if key not in args or args[key] is None:
args[key] = value
@ -117,5 +119,5 @@ def run_update(**kwargs) -> bool:
return WPTUpdate(logger, **kwargs).run() != exit_unclean
def create_parser(**_kwargs):
def create_parser(**_kwargs) -> ArgumentParser:
return wptcommandline.create_parser_update()