def _prepare_context(runtime_version, action): context = yaql_integration.create_context( runtime_version).create_child_context() for cls in CONTRACT_METHODS: context.register_function( Contract._get_contract_factory(cls, action)) return context
def get_context(runtime_version): context = yaql_integration.create_empty_context() context.register_function(base64decode) context.register_function(base64encode) context.register_function(pselect) context.register_function(bind) context.register_function(random_name) context.register_function(patch_) context.register_function(logger) if runtime_version <= constants.RUNTIME_VERSION_1_1: context.register_function(substr) context.register_function(first_or_default) root_context = yaql_integration.create_context(runtime_version) for t in ('to_lower', 'to_upper', 'trim', 'join', 'split', 'starts_with', 'ends_with', 'matches', 'replace', 'flatten'): for spec in utils.to_extension_method(t, root_context): context.register_function(spec) return context
def create_root_context(self, runtime_version): return yaql_integration.create_context(runtime_version)