当前位置: 首页>>代码示例>>Python>>正文


Python helpers.get_executor函数代码示例

本文整理汇总了Python中murano.dsl.helpers.get_executor函数的典型用法代码示例。如果您正苦于以下问题:Python get_executor函数的具体用法?Python get_executor怎么用?Python get_executor使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了get_executor函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: convert

 def convert(self, value, sender, context, function_spec, engine,
             *args, **kwargs):
     this = helpers.get_this(context)
     if isinstance(this, dsl_types.MuranoObject):
         executor = helpers.get_executor(context)
         return MuranoObjectInterface(this, executor)
     return this
开发者ID:Aqsamm,项目名称:murano,代码行数:7,代码来源:dsl.py

示例2: create_stack_trace

def create_stack_trace(context, include_native_frames=True):
        stacktrace = yaql_integration.call_func(
            context, 'new', 'io.murano.StackTrace',
            includeNativeFrames=include_native_frames)
        executor = helpers.get_executor(context)
        return dsl.MuranoObjectInterface(
            stacktrace, executor)
开发者ID:Aqsamm,项目名称:murano,代码行数:7,代码来源:stack_trace.py

示例3: extension_payload

 def extension_payload(__context, __receiver, *args, **kwargs):
     executor = helpers.get_executor(__context)
     args = tuple(dsl.to_mutable(arg, engine) for arg in args)
     kwargs = dsl.to_mutable(kwargs, engine)
     return helpers.evaluate(murano_method.invoke(
         executor, murano_method.declaring_type,
         (__receiver,) + args, kwargs, __context, True), __context)
开发者ID:HarborOS,项目名称:murano,代码行数:7,代码来源:yaql_integration.py

示例4: get_meta

 def get_meta(self, context):
     if self._meta_values is None:
         executor = helpers.get_executor()
         context = executor.create_type_context(
             self, caller_context=context)
         self._meta_values = dslmeta.merge_providers(
             self, lambda cls: cls._meta, context)
     return self._meta_values
开发者ID:AleptNamrata,项目名称:murano,代码行数:8,代码来源:murano_type.py

示例5: op_dot

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)
开发者ID:tianshangjun,项目名称:murano,代码行数:8,代码来源:yaql_functions.py

示例6: new

def new(__context, __type_name, __owner=None, __object_name=None, __extra=None, **parameters):
    object_store = helpers.get_object_store(__context)
    executor = helpers.get_executor(__context)
    new_context = __context.create_child_context()
    for key, value in six.iteritems(parameters):
        if utils.is_keyword(key):
            new_context[key] = value
    return __type_name.murano_class.new(__owner, object_store, executor, name=__object_name)(new_context, **parameters)
开发者ID:olivierlemasle,项目名称:murano,代码行数:8,代码来源:yaql_functions.py

示例7: dump

def dump(obj, serialization_type=serializer.DumpTypes.Serializable,
         ignore_upcasts=True):
    if serialization_type not in serializer.DumpTypes.All:
        raise ValueError('Invalid Serialization Type')
    executor = helpers.get_executor()
    if ignore_upcasts:
        obj = obj.real_this
    return serializer.serialize(obj, executor, serialization_type)
开发者ID:AleptNamrata,项目名称:murano,代码行数:8,代码来源:yaql_functions.py

示例8: op_dot

def op_dot(context, receiver, expr, operator):
    executor = helpers.get_executor()
    type_context = executor.context_manager.create_type_context(receiver.type)
    obj_context = executor.context_manager.create_object_context(receiver)
    ctx2 = helpers.link_contexts(
        helpers.link_contexts(context, type_context),
        obj_context)
    return operator(ctx2, receiver, expr)
开发者ID:AleptNamrata,项目名称:murano,代码行数:8,代码来源:yaql_functions.py

示例9: invoke

 def invoke(context, this, *args):
     try:
         executor = helpers.get_executor(context)
         murano_class = helpers.get_type(context)
         return executor.invoke_method(name, this, context, murano_class, *args)
     except exceptions.NoMethodFound:
         raise yaql.exceptions.YaqlExecutionException()
     except exceptions.AmbiguousMethodName:
         raise yaql.exceptions.YaqlExecutionException()
开发者ID:nastya-kuz,项目名称:murano,代码行数:9,代码来源:yaql_functions.py

