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


Python ParameterSetManager.new_param方法代码示例

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


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

示例1: _create_experiment_id_parameter_set

# 需要导入模块: from tardis.tardis_portal.ParameterSetManager import ParameterSetManager [as 别名]
# 或者: from tardis.tardis_portal.ParameterSetManager.ParameterSetManager import new_param [as 别名]
 def _create_experiment_id_parameter_set(self, experiment, experimentId):
     '''
     Adds ExperimentID field to dataset schema
     '''
     namespace = AtomImportSchemas.get_schema(Schema.EXPERIMENT).namespace
     mgr = ParameterSetManager(parentObject=experiment, schema=namespace)
     mgr.new_param(IngestOptions.PARAM_EXPERIMENT_ID, experimentId)
开发者ID:grischa,项目名称:mytardis-app-atom,代码行数:9,代码来源:atom_ingest.py

示例2: _create_entry_parameter_set

# 需要导入模块: from tardis.tardis_portal.ParameterSetManager import ParameterSetManager [as 别名]
# 或者: from tardis.tardis_portal.ParameterSetManager.ParameterSetManager import new_param [as 别名]
    def _create_entry_parameter_set(self, dataset, entryId, updated):
        '''
        Creates or updates schema for dataset with populated 'EntryID' and 'Updated' fields
        ''' 
        schema = AtomImportSchemas.get_schema(Schema.DATASET)
        # I'm not sure why mgr.set_param always creates additional parametersets. Anyway
        # we can't use it. --SB.
        try:
            p = DatasetParameter.objects.get(parameterset__dataset=dataset, parameterset__schema=schema,
                                        name__name=IngestOptions.PARAM_ENTRY_ID)
        except DatasetParameter.DoesNotExist:
            
            mgr = ParameterSetManager(parentObject=dataset, schema=schema.namespace)
            mgr.new_param(IngestOptions.PARAM_ENTRY_ID, entryId)
        try:
            p = DatasetParameter.objects.get(parameterset__dataset=dataset, parameterset__schema=schema,
                                        name__name=IngestOptions.PARAM_UPDATED)

            i=iso8601.parse_date(updated)
            l=get_local_time_naive(i)
            p.datetime_value = l
            p.save()
        except DatasetParameter.DoesNotExist:            
            mgr = ParameterSetManager(parentObject=dataset, schema=schema.namespace)
                       
            t = get_local_time_naive(iso8601.parse_date(updated))
            logging.getLogger(__name__).debug("Setting update parameter with datetime %s" % t)  
            mgr.new_param(IngestOptions.PARAM_UPDATED, t)
开发者ID:grischa,项目名称:mytardis-app-atom,代码行数:30,代码来源:atom_ingest.py

示例3: test_tz_naive_date_handling

# 需要导入模块: from tardis.tardis_portal.ParameterSetManager import ParameterSetManager [as 别名]
# 或者: from tardis.tardis_portal.ParameterSetManager.ParameterSetManager import new_param [as 别名]
    def test_tz_naive_date_handling(self):
        """
        Ensure that dates are handling in a timezone-aware way.
        """
        psm = ParameterSetManager(parameterset=self.datafileparameterset)

        psm.new_param("parameter3", str(datetime(1970, 01, 01, 10, 0, 0)))

        expect(psm.get_param("parameter3", True))\
            .to_equal(datetime(1970, 01, 01, 0, 0, 0, tzinfo=pytz.utc))
开发者ID:IntersectAustralia,项目名称:mytardis,代码行数:12,代码来源:test_parametersetmanager.py

示例4: save_datafile_add_form

# 需要导入模块: from tardis.tardis_portal.ParameterSetManager import ParameterSetManager [as 别名]
# 或者: from tardis.tardis_portal.ParameterSetManager.ParameterSetManager import new_param [as 别名]
def save_datafile_add_form(schema, parentObject, request):

    psm = ParameterSetManager(schema=schema, parentObject=parentObject)

    for key, value in sorted(request.POST.iteritems()):
        if value:
            stripped_key = key.replace("_s47_", "/")
            stripped_key = stripped_key.rpartition("__")[0]

            psm.new_param(stripped_key, value)
开发者ID:aaryani,项目名称:aa-migration-test1,代码行数:12,代码来源:forms.py

示例5: save_datafile_edit_form

# 需要导入模块: from tardis.tardis_portal.ParameterSetManager import ParameterSetManager [as 别名]
# 或者: from tardis.tardis_portal.ParameterSetManager.ParameterSetManager import new_param [as 别名]
def save_datafile_edit_form(parameterset, request):

    psm = ParameterSetManager(parameterset=parameterset)
    psm.delete_all_params()

    for key, value in sorted(request.POST.iteritems()):
        if value:
            stripped_key = key.replace('_s47_', '/')
            stripped_key = stripped_key.rpartition('__')[0]

            psm.new_param(stripped_key, value)
开发者ID:IntersectAustralia,项目名称:mytardis,代码行数:13,代码来源:forms.py

