diff options
Diffstat (limited to 'testing/web-platform/tests/tools/manifest/sourcefile.py')
-rw-r--r-- | testing/web-platform/tests/tools/manifest/sourcefile.py | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/testing/web-platform/tests/tools/manifest/sourcefile.py b/testing/web-platform/tests/tools/manifest/sourcefile.py index 71eab54bea..3563fb9e5e 100644 --- a/testing/web-platform/tests/tools/manifest/sourcefile.py +++ b/testing/web-platform/tests/tools/manifest/sourcefile.py @@ -4,8 +4,8 @@ import os from collections import deque from fnmatch import fnmatch from io import BytesIO -from typing import (Any, BinaryIO, Callable, Deque, Dict, Iterable, List, Optional, Pattern, - Set, Text, Tuple, Union, cast) +from typing import (Any, BinaryIO, Callable, Deque, Dict, Iterable, List, + Optional, Pattern, Set, Text, Tuple, TypedDict, Union, cast) from urllib.parse import urljoin try: @@ -68,7 +68,13 @@ def read_script_metadata(f: BinaryIO, regexp: Pattern[bytes]) -> Iterable[Tuple[ yield (m.groups()[0].decode("utf8"), m.groups()[1].decode("utf8")) -_any_variants: Dict[Text, Dict[Text, Any]] = { +class VariantData(TypedDict, total=False): + suffix: str + force_https: bool + longhand: Set[str] + + +_any_variants: Dict[Text, VariantData] = { "window": {"suffix": ".any.html"}, "window-module": {}, "serviceworker": {"force_https": True}, @@ -205,9 +211,11 @@ class SourceFile: type_flag = None if "-" in name: - type_flag = name.rsplit("-", 1)[1].split(".")[0] - - meta_flags = name.split(".")[1:] + type_meta = name.rsplit("-", 1)[1].split(".") + type_flag = type_meta[0] + meta_flags = type_meta[1:] + else: + meta_flags = name.split(".")[1:] self.tests_root: Text = tests_root self.rel_path: Text = rel_path |