from yaql.language import specs from murano.dsl import constants from murano.dsl import dsl from murano.dsl import dsl_types from murano.dsl import exceptions from murano.dsl import helpers from murano.dsl import macros from murano.dsl import meta from murano.dsl import typespec from murano.dsl import virtual_exceptions from murano.dsl import yaql_integration macros.register() virtual_exceptions.register() class MuranoMethod(dsl_types.MuranoMethod, meta.MetaProvider): def __init__(self, declaring_type, name, payload, original_name=None, ephemeral=False): self._name = name original_name = original_name or name self._declaring_type = weakref.ref(declaring_type) self._meta_values = None self_ref = self if ephemeral else weakref.proxy(self) if callable(payload): if isinstance(payload, specs.FunctionDefinition): self._body = payload else:
import six from yaql.language import specs from murano.dsl import constants from murano.dsl import dsl from murano.dsl import dsl_types from murano.dsl import exceptions from murano.dsl import helpers from murano.dsl import macros from murano.dsl import meta from murano.dsl import typespec from murano.dsl import virtual_exceptions from murano.dsl import yaql_integration macros.register() virtual_exceptions.register() class MuranoMethod(dsl_types.MuranoMethod, meta.MetaProvider): def __init__(self, declaring_type, name, payload, original_name=None): self._name = name original_name = original_name or name self._declaring_type = weakref.ref(declaring_type) self._meta_values = None if callable(payload): if isinstance(payload, specs.FunctionDefinition): self._body = payload else: self._body = yaql_integration.get_function_definition( payload, weakref.proxy(self), original_name)