示例6: test_tz_aware_date_handling

# 需要导入模块: from tardis.tardis_portal.ParameterSetManager import ParameterSetManager [as 别名]
# 或者: from tardis.tardis_portal.ParameterSetManager.ParameterSetManager import new_param [as 别名]
    def test_tz_aware_date_handling(self):
        '''
        Ensure that dates are handling in a timezone-aware way.
        '''
        psm = ParameterSetManager(parameterset=self.datafileparameterset)

        psm.new_param("parameter3",
                      iso8601.parse_date('1970-01-01T08:00:00+08:00'))

        expect(psm.get_param("parameter3", True))\
            .to_equal(datetime(1970,01,01,0,0,0,tzinfo=pytz.utc))
开发者ID:TheGoodRob,项目名称:mytardis,代码行数:13,代码来源:test_parametersetmanager.py

示例7: _get_or_create_publish_parameterset

# 需要导入模块: from tardis.tardis_portal.ParameterSetManager import ParameterSetManager [as 别名]
# 或者: from tardis.tardis_portal.ParameterSetManager.ParameterSetManager import new_param [as 别名]
    def _get_or_create_publish_parameterset(self, create):
        parameterset = ExperimentParameterSet.objects.filter(
                        schema__namespace=self.schema,
                        experiment__id=self.experiment_id)

        if len(parameterset) == 1:
            psm = ParameterSetManager(parameterset=parameterset[0])
        elif create:
            experiment = Experiment.objects.get(id=self.experiment_id)
            psm = ParameterSetManager(schema=self.schema,
                    parentObject=experiment)
            psm.new_param(self.access_type_key, UNPUBLISHED)
        else:
            psm = None

        return psm
开发者ID:ANSTO,项目名称:ands_register,代码行数:18,代码来源:publishing.py

示例8: test_new_parameterset

# 需要导入模块: from tardis.tardis_portal.ParameterSetManager import ParameterSetManager [as 别名]
# 或者: from tardis.tardis_portal.ParameterSetManager.ParameterSetManager import new_param [as 别名]
    def test_new_parameterset(self):

        psm = ParameterSetManager(parentObject=self.datafile,
                                  schema="http://localhost/psmtest/df2/")

        self.assertTrue(psm.get_schema().namespace ==
                        "http://localhost/psmtest/df2/")

        psm.set_param("newparam1", "test3", "New Parameter 1")

        self.assertTrue(psm.get_param("newparam1").string_value ==
                        "test3")

        self.assertTrue(psm.get_param("newparam1").name.full_name ==
                        "New Parameter 1")

        psm.new_param("newparam1", "test4")

        self.assertTrue(len(psm.get_params("newparam1", True)) == 2)

        psm.set_param_list("newparam2", ("a", "b", "c", "d"))

        self.assertTrue(len(psm.get_params("newparam2")) == 4)

        psm.set_params_from_dict(
            {"newparam2": "test5", "newparam3": 3})

        self.assertTrue(psm.get_param("newparam2", True) == "test5")

        # the newparam3 gets created and '3' is set to a string_value
        # since once cannot assume that an initial numeric value
        # will imply continuing numeric type for this new param
        self.assertTrue(psm.get_param("newparam3").string_value == '3')

        psm.delete_params("newparam1")

        self.assertTrue(len(psm.get_params("newparam1", True)) == 0)
开发者ID:IntersectAustralia,项目名称:mytardis,代码行数:39,代码来源:test_parametersetmanager.py

示例9: _create_experiment_id_parameter_set

# 需要导入模块: from tardis.tardis_portal.ParameterSetManager import ParameterSetManager [as 别名]
# 或者: from tardis.tardis_portal.ParameterSetManager.ParameterSetManager import new_param [as 别名]
 def _create_experiment_id_parameter_set(self, experiment, experimentId):
     namespace = AtomImportSchemas.get_schema(Schema.EXPERIMENT).namespace
     mgr = ParameterSetManager(parentObject=experiment, schema=namespace)
     mgr.new_param(self.PARAM_EXPERIMENT_ID, experimentId)
开发者ID:UQ-CMM-Mirage,项目名称:mytardis-app-atom,代码行数:6,代码来源:atom_ingest.py

示例10: _create_entry_parameter_set

# 需要导入模块: from tardis.tardis_portal.ParameterSetManager import ParameterSetManager [as 别名]
# 或者: from tardis.tardis_portal.ParameterSetManager.ParameterSetManager import new_param [as 别名]
 def _create_entry_parameter_set(self, dataset, entryId, updated):
     namespace = AtomImportSchemas.get_schema(Schema.DATASET).namespace
     mgr = ParameterSetManager(parentObject=dataset, schema=namespace)
     mgr.new_param(self.PARAM_ENTRY_ID, entryId)
     mgr.new_param(self.PARAM_UPDATED, iso8601.parse_date(updated))
开发者ID:UQ-CMM-Mirage,项目名称:mytardis-app-atom,代码行数:7,代码来源:atom_ingest.py


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