summaryrefslogtreecommitdiff
path: root/testsuite/driver/typing_stubs.py
blob: 5c3cd813faba7cacff04ad336fb1a3c2ce36c85a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# Stub definitions for things provided by the `typing` package for use by older
# Python versions which don't ship with `typing`.

import collections

class Dummy:
    def __getitem__(self, *args):
        return None

List = Dummy()
Tuple = Dummy()
Set = Dummy()
TextIO = Dummy()
Iterator = Dummy()
Callable = Dummy()
Optional = Dummy()
Dict = Dummy()
Union = Dummy()
Any = Dummy()

NewType = lambda name, ty: ty
def NamedTuple(name, fields):
    return collections.namedtuple(name, [field[0] for field in fields])