def op_dot(context, sender, expr, operator): executor = helpers.get_executor(context) type_context = executor.context_manager.create_class_context(sender.type) obj_context = executor.context_manager.create_object_context(sender) ctx2 = linked_context.link(linked_context.link(context, type_context), obj_context) return operator(ctx2, sender, expr)
def op_dot(context, sender, expr, operator): executor = helpers.get_executor(context) type_context = executor.context_manager.create_class_context(sender.type) obj_context = executor.context_manager.create_object_context(sender) ctx2 = linked_context.link( linked_context.link(context, type_context), obj_context) return operator(ctx2, sender, expr)
def create_root_context(self, runtime_version): root_context = super(TestContextManager, self).create_root_context(runtime_version) context = linked_context.link(root_context, yaql_functions.get_context(runtime_version)) context = context.create_child_context() for name, func in self.__functions.iteritems(): context.register_function(func, name) return context
def create_class_context(self, murano_class): package_context = self.create_package_context(murano_class.package) context = linked_context.link( package_context, self.context_manager.create_class_context(murano_class) ).create_child_context() context[constants.CTX_TYPE] = murano_class return context
def create_class_context(self, murano_class): package_context = self.create_package_context(murano_class.package) context = linked_context.link( package_context, self.context_manager.create_class_context( murano_class)).create_child_context() context[constants.CTX_TYPE] = murano_class return context
def create_root_context(self, runtime_version): root_context = super(TestContextManager, self).create_root_context( runtime_version) context = linked_context.link( root_context, yaql_functions.get_context(runtime_version)) context = context.create_child_context() for name, func in self.__functions.iteritems(): context.register_function(func, name) return context
def create_object_context(self, murano_obj): original_context = super(MockContextManager, self).create_object_context(murano_obj) mock_context = self._create_new_ctx_for_obj(murano_obj.type.name) if mock_context: result_context = linked_context.link( original_context, mock_context).create_child_context() else: result_context = original_context return result_context
def create_object_context(self, obj, caller_context=None): class_context = self.create_class_context(obj.type) context = linked_context.link( class_context, self.context_manager.create_object_context(obj) ).create_child_context() context[constants.CTX_THIS] = obj.real_this context["this"] = obj.real_this context[""] = obj.real_this if caller_context is not None: caller = caller_context while caller is not None and caller[constants.CTX_SKIP_FRAME]: caller = caller[constants.CTX_CALLER_CONTEXT] context[constants.CTX_CALLER_CONTEXT] = caller context[constants.CTX_ALLOW_PROPERTY_WRITES] = caller_context[constants.CTX_ALLOW_PROPERTY_WRITES] return context
def create_object_context(self, obj, caller_context=None): class_context = self.create_class_context(obj.type) context = linked_context.link( class_context, self.context_manager.create_object_context( obj)).create_child_context() context[constants.CTX_THIS] = obj.real_this context['this'] = obj.real_this context[''] = obj.real_this if caller_context is not None: caller = caller_context while caller is not None and caller[constants.CTX_SKIP_FRAME]: caller = caller[constants.CTX_CALLER_CONTEXT] context[constants.CTX_CALLER_CONTEXT] = caller context[constants.CTX_ALLOW_PROPERTY_WRITES] = caller_context[ constants.CTX_ALLOW_PROPERTY_WRITES] return context
def create_root_context(self, runtime_version): root_context = super(ContextManager, self).create_root_context( runtime_version) return linked_context.link( root_context, yaql_functions.get_context(runtime_version))
def create_root_context(self, runtime_version): root_context = super(ContextManager, self).create_root_context(runtime_version) return linked_context.link(root_context, yaql_functions.get_context(runtime_version))
def create_package_context(self, package): root_context = self.create_root_context(package.runtime_version) context = linked_context.link( root_context, self.context_manager.create_package_context(package)) return context