Bug 1711005 [wpt PR 28988] - Run mypy for tools/serve/ (but still allow untyped defs), a=testonly

Automatic update from web-platform-tests
Run mypy for tools/serve/ (but still allow untyped defs)

Part of https://github.com/web-platform-tests/wpt/issues/28833.

--

wpt-commits: 9cbcc977a22a6fe04af23be0876823fb5d5c3d8f
wpt-pr: 28988
This commit is contained in:
Philip Jägenstedt 2021-06-14 22:37:31 +00:00 коммит произвёл moz-wptsync-bot
Родитель 01ba1532ba
Коммит 76017ae1db
5 изменённых файлов: 17 добавлений и 12 удалений

Просмотреть файл

@ -36,6 +36,9 @@ ignore_missing_imports = True
[mypy-marionette_driver.*]
ignore_missing_imports = True
[mypy-mod_pywebsocket.*]
ignore_missing_imports = True
[mypy-mozcrash.*]
ignore_missing_imports = True
@ -135,7 +138,7 @@ disallow_untyped_defs = False
disallow_untyped_defs = False
[mypy-tools.serve.*]
ignore_errors = True
disallow_untyped_defs = False
[mypy-tools.wave.*]
disallow_untyped_defs = False

Просмотреть файл

@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-
import abc
import argparse
import importlib
@ -19,10 +17,11 @@ import urllib
import uuid
from collections import defaultdict, OrderedDict
from itertools import chain, product
from typing import ClassVar, List, Set, Tuple
from localpaths import repo_root
from localpaths import repo_root # type: ignore
from manifest.sourcefile import read_script_metadata, js_meta_re, parse_variants
from manifest.sourcefile import read_script_metadata, js_meta_re, parse_variants # type: ignore
from wptserve import server as wptserve, handlers
from wptserve import stash
from wptserve import config
@ -59,7 +58,7 @@ class WrapperHandler(object):
__meta__ = abc.ABCMeta
headers = []
headers = [] # type: ClassVar[List[Tuple[str, str]]]
def __init__(self, base_path=None, url_base="/"):
self.base_path = base_path
@ -177,7 +176,7 @@ class WrapperHandler(object):
class HtmlWrapperHandler(WrapperHandler):
global_type = None
global_type = None # type: ClassVar[str]
headers = [('Content-Type', 'text/html')]
def check_exposure(self, request):
@ -860,11 +859,11 @@ def iter_servers(servers):
yield server
def _make_subdomains_product(s, depth=2):
def _make_subdomains_product(s: Set[str], depth: int = 2) -> Set[str]:
return {u".".join(x) for x in chain(*(product(s, repeat=i) for i in range(1, depth+1)))}
def _make_origin_policy_subdomains(limit):
def _make_origin_policy_subdomains(limit: int) -> Set[str]:
return {u"op%d" % x for x in range(1,limit+1)}

Просмотреть файл

@ -25,7 +25,7 @@ class ServerProcSpy(serve.ServerProc):
return result
serve.ServerProc = ServerProcSpy
serve.ServerProc = ServerProcSpy # type: ignore
@pytest.fixture()
def server_subprocesses():

Просмотреть файл

@ -5,7 +5,7 @@ import platform
import pytest
import localpaths
import localpaths # type: ignore
from . import serve
from .serve import ConfigBuilder

Просмотреть файл

@ -1,4 +1,7 @@
# -*- coding: utf-8 -*-
# The ./wpt serve-wave command is broken, so mypy errors are ignored instead of
# making untestable changes to the problematic imports.
# See https://github.com/web-platform-tests/wpt/issues/29024.
# mypy: ignore-errors
import subprocess
from manifest import manifest