blob: d3ca415f85984eca8f2fed4e983934012c31a188 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
"""
This module provides some type definitions and backwards compatibility shims
for use in the testsuite driver.
The testsuite driver can be typechecked using mypy [1].
[1] http://mypy-lang.org/
"""
try:
from typing import *
import typing
except:
# The backwards compatibility stubs must live in another module lest
# mypy complains.
from typing_stubs import * # type: ignore
####################################################
# Backwards compatibility shims
#
# N.B. mypy appears to typecheck as though the "then" clause of if structures
# is taken. We exploit this below.
# TextIO is missing on some older Pythons.
if 'TextIO' not in globals():
try:
TextIO = typing.TextIO
except ImportError:
TextIO = None # type: ignore
else:
TextIO = None # type: ignore
####################################################
# Testsuite-specific types
WayName = NewType("WayName", str)
TestName = NewType("TestName", str)
OutputNormalizer = Callable[[str], str]
IssueNumber = NewType("IssueNumber", int)
# Used by perf_notes
GitHash = NewType("GitHash", str) # a Git commit hash
GitRef = NewType("GitRef", str)
TestEnv = NewType("TestEnv", str)
MetricName = NewType("MetricName", str)
|