示例10: __getattr__

        def __getattr__(self, item):
            executor = self.__executor or helpers.get_executor()

            def func(*args, **kwargs):
                self._insert_instruction()
                return self.__object.type.invoke(
                    item, executor, self.__object, args, kwargs,
                    helpers.get_context())
            return func
开发者ID:Magic-Mirror,项目名称:murano,代码行数:9,代码来源:dsl.py

示例11: transform

 def transform(self, value, this, owner, context, default=None):
     if default is None:
         default = self.default
     executor = helpers.get_executor(context)
     if isinstance(this, dsl_types.MuranoType):
         return self._contract.transform(
             value, executor.create_object_context(this),
             None, None, default, helpers.get_type(context))
     else:
         return self._contract.transform(
             value, executor.create_object_context(
                 this.cast(self._container_type())),
             this, owner, default, helpers.get_type(context))
开发者ID:satish-avninetworks,项目名称:murano,代码行数:13,代码来源:typespec.py

示例12: validate

 def validate(self, value, this, owner, context, default=None):
     if default is None:
         default = self.default
     executor = helpers.get_executor(context)
     if isinstance(this, dsl_types.MuranoClass):
         return self._contract(
             value, executor.create_object_context(this),
             None, None, default)
     else:
         return self._contract(
             value, executor.create_object_context(
                 this.cast(self._container_class())),
             this, owner, default)
开发者ID:olivierlemasle,项目名称:murano,代码行数:13,代码来源:typespec.py

示例13: get_meta

    def get_meta(self, context):
        def meta_producer(cls):
            method = cls.methods.get(self.name)
            if method is None:
                return None
            return method._meta

        if self._meta_values is None:
            executor = helpers.get_executor(context)
            context = executor.create_type_context(
                self.declaring_type, caller_context=context)
            self._meta_values = meta.merge_providers(
                self.declaring_type, meta_producer, context)
        return self._meta_values
开发者ID:HarborOS,项目名称:murano,代码行数:14,代码来源:murano_method.py

示例14: invoke

    def invoke(self, this, args, kwargs, context=None, skip_stub=False):
        if isinstance(this, dsl.MuranoObjectInterface):
            this = this.object
        if this and not self.declaring_type.is_compatible(this):
            raise Exception("'this' must be of compatible type")
        if not this and not self.is_static:
            raise Exception("A class instance is required")

        if isinstance(this, dsl_types.MuranoObject):
            this = this.cast(self.declaring_type)
        else:
            this = self.declaring_type
        executor = helpers.get_executor()
        return executor.invoke_method(
            self, this, context, args, kwargs, skip_stub)
开发者ID:AleptNamrata,项目名称:murano,代码行数:15,代码来源:murano_method.py

示例15: load

    def load(self, value, parent, context, defaults=None):
        #tmp_store = ObjectStore(self._class_loader, self)

        if value is None:
            return None
        if '?' not in value or 'type' not in value['?']:
            raise ValueError()
        system_key = value['?']
        object_id = system_key['id']
        obj_type = system_key['type']
        class_obj = self._class_loader.get_class(obj_type)
        if not class_obj:
            raise ValueError()
        if object_id in self._store:
            obj = self._store[object_id]
        else:
            obj = class_obj.new(parent, self, context=context,
                                object_id=object_id, defaults=defaults)
            self._store[object_id] = obj
            self._designer_attributes_store[object_id] = \
                ObjectStore._get_designer_attributes(system_key)

        argspec = inspect.getargspec(obj.initialize).args
        if '_context' in argspec:
            value['_context'] = context
        if '_parent' in argspec:
            value['_parent'] = parent

        try:
            if parent is None:
                self._initializing = True
            obj.initialize(**value)
            if parent is None:
                self._initializing = False
                obj.initialize(**value)
        finally:
            if parent is None:
                self._initializing = False

        if not self.initializing:
            executor = helpers.get_executor(context)
            methods = obj.type.find_all_methods('initialize')
            methods.reverse()
            for method in methods:
                method.invoke(executor, obj, {})
        return obj
开发者ID:nastya-kuz,项目名称:murano,代码行数:46,代码来源:object_store.py


注:本文中的murano.dsl.helpers.get_executor函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。