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


Python ParameterSetManager.get_param方法代码示例

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


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

示例1: _test_metadata

# 需要导入模块: from tardis.tardis_portal.ParameterSetManager import ParameterSetManager [as 别名]
# 或者: from tardis.tardis_portal.ParameterSetManager.ParameterSetManager import get_param [as 别名]
 def _test_metadata(self,schema,name,dataset,fields):
     """ Check that metadata is correct"""
     try:
         sch = models.Schema.objects.get(namespace__exact=schema,name=name)
     except Schema.DoesNotExist:
         self.assertTrue(False)
     self.assertEqual(schema,sch.namespace)
     self.assertEqual(name,sch.name)
     try:
         datasetparameterset = models.DatasetParameterSet.objects.get(schema=sch, dataset=dataset)
     except DatasetParameterSet.DoesNotExist:
         self.assertTrue(False) 
     psm = ParameterSetManager(parameterset=datasetparameterset)
     for key, field_type, value in fields:
         logger.debug("key=%s,field_type=%s,value=%s" % (key,field_type, value))
         try:
             # First check stringed value
             param = psm.get_param(key,value=True)
             self.assertEquals(str(param),str(value))
             # Then correct type
             param = psm.get_param(key,value=False)
             self.assertEquals(param.name.data_type,field_type)
         except DatasetParameter.DoesNotExist:
             logger.error("cannot find %s" % key)
             self.assertTrue(False)
开发者ID:mytardis,项目名称:hpctardis,代码行数:27,代码来源:tests.py

示例2: test_existing_parameterset

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

        psm = ParameterSetManager(parameterset=self.datafileparameterset)

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

        self.assertTrue(psm.get_param("parameter1").string_value == "test1")

        self.assertTrue(psm.get_param("parameter2", True) == 2)
开发者ID:IntersectAustralia,项目名称:mytardis,代码行数:12,代码来源:test_parametersetmanager.py

示例3: testPersisterStoresEntryMetadata

# 需要导入模块: from tardis.tardis_portal.ParameterSetManager import ParameterSetManager [as 别名]
# 或者: from tardis.tardis_portal.ParameterSetManager.ParameterSetManager import get_param [as 别名]
 def testPersisterStoresEntryMetadata(self):
     # Create user to associate with dataset
     user = User(username="tatkins")
     user.save()
     feed, entry = self._getTestEntry()
     p = AtomPersister()
     dataset = p.process(feed, entry)
     parameterset = dataset.getParameterSets().get(schema=AtomImportSchemas.get_schema(Schema.DATASET))
     expect(parameterset) != None
     psm = ParameterSetManager(parameterset)
     expect(psm.get_param("EntryID").get()).to_equal(entry.id)
     expect(psm.get_param("Updated").name.isDateTime()).to_be_truthy()
     # Compare against non-timezoned update time
     expect(psm.get_param("Updated", True)).to_equal(iso8601.parse_date(entry.updated))
开发者ID:UQ-CMM-Mirage,项目名称:mytardis-app-atom,代码行数:16,代码来源:test_atom_ingest.py

示例4: test_link_parameter_type

# 需要导入模块: from tardis.tardis_portal.ParameterSetManager import ParameterSetManager [as 别名]
# 或者: from tardis.tardis_portal.ParameterSetManager.ParameterSetManager import get_param [as 别名]
    def test_link_parameter_type(self):
        """
        Test that Parameter.link_gfk (GenericForeignKey) is correctly
        assigned after using Parameter.set_value(some_url) for a LINK Parameter.
        """
        psm = ParameterSetManager(parameterset=self.datafileparameterset)

        # Check link to experiment
        exp_url = self.exp.get_absolute_url()  # /experiment/view/1/
        self.assertTrue(psm.get_param("exp_link").string_value ==
                        exp_url)

        self.assertTrue(psm.get_param("exp_link").link_id ==
                        self.exp.id)

        exp_ct = ContentType.objects.get(model__iexact="experiment")
        self.assertTrue(psm.get_param("exp_link").link_ct == exp_ct)

        self.assertTrue(psm.get_param("exp_link").link_gfk == self.exp)

        # Check link to dataset
        dataset_url = self.dataset.get_absolute_url()  # /dataset/1/
        self.assertTrue(psm.get_param("dataset_link").string_value ==
                        dataset_url)

        self.assertTrue(psm.get_param("dataset_link").link_id ==
                        self.dataset.id)

        dataset_ct = ContentType.objects.get(model__iexact="dataset")
        self.assertTrue(psm.get_param("dataset_link").link_ct == dataset_ct)

        self.assertTrue(psm.get_param("dataset_link").link_gfk == self.dataset)
开发者ID:IntersectAustralia,项目名称:mytardis,代码行数:34,代码来源:test_parametersetmanager.py

示例5: testPersisterAgainstPicasa

