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


Python staticconf.get函数代码示例

本文整理汇总了Python中staticconf.get函数的典型用法代码示例。如果您正苦于以下问题:Python get函数的具体用法?Python get怎么用?Python get使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: test_reload_default

    def test_reload_default(self):
        staticconf.DictConfiguration(dict(one="three", seven="nine"))
        one, seven = staticconf.get("one"), staticconf.get("seven")

        staticconf.DictConfiguration(dict(one="ten", seven="el"))
        staticconf.reload()
        assert_equal(one, "ten")
        assert_equal(seven, "el")
开发者ID:patricklucas,项目名称:PyStaticConfiguration,代码行数:8,代码来源:config_test.py

示例2: test_nested

    def test_nested(self):
        with testing.MockConfiguration(a='one', b='two'):
            with testing.PatchConfiguration(a='three'):
                assert_equal(staticconf.get('a'), 'three')
                assert_equal(staticconf.get('b'), 'two')

            assert_equal(staticconf.get('a'), 'one')
            assert_equal(staticconf.get('b'), 'two')
开发者ID:dnephin,项目名称:PyStaticConfiguration,代码行数:8,代码来源:testing_test.py

示例3: test_mock_configuration_context_manager

    def test_mock_configuration_context_manager(self):
        one = staticconf.get('one')
        three = staticconf.get_int('three', default=3)

        with testing.MockConfiguration(dict(one=7)):
            assert_equal(one, 7)
            assert_equal(three, 3)
        assert_raises(errors.ConfigurationError, staticconf.get('one'))
开发者ID:analogue,项目名称:PyStaticConfiguration,代码行数:8,代码来源:integration_test.py

示例4: test_init_nested

 def test_init_nested(self):
     conf = {
         'a': {
             'b': 'two',
         },
         'c': 'three'
     }
     with testing.MockConfiguration(conf):
         assert_equal(staticconf.get('a.b'), 'two')
         assert_equal(staticconf.get('c'), 'three')
开发者ID:digideskio,项目名称:PyStaticConfiguration,代码行数:10,代码来源:testing_test.py

示例5: test_load_and_validate

 def test_load_and_validate(self):
     staticconf.DictConfiguration(self.config)
     some_class = SomeClass()
     assert_equal(some_class.max, 100)
     assert_equal(some_class.min, 0)
     assert_equal(some_class.ratio, 7.7)
     assert_equal(some_class.alt_ratio, 6.0)
     assert_equal(staticconf.get("globals"), False)
     assert_equal(staticconf.get("enable"), "True")
     assert_equal(staticconf.get_bool("enable"), True)
开发者ID:Roguelazer,项目名称:PyStaticConfiguration,代码行数:10,代码来源:integration_test.py

示例6: test_load_end_to_end

    def test_load_end_to_end(self):
        loader = staticconf.YamlConfiguration
        callback = mock.Mock()
        facade = staticconf.ConfigFacade.load(self.file.name, self.namespace, loader)
        facade.add_callback('one', callback)
        assert_equal(staticconf.get('one', namespace=self.namespace), "A")

        self.write("""one: B""")
        facade.reload_if_changed()
        assert_equal(staticconf.get('one', namespace=self.namespace), "B")
        callback.assert_called_with()
开发者ID:analogue,项目名称:PyStaticConfiguration,代码行数:11,代码来源:config_test.py

示例7: test_reload_single

    def test_reload_single(self):
        name = "another_one"
        staticconf.DictConfiguration(dict(one="three"))
        staticconf.DictConfiguration(dict(two="three"), namespace=name)
        one, two = staticconf.get("one"), staticconf.get("two", namespace=name)
        # access the values to set the value_proxy cache
        one.value, two.value

        staticconf.DictConfiguration(dict(one="four"))
        staticconf.DictConfiguration(dict(two="five"), namespace=name)
        staticconf.reload()
        assert_equal(one, "four")
        assert_equal(two, "three")
开发者ID:patricklucas,项目名称:PyStaticConfiguration,代码行数:13,代码来源:config_test.py

