本文整理汇总了Python中murano.dsl.helpers.get_executor函数的典型用法代码示例。如果您正苦于以下问题:Python get_executor函数的具体用法?Python get_executor怎么用?Python get_executor使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_executor函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: inject_method_with_str
def inject_method_with_str(context, target, target_method,
mock_object, mock_name):
ctx_manager = helpers.get_executor().context_manager
current_class = helpers.get_type(context)
mock_func = current_class.find_single_method(mock_name)
original_class = target.type
original_function = original_class.find_single_method(target_method)
result_fd = original_function.instance_stub.clone()
def payload_adapter(__context, __sender, *args, **kwargs):
return mock_func.invoke(
mock_object, args, kwargs, __context, True)
result_fd.payload = payload_adapter
existing_mocks = ctx_manager.class_mock_ctx.setdefault(
original_class.name, [])
existing_mocks.append(result_fd)
开发者ID:AleptNamrata,项目名称:murano,代码行数:19,代码来源:mock_context_manager.py
示例17: inject_method_with_yaql_expr
def inject_method_with_yaql_expr(context, target, target_method, expr):
ctx_manager = helpers.get_executor().context_manager
original_class = target.type
original_function = original_class.find_single_method(target_method)
result_fd = original_function.instance_stub.clone()
def payload_adapter(__super, __context, __sender, *args, **kwargs):
new_context = context.create_child_context()
new_context[constants.CTX_ORIGINAL_CONTEXT] = __context
mock_obj = context[constants.CTX_THIS]
new_context.register_function(lambda: __super(*args, **kwargs),
name='originalMethod')
return expr(new_context, mock_obj, *args, **kwargs)
result_fd.payload = payload_adapter
result_fd.insert_parameter('__super', yaqltypes.Super())
existing_mocks = ctx_manager.class_mock_ctx.setdefault(
original_class.name, [])
existing_mocks.append(result_fd)
开发者ID:AleptNamrata,项目名称:murano,代码行数:20,代码来源:mock_context_manager.py
示例18: set_property
def set_property(self, name, value, context=None):
start_type, derived = self.__type, False
caller_class = None if not context else helpers.get_type(context)
if caller_class is not None and caller_class.is_compatible(self):
start_type, derived = caller_class, True
declared_properties = start_type.find_properties(
lambda p: p.name == name)
if context is None:
context = helpers.get_executor().create_object_context(self)
if len(declared_properties) > 0:
declared_properties = self.type.find_properties(
lambda p: p.name == name)
values_to_assign = []
classes_for_static_properties = []
for spec in declared_properties:
if (caller_class is not None and not
helpers.are_property_modifications_allowed(context) and
(spec.usage not in dsl_types.PropertyUsages.Writable or
not derived)):
raise exceptions.NoWriteAccessError(name)
if spec.usage == dsl_types.PropertyUsages.Static:
classes_for_static_properties.append(spec.declaring_type)
else:
default = self.__config.get(name, spec.default)
obj = self.cast(spec.declaring_type)
values_to_assign.append((obj, spec.transform(
value, self.real_this,
self.real_this, context, default=default)))
for obj, value in values_to_assign:
obj.__properties[name] = value
for cls in classes_for_static_properties:
cls.set_property(name, value, context)
elif derived:
obj = self.cast(caller_class)
obj.__properties[name] = value
else:
raise exceptions.PropertyWriteError(name, start_type)
开发者ID:AleptNamrata,项目名称:murano,代码行数:39,代码来源:murano_object.py
示例19: attributes
def attributes(self):
executor = helpers.get_executor()
return executor.attribute_store
开发者ID:Magic-Mirror,项目名称:murano,代码行数:3,代码来源:dsl.py
示例20: op_dot_static
def op_dot_static(context, sender, expr, operator):
executor = helpers.get_executor(context)
type_context = executor.context_manager.create_class_context(sender.murano_class)
ctx2 = helpers.link_contexts(context, type_context)
return operator(ctx2, None, expr)
开发者ID:olivierlemasle,项目名称:murano,代码行数:5,代码来源:yaql_functions.py
注:本文中的murano.dsl.helpers.get_executor函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论