Annotations can contain forward references even if they are not a string anymore

Since Python 3.7 this behavior can be imported with from future import __annotations
This commit is contained in:
Dave Halter committed 2018-07-28 16:35:24 +02:00
1 parent b073b05aa0
commit 9bba91628a
4 files changed
+28 -5

No files matched your search

+1 -1
View File
@@ -54,7 +54,7 @@ def _evaluate_annotation_string(context, string, index=None):
context_set = context.eval_node(node)
if index is not None:
context_set = context_set.filter(
lambda context: context.array_type == u'tuple'
lambda context: context.array_type == u'tuple' # noqa
and len(list(context.py__iter__())) >= index
).py__getitem__(index)
return context_set.execute_evaluated()