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


Python DefaultToolState.encode方法代码示例

本文整理汇总了Python中galaxy.tools.DefaultToolState.encode方法的典型用法代码示例。如果您正苦于以下问题:Python DefaultToolState.encode方法的具体用法?Python DefaultToolState.encode怎么用?Python DefaultToolState.encode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在galaxy.tools.DefaultToolState的用法示例。


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

示例1: WorkflowModule

# 需要导入模块: from galaxy.tools import DefaultToolState [as 别名]
# 或者: from galaxy.tools.DefaultToolState import encode [as 别名]
class WorkflowModule(object):

    def __init__(self, trans, content_id=None, **kwds):
        self.trans = trans
        self.content_id = content_id
        self.state = DefaultToolState()

    # ---- Creating modules from various representations ---------------------

    @classmethod
    def from_dict(Class, trans, d, **kwds):
        module = Class(trans, **kwds)
        module.recover_state(d.get("tool_state"))
        module.label = d.get("label")
        return module

    @classmethod
    def from_workflow_step(Class, trans, step, **kwds):
        module = Class(trans, **kwds)
        module.recover_state(step.tool_inputs)
        module.label = step.label
        return module

    # ---- Saving in various forms ------------------------------------------

    def save_to_step(self, step):
        step.type = self.type
        step.tool_inputs = self.get_state()

    # ---- General attributes -----------------------------------------------

    def get_type(self):
        return self.type

    def get_name(self):
        return self.name

    def get_version(self):
        return None

    def get_content_id(self):
        """ If this component has an identifier external to the step (such
        as a tool or another workflow) return the identifier for that content.
        """
        return None

    def get_tooltip(self, static_path=''):
        return None

    # ---- Configuration time -----------------------------------------------

    def get_state(self, nested=True):
        """ Return a serializable representation of the persistable state of
        the step.
        """
        inputs = self.get_inputs()
        if inputs:
            return self.state.encode(Bunch(inputs=inputs), self.trans.app, nested=nested)
        else:
            return self.state.inputs

    def recover_state(self, state, **kwds):
        """ Recover state `dict` from simple dictionary describing configuration
        state (potentially from persisted step state).

        Sub-classes should supply a `default_state` method which contains the
        initial state `dict` with key, value pairs for all available attributes.
        """
        self.state = DefaultToolState()
        inputs = self.get_inputs()
        if inputs:
            self.state.decode(state, Bunch(inputs=inputs), self.trans.app)
        else:
            self.state.inputs = safe_loads(state) or {}

    def get_errors(self):
        """ This returns a step related error message as string or None """
        return None

    def get_inputs(self):
        """ This returns inputs displayed in the workflow editor """
        return {}

    def get_data_inputs(self):
        """ Get configure time data input descriptions. """
        return []

    def get_data_outputs(self):
        return []

    def get_post_job_actions(self, incoming):
        return []

    def check_and_update_state(self):
        """
        If the state is not in sync with the current implementation of the
        module, try to update. Returns a list of messages to be displayed
        """
        pass

#.........这里部分代码省略.........
开发者ID:bwlang,项目名称:galaxy,代码行数:103,代码来源:modules.py


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