| 1 | # Stripped down version of typing.py for runtime support only!
 | 
| 2 | #
 | 
| 3 | # We got rid of runtime dependences on collections.py, copy.py, etc.
 | 
| 4 | #
 | 
| 5 | # MyPy has its own version of this, since it's written in Python 3.  We don't
 | 
| 6 | # need any support at runtime.
 | 
| 7 | #
 | 
| 8 | # If you need to define a type alias, do something like:
 | 
| 9 | #
 | 
| 10 | # if TYPE_CHECKING:
 | 
| 11 | #   NullFunc = Callable[[int, int], int]
 | 
| 12 | 
 | 
| 13 | TypingMeta = None
 | 
| 14 | TypeVar = None
 | 
| 15 | _ForwardRef = None
 | 
| 16 | List = None
 | 
| 17 | Sequence = None
 | 
| 18 | Tuple = None
 | 
| 19 | Optional = None
 | 
| 20 | Union = None
 | 
| 21 | IO = None
 | 
| 22 | Dict = None
 | 
| 23 | Iterator = None
 | 
| 24 | Any = None
 | 
| 25 | NoReturn = None
 | 
| 26 | Callable = None
 | 
| 27 | Counter = None  # for ID_HIST
 | 
| 28 | 
 | 
| 29 | Generic = None  # for StackArray[T]
 | 
| 30 | 
 | 
| 31 | TYPE_CHECKING = False
 | 
| 32 | 
 | 
| 33 | 
 | 
| 34 | def cast(typ, val):
 | 
| 35 |     """Cast a value to a type.
 | 
| 36 | 
 | 
| 37 |     This returns the value unchanged.  To the type checker this
 | 
| 38 |     signals that the return value has the designated type, but at
 | 
| 39 |     runtime we intentionally don't check anything (we want this
 | 
| 40 |     to be as fast as possible).
 | 
| 41 |     """
 | 
| 42 |     return val
 |