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


Python GlueUnSerializer.load方法代码示例

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


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

示例1: restore_session

# 需要导入模块: from glue.core.state import GlueUnSerializer [as 别名]
# 或者: from glue.core.state.GlueUnSerializer import load [as 别名]
    def restore_session(path):
        """
        Reload a previously-saved session

        Parameters
        ----------
        path : str
            Path to the file to load

        Returns
        -------
        app : :class:`Application`
            The loaded application
        """
        from glue.core.state import GlueUnSerializer

        # In case relative paths are needed in the session file, we do the
        # loading while setting the current directory to the directory
        # in which the session file is so that relative paths are interpreted
        # as relative to the session file.
        start_dir = os.path.abspath('.')
        session_dir = os.path.dirname(path) or '.'
        session_file = os.path.basename(path)

        try:
            os.chdir(session_dir)
            with open(session_file) as infile:
                state = GlueUnSerializer.load(infile)
            return state.object('__main__')
        finally:
            os.chdir(start_dir)
开发者ID:glue-viz,项目名称:glue,代码行数:33,代码来源:application_base.py

示例2: restore_session

# 需要导入模块: from glue.core.state import GlueUnSerializer [as 别名]
# 或者: from glue.core.state.GlueUnSerializer import load [as 别名]
    def restore_session(path):
        """
        Reload a previously-saved session

        Parameters
        ----------
        path : str
            Path to the file to load

        Returns
        -------
        app : :class:`Application`
            The loaded application
        """
        from glue.core.state import GlueUnSerializer

        with open(path) as infile:
            state = GlueUnSerializer.load(infile)

        return state.object('__main__')
开发者ID:crawfordsm,项目名称:glue,代码行数:22,代码来源:application_base.py

示例3: test_table_widget_010

# 需要导入模块: from glue.core.state import GlueUnSerializer [as 别名]
# 或者: from glue.core.state.GlueUnSerializer import load [as 别名]
def test_table_widget_010():

    from glue.viewers.table.qt.tests.test_data_viewer import check_values_and_color

    # This loads a session file made with Glue v0.10 that includes a table
    # viewer. This is to make sure that loading table viewers from old files
    # will always be backward-compatible.

    with open(os.path.join(DATA, 'glue_v0.10_table.glu'), 'r') as f:
        state = GlueUnSerializer.load(f)

    ga = state.object('__main__')

    viewer = ga.viewers[0][0]

    data = {'x': [1, 2, 3],
            'y': [4, 5, 6]}

    colors = ['#e31a1c', '#6d7326', None]

    check_values_and_color(viewer.model, data, colors)

    ga.close()
开发者ID:jzuhone,项目名称:glue,代码行数:25,代码来源:test_session_back_compat.py


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