本文整理汇总了Python中opus_core.session_configuration.SessionConfiguration.get_id_name方法的典型用法代码示例。如果您正苦于以下问题:Python SessionConfiguration.get_id_name方法的具体用法?Python SessionConfiguration.get_id_name怎么用?Python SessionConfiguration.get_id_name使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类opus_core.session_configuration.SessionConfiguration
的用法示例。
在下文中一共展示了SessionConfiguration.get_id_name方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from opus_core.session_configuration import SessionConfiguration [as 别名]
# 或者: from opus_core.session_configuration.SessionConfiguration import get_id_name [as 别名]
def __init__(self, name_of_dataset_to_merge, in_table_name, attribute_cache, years_to_merge, *args, **kwargs):
"""Create a dataset that contains this many years of data from this dataset.
Years are from current year backwards, inclusive.
"""
self.name_of_dataset_to_merge = name_of_dataset_to_merge
self.years_to_merge = years_to_merge
self._validate_primary_attributes_same_for_all_years(name_of_dataset_to_merge, in_table_name, attribute_cache, years_to_merge)
# Add 'year' to id_names.
dataset_for_current_year = SessionConfiguration().get_dataset_from_pool(
self.name_of_dataset_to_merge)
id_names = dataset_for_current_year.get_id_name() + ['year']
self.base_id_name = dataset_for_current_year.get_id_name()
# Masquerade as a dataset of the right type (important for computing the right variables).
dataset_name = dataset_for_current_year.get_dataset_name()
AbstractDataset.__init__(self,
id_name=id_names,
in_table_name=in_table_name,
dataset_name=dataset_name,
*args, **kwargs)
coord_system = dataset_for_current_year.get_coordinate_system()
if coord_system is not None:
self._coordinate_system = coord_system
示例2: _do_flush_dependent_variables_if_required
# 需要导入模块: from opus_core.session_configuration import SessionConfiguration [as 别名]
# 或者: from opus_core.session_configuration.SessionConfiguration import get_id_name [as 别名]
def _do_flush_dependent_variables_if_required(self):
try:
if not SessionConfiguration().get('flush_variables', False):
return
except:
return
from opus_core.datasets.interaction_dataset import InteractionDataset
dataset = self.get_dataset()
dependencies = self.get_current_dependencies()
my_dataset_name = dataset.get_dataset_name()
for iattr in range(len(dependencies)): # iterate over dependent variables
dep_item = dependencies[iattr][0]
if isinstance(dep_item, str):
depvar_name = VariableName(dep_item)
else:
depvar_name = dep_item.get_variable_name() # dep_item should be an instance of AttributeBox
dataset_name = depvar_name.get_dataset_name()
if dataset_name == my_dataset_name:
ds = dataset
else:
ds = SessionConfiguration().get_dataset_from_pool(dataset_name)
#ds = dataset_pool.get_dataset('dataset_name')
if not isinstance(ds, InteractionDataset):
short_name = depvar_name.get_alias()
if short_name not in ds.get_id_name():
ds.flush_attribute(depvar_name)