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


Python DataCollection.set_links方法代码示例

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


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

示例1: _load_data_collection_4

# 需要导入模块: from glue.core import DataCollection [as 别名]
# 或者: from glue.core.DataCollection import set_links [as 别名]
def _load_data_collection_4(rec, context):

    dc = DataCollection(list(map(context.object, rec['data'])))
    links = [context.object(link) for link in rec['links']]
    dc.set_links(links)
    coerce_subset_groups(dc)

    dc._subset_groups = list(map(context.object, rec['groups']))
    for grp in dc.subset_groups:
        grp.register_to_hub(dc.hub)

    dc._sg_count = rec['subset_group_count']

    return dc
开发者ID:sergiopasra,项目名称:glue,代码行数:16,代码来源:state.py

示例2: _load_data_collection

# 需要导入模块: from glue.core import DataCollection [as 别名]
# 或者: from glue.core.DataCollection import set_links [as 别名]
def _load_data_collection(rec, context):

    datasets = list(map(context.object, rec['data']))

    links = [context.object(link) for link in rec['links']]

    # Filter out CoordinateComponentLinks that may have been saved in the past
    # as these are now re-generated on-the-fly.
    links = [link for link in links if not isinstance(link, CoordinateComponentLink)]

    # Go through and split links into links internal to datasets and ones
    # between datasets as this dictates whether they should be set on the
    # data collection or on the data objects.
    external, internal = [], []
    for link in links:
        parent_to = link.get_to_id().parent
        for cid in link.get_from_ids():
            if cid.parent is not parent_to:
                external.append(link)
                break
        else:
            internal.append(link)

    # Remove components in datasets that have external links
    for data in datasets:
        remove = []
        for cid in data.derived_components:
            comp = data.get_component(cid)

            # Neihter in external nor in links overall
            if rec.get('_protocol', 0) <= 3:
                if comp.link not in internal:
                    remove.append(cid)

            if isinstance(comp.link, CoordinateComponentLink):
                remove.append(cid)

            if len(comp.link.get_from_ids()) == 1 and comp.link.get_from_ids()[0].parent is comp.link.get_to_id().parent and comp.link.get_from_ids()[0].label == comp.link.get_to_id().label:
                remove.append(cid)

        for cid in remove:
            data.remove_component(cid)

    dc = DataCollection(datasets)

    dc.set_links(external)
    coerce_subset_groups(dc)
    return dc
开发者ID:sergiopasra,项目名称:glue,代码行数:50,代码来源:state.py


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