def __init__(self, cls, obj, vm): super(SuperInstance, self).__init__("super", vm) self.cls = self.vm.convert.super_type.to_variable(vm.root_cfg_node) self.super_cls = cls self.super_obj = obj self.get = abstract.NativeFunction("__get__", self.get, self.vm) self.set = abstract.NativeFunction("__set__", self.set, self.vm)
def __init__(self, cls, obj, vm): super().__init__("super", vm) self.cls = self.vm.convert.super_type self.super_cls = cls self.super_obj = obj self.get = abstract.NativeFunction("__get__", self.get, self.vm)
def testNativeFunctionAgainstCallable(self): # Matching a native function against a callable always succeeds, regardless # of argument and return types. f = abstract.NativeFunction("f", lambda x: x, self.vm) callable_type = self._convert_type("Callable[[int], int]") self.assertMatch(f, callable_type)
def build_typevar(name, vm): vm.errorlog.not_supported_yet(vm.frame.current_opcode, name) f = TypeVarFunction(name, vm) return abstract.NativeFunction("TypeVar", f.call, vm)