本文整理汇总了Python中glue.core.data_combo_helper.ComponentIDComboHelper.append_data方法的典型用法代码示例。如果您正苦于以下问题:Python ComponentIDComboHelper.append_data方法的具体用法?Python ComponentIDComboHelper.append_data怎么用?Python ComponentIDComboHelper.append_data使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类glue.core.data_combo_helper.ComponentIDComboHelper
的用法示例。
在下文中一共展示了ComponentIDComboHelper.append_data方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from glue.core.data_combo_helper import ComponentIDComboHelper [as 别名]
# 或者: from glue.core.data_combo_helper.ComponentIDComboHelper import append_data [as 别名]
def __init__(self, function, data_in=None, data_out=None, cids_in=None,
cids_out=None, input_names=None, output_names=None,
display=None, description=None):
super(EditableLinkFunctionState, self).__init__()
if isinstance(function, ComponentLink):
self._function = function.get_using()
self._inverse = function.get_inverse()
self._helper_class = None
cids_in = function.get_from_ids()
cids_out = function.get_to_ids()
data_in = cids_in[0].parent
data_out = cids_out[0].parent
self.display = self._function.__name__
self.description = function.description
elif isinstance(function, LinkCollection):
self._function = None
self._helper_class = function.__class__
cids_in = function.cids1
cids_out = function.cids2
data_in = cids_in[0].parent
# To be backward-compatible with cases where @link_helper doesn't
# include output labels, we need to assume cids_out can be empty
# in which case we look for the second dataset inside cids_in
if len(cids_out) > 0:
data_out = cids_out[0].parent
else:
for cid in cids_in[1:]:
if cid.parent is not data_in:
data_out = cid.parent
break
else:
raise ValueError("Could not determine second dataset in link")
self.display = function.display
self.description = function.description
self._mode = 'helper'
elif type(function) is type and issubclass(function, LinkCollection):
self._function = None
self._helper_class = function
self.display = function.display
self.description = function.description
elif isinstance(function, (FunctionType, MethodType)):
self._function = function
self._inverse = None
self._helper_class = None
self.inverse = None
self.display = display
self.description = description
else:
raise TypeError("Unexpected type for 'function': {0}".format(type(function)))
self.data_in = data_in
self.data_out = data_out
for name in self.input_names:
helper = ComponentIDComboHelper(self, name,
pixel_coord=True, world_coord=True)
helper.append_data(data_in)
helper.append_data(data_out)
setattr(self, '_' + name + '_helper', helper)
for name in self.output_names:
helper = ComponentIDComboHelper(self, name,
pixel_coord=True, world_coord=True)
helper.append_data(data_out)
helper.append_data(data_in)
setattr(self, '_' + name + '_helper', helper)
if cids_in is not None:
for name, cid in zip(self.input_names, cids_in):
setattr(self, name, cid)
if cids_out is not None:
for name, cid in zip(self.output_names, cids_out):
setattr(self, name, cid)