# 需要导入模块: from tardis.tardis_portal.ParameterSetManager import ParameterSetManager [as 别名]
# 或者: from tardis.tardis_portal.ParameterSetManager.ParameterSetManager import get_param [as 别名]
 def testPersisterAgainstPicasa(self):
     '''
     Test against Picasa - useful for development testing
     '''
     # Build a persister with "make_local_copy" mocked out
     # (file transfer isn't part of this test)
     persister = flexmock(AtomPersister())
     persister.should_receive('make_local_copy').times(50)
     doc = feedparser.parse('picasa_example.atom')
     # Process the first twenty entries
     for entry in list(reversed(doc.entries))[0:20]:
         persister.process(doc.feed, entry)
     # We processed 20 images (Picasa only has one image per dataset)
     eq_(Dataset.objects.count(), 20)
     # This part has 2 users
     eq_(User.objects.count(), 2)
     # This part covers 6 albums
     eq_(Experiment.objects.count(), 6)
     for experiment in Experiment.objects.all():
         pset = experiment.getParameterSets().get(schema=AtomImportSchemas. \
                         get_schema(Schema.EXPERIMENT))
         pset_mgr = ParameterSetManager(pset)
         assert experiment.title != pset_mgr.get_param('ExperimentID')
         # Change the experiment titles, to check this won't be a problem
         experiment.title = "Title removed for testing"
         experiment.save()
     # Process the rest of the entries
     for entry in list(reversed(doc.entries))[20:]:
         persister.process(doc.feed, entry)
     # We processed 50 images (Picasa only has one image per dataset)
     eq_(Dataset.objects.count(), 50)
     # This part has 2 users
     eq_(User.objects.count(), 4)
     # This part covers 6 albums
     eq_(Experiment.objects.count(), 9)
开发者ID:VeRSI-Australia,项目名称:RMIT-MicroTardis-Atom-ingest,代码行数:37,代码来源:test_atom_ingest.py

示例6: get_or_create_unique_parameterset

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

        experiment = Experiment.objects.get(id=self.experiment_id)

        psm = None

        if not len(parameterset):
            psm = ParameterSetManager(schema=schema,
                    parentObject=experiment)
            return psm
        else:
            for ps in parameterset:
                psm = ParameterSetManager(parameterset=ps)
                try:
                    ps_value = psm.get_param("party_id",
                        True)
                    if value == ps_value:
                        return psm
                except ExperimentParameter.DoesNotExist:
                    pass # keep going

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

        return psm
开发者ID:aaryani,项目名称:aa-migration-test1,代码行数:30,代码来源:MonashANDSService.py

示例7: _get_dict_from_ps

# 需要导入模块: from tardis.tardis_portal.ParameterSetManager import ParameterSetManager [as 别名]
# 或者: from tardis.tardis_portal.ParameterSetManager.ParameterSetManager import get_param [as 别名]
 def _get_dict_from_ps(self, ps):
     '''
     Build dictionary by getting the parameter values from the keys, then
     zipping it all together.
     '''
     psm = ParameterSetManager(ps)
     return dict([('id', ps.id)]+ # Use set ID
                 zip(self.parameter_names,
                     (psm.get_param(k, True) for k in self.parameter_names)))
开发者ID:crawley,项目名称:mytardis,代码行数:11,代码来源:shortcuts.py

示例8: test_tz_naive_date_handling

# 需要导入模块: from tardis.tardis_portal.ParameterSetManager import ParameterSetManager [as 别名]
# 或者: from tardis.tardis_portal.ParameterSetManager.ParameterSetManager import get_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

示例9: get_related_info

# 需要导入模块: from tardis.tardis_portal.ParameterSetManager import ParameterSetManager [as 别名]
# 或者: from tardis.tardis_portal.ParameterSetManager.ParameterSetManager import get_param [as 别名]
 def get_related_info(ps):
     psm = ParameterSetManager(ps)
     parameter_names = ["type", "identifier", "title", "notes"]
     try:
         return dict(
             [("id", ps.id)]
             + zip(parameter_names, (psm.get_param(k, True) for k in parameter_names))  # Use set ID
         )
     except ExperimentParameter.DoesNotExist:
         return dict()  # drop Related_Info record with missing fields
开发者ID:JMSS-IT-11-2012,项目名称:mytardis,代码行数:12,代码来源:experiment.py

示例10: get_related_info

# 需要导入模块: from tardis.tardis_portal.ParameterSetManager import ParameterSetManager [as 别名]
# 或者: from tardis.tardis_portal.ParameterSetManager.ParameterSetManager import get_param [as 别名]
 def get_related_info(ps):
     psm = ParameterSetManager(ps)
     parameter_names = ['type','identifier','title','notes']
     try:
         return dict([('id', ps.id)] + # Use set ID
                     zip(parameter_names,
                         (psm.get_param(k, True) \
                              for k in parameter_names)))
     except ExperimentParameter.DoesNotExist:
         return dict() # drop Related_Info record with missing fields
