Skip to content

Commit 21b3e71

Browse files
jgrahamfoolip
authored andcommitted
Fix mypy failures
1 parent 563289f commit 21b3e71

File tree

3 files changed

+11
-5
lines changed

3 files changed

+11
-5
lines changed

tools/manifest/item.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,7 @@ class PrintRefTest(RefTest):
279279

280280
@property
281281
def page_ranges(self) -> PageRanges:
282-
return self._extras.get("page_ranges", {})
282+
return cast(PageRanges, self._extras.get("page_ranges", {}))
283283

284284
def to_json(self): # type: ignore
285285
rv = super().to_json()

tools/manifest/sourcefile.py

+9-3
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
from collections import deque
55
from fnmatch import fnmatch
66
from io import BytesIO
7-
from typing import (Any, BinaryIO, Callable, Deque, Dict, Iterable, List, Optional, Pattern,
8-
Set, Text, Tuple, Union, cast)
7+
from typing import (Any, BinaryIO, Callable, Deque, Dict, Iterable, List,
8+
Optional, Pattern, Set, Text, Tuple, TypedDict, Union, cast)
99
from urllib.parse import urljoin
1010

1111
try:
@@ -68,7 +68,13 @@ def read_script_metadata(f: BinaryIO, regexp: Pattern[bytes]) -> Iterable[Tuple[
6868
yield (m.groups()[0].decode("utf8"), m.groups()[1].decode("utf8"))
6969

7070

71-
_any_variants: Dict[Text, Dict[Text, Any]] = {
71+
class VariantData(TypedDict, total=False):
72+
suffix: str
73+
force_https: bool
74+
longhand: Set[str]
75+
76+
77+
_any_variants: Dict[Text, VariantData] = {
7278
"window": {"suffix": ".any.html"},
7379
"window-module": {},
7480
"serviceworker": {"force_https": True},

tools/webtransport/h3/capsule.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ def __iter__(self) -> Iterator[H3Capsule]:
108108
if self._final:
109109
raise e
110110
if not self._buffer:
111-
return 0
111+
return
112112
size = self._buffer.capacity - self._buffer.tell()
113113
if size >= UINT_VAR_MAX_SIZE:
114114
raise e

0 commit comments

Comments
 (0)