示例8: test_reload_all

    def test_reload_all(self):
        name = 'another_one'
        staticconf.DictConfiguration(dict(one='three'))
        staticconf.DictConfiguration(dict(two='three'), namespace=name)
        one, two = staticconf.get('one'), staticconf.get('two', namespace=name)
        # access the values to set the value_proxy cache
        _ = bool(one), bool(two)

        staticconf.DictConfiguration(dict(one='four'))
        staticconf.DictConfiguration(dict(two='five'), namespace=name)
        staticconf.reload(all_names=True)
        assert_equal(one, 'four')
        assert_equal(two, 'five')
开发者ID:Roguelazer,项目名称:PyStaticConfiguration,代码行数:13,代码来源:config_test.py

示例9: test_load_and_validate

 def test_load_and_validate(self):
     staticconf.DictConfiguration(self.config)
     some_class = SomeClass()
     assert_equal(some_class.max, 100)
     assert_equal(some_class.min, 0)
     assert_equal(some_class.ratio, 7.7)
     assert_equal(some_class.alt_ratio, 6.0)
     assert_equal(staticconf.get('globals'), False)
     assert_equal(staticconf.get('enable'), 'True')
     assert_equal(staticconf.get_bool('enable'), True)
     assert_equal(some_class.msg, None)
     assert staticconf.get_regex('matcher').match('12345')
     assert not staticconf.get_regex('matcher').match('a')
     assert_equal(staticconf.get_list_of_int('options'), [1, 7, 3, 9])
开发者ID:analogue,项目名称:PyStaticConfiguration,代码行数:14,代码来源:integration_test.py

示例10: setup_descriptions

 def setup_descriptions(self):
     staticconf.get('one', help="the one")
     staticconf.get_time('when', default='NOW', help="The time")
     staticconf.get_bool('you sure', default='No', help='Are you?')
     staticconf.get('one', help="the one", namespace='Beta')
     staticconf.get('one', help="the one", namespace='Alpha')
     staticconf.get('two', help="the two", namespace='Alpha')
开发者ID:analogue,项目名称:PyStaticConfiguration,代码行数:7,代码来源:config_test.py

示例11: test_mock_configuration

    def test_mock_configuration(self):
        two = staticconf.get_string('two')
        stars = staticconf.get_bool('stars')

        mock_config = testing.MockConfiguration(dict(two=2, stars=False))
        mock_config.setup()
        assert_equal(two, '2')
        assert not stars
        mock_config.teardown()
        assert_raises(errors.ConfigurationError, staticconf.get('two'))
开发者ID:analogue,项目名称:PyStaticConfiguration,代码行数:10,代码来源:integration_test.py

示例12: rbr_source_cluster_topology_name

    def rbr_source_cluster_topology_name(self):
        """Serves as the key to identify the source database in topology.yaml if
        given.  This value should usually not be provided, so the Replication
        Handler will default to using rbr_source_cluster as both the name of the
        connection, and the topology key.

        This option is useful when re-parenting a replication handler, since it
        can point the rbr_source at a different database in the topology,
        while still treating it as the same virutal cluster.
        """
        return staticconf.get('rbr_source_cluster_topology_name', default=None).value
开发者ID:AndreasPresthammer,项目名称:mysql_streamer,代码行数:11,代码来源:config.py

示例13: sensu_host

 def sensu_host(self):
     """If we're running in Paasta, use the paasta cluster from the
     environment directly as laid out in PAASTA-1579.  This makes it so that
     local-run and real sensu alerts go to the same cluster, which should
     prevent false alerts that never resolve when we run locally.
     """
     if os.environ.get('PAASTA_CLUSTER'):
         return "paasta-{cluster}.yelp".format(
             cluster=os.environ.get('PAASTA_CLUSTER')
         )
     else:
         return staticconf.get('sensu_host').value
开发者ID:AndreasPresthammer,项目名称:mysql_streamer,代码行数:12,代码来源:config.py

示例14: team_name

 def team_name(self):
     return staticconf.get('team_name').value
开发者ID:AndreasPresthammer,项目名称:mysql_streamer,代码行数:2,代码来源:config.py

示例15: schema_tracker_cluster

 def schema_tracker_cluster(self):
     """serves as the key to identify the tracker database in topology.yaml
     """
     return staticconf.get('schema_tracker_cluster').value
开发者ID:AndreasPresthammer,项目名称:mysql_streamer,代码行数:4,代码来源:config.py


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