summaryrefslogtreecommitdiff
path: root/framework
diff options
context:
space:
mode:
authorDavid Heidelberg <david.heidelberg@collabora.com>2022-08-09 21:45:51 +0200
committerDavid Heidelberg <david.heidelberg@collabora.com>2022-08-29 23:10:11 +0200
commit21f93e8efc1bc745e3602f795d4b9f624ed06798 (patch)
treeed280343c5f5b8c130851763d2e7b5d836fd418a /framework
parentfeb7178313550dd97586c92ee2abf8c4ad82cdbc (diff)
framework/replay: make code mypy compliant
Signed-off-by: David Heidelberg <david.heidelberg@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/piglit/-/merge_requests/670>
Diffstat (limited to 'framework')
-rw-r--r--framework/replay/__init__.py1
-rw-r--r--framework/replay/compare_replay.py2
-rw-r--r--framework/replay/download_utils.py7
-rw-r--r--framework/replay/frame_times.py2
-rw-r--r--framework/replay/programs/parsers.py4
5 files changed, 9 insertions, 7 deletions
diff --git a/framework/replay/__init__.py b/framework/replay/__init__.py
index 41d63b428..987ffaebf 100644
--- a/framework/replay/__init__.py
+++ b/framework/replay/__init__.py
@@ -1,4 +1,5 @@
# coding=utf-8
+# mypy: ignore-errors
#
# Copyright (c) 2014,2016 Intel Corporation
# Copyright © 2020 Valve Corporation.
diff --git a/framework/replay/compare_replay.py b/framework/replay/compare_replay.py
index 6c222f9c2..146b1f0aa 100644
--- a/framework/replay/compare_replay.py
+++ b/framework/replay/compare_replay.py
@@ -28,7 +28,7 @@ import shutil
try:
import simplejson as json
except ImportError:
- import json
+ import json # type: ignore
from glob import glob
from os import path
diff --git a/framework/replay/download_utils.py b/framework/replay/download_utils.py
index d0d6747fe..36322b000 100644
--- a/framework/replay/download_utils.py
+++ b/framework/replay/download_utils.py
@@ -28,6 +28,7 @@ import hashlib
import hmac
import xml.etree.ElementTree as ET
+from typing import Dict
from email.utils import formatdate
from os import path
from time import time
@@ -106,7 +107,7 @@ def get_authorization_headers(url, resource):
return headers
-def download(url: str, file_path: str, headers, attempts=2) -> None:
+def download(url: str, file_path: str, headers: Dict[str, str], attempts: int = 2) -> None:
"""Downloads a URL content into a file
:param url: URL to download
@@ -124,8 +125,8 @@ def download(url: str, file_path: str, headers, attempts=2) -> None:
adapter = HTTPAdapter(max_retries=retries)
session.mount(protocol, adapter)
for protocol in ["file://"]:
- adapter = LocalFileAdapter()
- session.mount(protocol, adapter)
+ file_adapter = LocalFileAdapter()
+ session.mount(protocol, file_adapter)
with session.get(url,
allow_redirects=True,
diff --git a/framework/replay/frame_times.py b/framework/replay/frame_times.py
index 7cdc5d264..4fdffb51b 100644
--- a/framework/replay/frame_times.py
+++ b/framework/replay/frame_times.py
@@ -27,7 +27,7 @@ from framework.replay.backends.apitrace import APITraceBackend
try:
import simplejson as json
except ImportError:
- import json
+ import json # type: ignore
from os import path
diff --git a/framework/replay/programs/parsers.py b/framework/replay/programs/parsers.py
index 54e645ae1..efb310099 100644
--- a/framework/replay/programs/parsers.py
+++ b/framework/replay/programs/parsers.py
@@ -24,7 +24,7 @@
# SPDX-License-Identifier: MIT
import argparse
-
+from typing import Any
class FileContentType(argparse.FileType):
@@ -36,7 +36,7 @@ class FileContentType(argparse.FileType):
mode="r", bufsize=bufsize, encoding=encoding, errors=errors
)
- def __call__(self, string: str):
+ def __call__(self, string: str) -> Any:
with super().__call__(string) as open_file:
return open_file.read()