Type hints: try to parse hints when from __future__ import annotations is used

Closes #711 (closed)

The problem is that when from __future__ import annotations used, Python doesn't try to resolve the names of the types inside the type hints. Instead, it stores them as strings. And we, obviously, cannot convert it to the tango type

We can try to resolve the type hint if it is a string, but if we have user-defined types (Enums) or type hints, stored in variables, we need to get proper locals(). We are trying to do it, moving back in the frames. It seems, user code is either 5th of 3d frame behind utils.py, so I limited attempts to <=6 frames behind.

Note, that to resolve it we must do eval which is not safe (but to be honest, typing does the same in that case)

So with these limitations, I made it work

Edited by Yury Matveev

Merge request reports

Loading