@@ -81,6 +81,18 @@ def __init__(self, module_name, aliases, ctx):
8181 super ().__init__ (ctx , module_name , member_map , ast )
8282
8383
84+ def _build (name ):
85+ def resolve (ctx ):
86+ ast = ctx .loader .typing
87+ pytd_type = pytd .ToType (ast .Lookup (name ), True , True , True )
88+ return ctx .convert .constant_to_value (pytd_type )
89+ return resolve
90+
91+
92+ def _build_not_supported_yet (name , ast ):
93+ return lambda ctx : not_supported_yet (name , ctx , ast = ast )
94+
95+
8496class Union (abstract .AnnotationClass ):
8597 """Implementation of typing.Union[...]."""
8698
@@ -433,14 +445,6 @@ def _build_value(self, node, inner, ellipses):
433445 return self .ctx .convert .merge_values (values )
434446
435447
436- def _build (name ):
437- return lambda ctx : ctx .convert .name_to_value (name )
438-
439-
440- def _build_not_supported_yet (name , ast ):
441- return lambda ctx : not_supported_yet (name , ctx , ast = ast )
442-
443-
444448def not_supported_yet (name , ctx , * , ast = None , details = None ):
445449 ast = ast or ctx .loader .typing
446450 full_name = f"{ ast .name } .{ name } "
0 commit comments