Exemple #1
0
 def testTypingContainer(self):
     cls = self._vm.convert.list_type
     container = abstract.AnnotationContainer("List", self._vm, cls)
     expected = pytd.GenericType(pytd.NamedType("__builtin__.list"),
                                 (pytd.AnythingType(), ))
     actual = container.get_instance_type(self._vm.root_cfg_node)
     self.assertEqual(expected, actual)
Exemple #2
0
def build_container(name, vm):
    if name in pep484.PEP484_CAPITALIZED:
        pytd_name = "__builtin__." + name.lower()
    else:
        pytd_name = "typing." + name
    base = vm.convert.name_to_value(pytd_name)
    return abstract.AnnotationContainer(name, vm, base)