开发者ID:keithschulze,项目名称:mytardis,代码行数:12,代码来源:experiment.py

示例11: testJEOLComplex

# 需要导入模块: from tardis.tardis_portal.ParameterSetManager import ParameterSetManager [as 别名]
# 或者: from tardis.tardis_portal.ParameterSetManager.ParameterSetManager import get_param [as 别名]
    def testJEOLComplex(self):
        JEOLSEMFilter()(None, instance=self.datafiles[1])

        # Check a parameter set was created
        dataset = Dataset.objects.get(id=self.dataset.id)
        expect(dataset.getParameterSets().count()).to_equal(1)

        # Check all the expected parameters are there
        psm = ParameterSetManager(dataset.getParameterSets()[0])
        expect(psm.get_param('metadata-filename', True))\
            .to_equal(self.datafiles[1].filename)
        expect(psm.get_param('instrument', True)).to_equal('7001F_TTL')
        expect(psm.get_param('accel_volt', True)).to_equal(15.0)
        expect(psm.get_param('micron_bar', True)).to_equal(213)
        expect(psm.get_param('micron_marker', True)).to_equal(100)

        # Check we won't create a duplicate dataset
        JEOLSEMFilter()(None, instance=self.datafiles[1])
        dataset = Dataset.objects.get(id=self.dataset.id)
        expect(dataset.getParameterSets().count()).to_equal(1)
开发者ID:IntersectAustralia,项目名称:mytardis,代码行数:22,代码来源:test_jeolsem.py

示例12: test_tz_aware_date_handling

# 需要导入模块: from tardis.tardis_portal.ParameterSetManager import ParameterSetManager [as 别名]
# 或者: from tardis.tardis_portal.ParameterSetManager.ParameterSetManager import get_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

示例13: _get_param

# 需要导入模块: from tardis.tardis_portal.ParameterSetManager import ParameterSetManager [as 别名]
# 或者: from tardis.tardis_portal.ParameterSetManager.ParameterSetManager import get_param [as 别名]
 def _get_param(self, key, namespace, experiment):
     parameterset = ExperimentParameterSet.objects.filter(
                         schema__namespace=namespace,
                         experiment__id=experiment.id)
     if len(parameterset) > 0:
         psm = ParameterSetManager(parameterset=parameterset[0])
         try:
             return psm.get_param(key, True)
         except MultipleObjectsReturned:
             return psm.get_params(key, True)
         except ObjectDoesNotExist:
             return None
开发者ID:TheGoodRob,项目名称:mytardis,代码行数:14,代码来源:schemarifcsprovider.py

示例14: testFilter

# 需要导入模块: from tardis.tardis_portal.ParameterSetManager import ParameterSetManager [as 别名]
# 或者: from tardis.tardis_portal.ParameterSetManager.ParameterSetManager import get_param [as 别名]
    def testFilter(self):
        DataGrabberFilter()(None, instance=self.datafiles[0])

        # Check a DATASET parameter set was created
        dataset = Dataset.objects.get(id=self.dataset.id)
        expect(dataset.getParameterSets().count()).to_equal(1)

        # Check all the expected parameters are there
        psm = ParameterSetManager(dataset.getParameterSets()[0])
        expect(psm.get_param('admin-filename', True))\
            .to_equal(self.datafiles[0].filename)
        expect(psm.get_param('user_name', True)).to_equal('s.crawley')
        expect(psm.get_param('facility_name', True)).to_equal('QBP NIKON TIE')
        expect(psm.get_param('account_name', True)).to_equal('200 - CMM STAFF')
        expect(psm.get_param('session_uuid', True)).to_equal(
            'cbc86da5-e143-4a11-9951-abaffef70efa')
        expect(psm.get_param('record_uuid', True)).to_equal(
            'ddf0df63-d985-4ffa-9102-e34a78b3fd1f')
        
        # Repeat for the datafile parameters
        expect(self.datafiles[0].getParameterSets().count()).to_equal(0)
        expect(self.datafiles[1].getParameterSets().count()).to_equal(1)
        psm = ParameterSetManager(self.datafiles[1].getParameterSets()[0])
        expect(psm.get_param('instrument_pathname', True)).to_equal(
            'S:\\Garry\\testfile.txt')

        # Check we won't create a duplicate dataset
        DataGrabberFilter()(None, instance=self.datafiles[0])
        dataset = Dataset.objects.get(id=self.dataset.id)
        expect(dataset.getParameterSets().count()).to_equal(1)
开发者ID:UQ-CMM-Mirage,项目名称:mytardis-app-datagrabber,代码行数:32,代码来源:test_datagrabber.py

示例15: test_new_parameterset

# 需要导入模块: from tardis.tardis_portal.ParameterSetManager import ParameterSetManager [as 别名]
# 或者: from tardis.tardis_portal.ParameterSetManager.ParameterSetManager import get_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


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