From bfa034f2d9b0c4d0844b0e84dd7a980335a122ac Mon Sep 17 00:00:00 2001 From: Pavol Rusnak Date: Mon, 12 Sep 2016 21:19:56 +0200 Subject: [PATCH] add typing module (just stubs, but should implement most of the stuff from PEP 484 and https://docs.python.org/3/library/typing.html) --- src/lib/typing.py | 63 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 src/lib/typing.py diff --git a/src/lib/typing.py b/src/lib/typing.py new file mode 100644 index 00000000..54dd3b16 --- /dev/null +++ b/src/lib/typing.py @@ -0,0 +1,63 @@ +__names_get = [ + 'AbstractSet', + 'AsyncIterable', + 'AsyncIterator', + 'Awaitable', + 'ByteString', + 'Callable', + 'Container', + 'DefaultDict', + 'Dict', + 'Generator', + 'Generic', + 'ItemsView', + 'Iterable', + 'Iterator', + 'KeysView', + 'List', + 'Mapping', + 'MappingView', + 'MutableMapping', + 'MutableSequence', + 'MutableSet', + 'Optional', + 'Reversible', + 'Sequence', + 'Set', + 'Tuple', + 'Type', + 'Union', + 'ValuesView', +] + +__names_obj = [ + 'Any', + 'AnyStr', + 'Hashable', + 'Sized', + 'SupportsAbs', + 'SupportsFloat', + 'SupportsInt', + 'SupportsRound', + 'Text', +] + +class __dummy: + def __getitem__(self, *args): + return object + +__t = __dummy() + +for __n in __names_get: + globals()[__n] = __t + +for __n in __names_obj: + globals()[__n] = object + +def TypeVar(*args): + return object + +def NewType(*args): + return object + +TYPE_CHECKING = False