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


Python DotDict.keys方法代码示例

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


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

示例1: FakeStorageSource

# 需要导入模块: from socorro.lib.util import DotDict [as 别名]
# 或者: from socorro.lib.util.DotDict import keys [as 别名]
        class FakeStorageSource(object):
            def __init__(self, config, quit_check_callback):
                self.store = DotDict({'1234': DotDict({'ooid': '1234',
                                                       'Product': 'FireFloozy',
                                                       'Version': '1.0'}),
                                      '1235': DotDict({'ooid': '1235',
                                                       'Product': 'ThunderRat',
                                                       'Version': '1.0'}),
                                      '1236': DotDict({'ooid': '1236',
                                                       'Product': 'Caminimal',
                                                       'Version': '1.0'}),
                                      '1237': DotDict({'ooid': '1237',
                                                       'Product': 'Fennicky',
                                                       'Version': '1.0'}),
                                     })

            def get_raw_crash(self, ooid):
                return self.store[ooid]

            def get_raw_dumps(self, ooid):
                return {'upload_file_minidump': 'this is a fake dump'}

            def new_crashes(self):
                for k in self.store.keys():
                    yield k
开发者ID:GabiThume,项目名称:socorro,代码行数:27,代码来源:test_generic_fetch_transform_save_app.py

示例2: test_get_iterator

# 需要导入模块: from socorro.lib.util import DotDict [as 别名]
# 或者: from socorro.lib.util.DotDict import keys [as 别名]
    def test_get_iterator(self):
        config = DotDict()
        config.logger = self.logger
        config.quit_on_empty_queue = False

        tm = TaskManager(config, job_source_iterator=range(1))
        eq_(tm._get_iterator(), [0])

        def an_iter(self):
            for i in range(5):
                yield i

        tm = TaskManager(config, job_source_iterator=an_iter)
        eq_([x for x in tm._get_iterator()], [0, 1, 2, 3, 4])

        class X(object):
            def __init__(self, config):
                self.config = config

            def __iter__(self):
                for key in self.config:
                    yield key

        tm = TaskManager(config, job_source_iterator=X(config))
        eq_([x for x in tm._get_iterator()], [y for y in config.keys()])
开发者ID:snorp,项目名称:socorro,代码行数:27,代码来源:test_task_manager.py

示例3: test_get_iterator

# 需要导入模块: from socorro.lib.util import DotDict [as 别名]
# 或者: from socorro.lib.util.DotDict import keys [as 别名]
    def test_get_iterator(self):
        config = DotDict()
        config.logger = self.logger
        config.quit_on_empty_queue = False

        tm = TaskManager(
            config,
            job_source_iterator=range(1),
        )
        assert tm._get_iterator() == [0]

        def an_iter(self):
            for i in range(5):
                yield i

        tm = TaskManager(
            config,
            job_source_iterator=an_iter,
        )
        assert list(tm._get_iterator()) == [0, 1, 2, 3, 4]

        class X(object):

            def __init__(self, config):
                self.config = config

            def __iter__(self):
                for key in self.config:
                    yield key

        tm = TaskManager(
            config,
            job_source_iterator=X(config)
        )
        assert list(tm._get_iterator()) == list(config.keys())
开发者ID:m8ttyB,项目名称:socorro,代码行数:37,代码来源:test_task_manager.py

示例4: FakeStorageSource

# 需要导入模块: from socorro.lib.util import DotDict [as 别名]
# 或者: from socorro.lib.util.DotDict import keys [as 别名]
        class FakeStorageSource(object):
            def __init__(self, config, quit_check_callback):
                self.store = DotDict(
                    {
                        "1234": DotDict({"ooid": "1234", "Product": "FireSquid", "Version": "1.0"}),
                        "1235": DotDict({"ooid": "1235", "Product": "ThunderRat", "Version": "1.0"}),
                        "1236": DotDict({"ooid": "1236", "Product": "Caminimal", "Version": "1.0"}),
                        "1237": DotDict({"ooid": "1237", "Product": "Fennicky", "Version": "1.0"}),
                    }
                )

            def get_raw_crash(self, ooid):
                return self.store[ooid]

            def get_raw_dumps(self, ooid):
                return {"upload_file_minidump": "this is a fake dump", "flash1": "broken flash dump"}

            def new_crashes(self):
                for k in self.store.keys():
                    yield k
开发者ID:gitter-badger,项目名称:socorro,代码行数:22,代码来源:test_crash_mover_app.py

示例5: test_get_iterator

# 需要导入模块: from socorro.lib.util import DotDict [as 别名]
# 或者: from socorro.lib.util.DotDict import keys [as 别名]
    def test_get_iterator(self):
        config = DotDict()
        config.logger = self.logger
        tm = TaskManager(
            config,
            job_source_iterator=range(1),
        )
        self.assertEqual(tm._get_iterator(), [0])

        def an_iter(self):
            for i in range(5):
                yield i

        tm = TaskManager(
            config,
            job_source_iterator=an_iter,
        )
        self.assertEqual(
            [x for x in tm._get_iterator()],
            [0, 1, 2, 3, 4]
        )

        class X(object):
            def __init__(self, config):
                self.config = config

            def __iter__(self):
                for key in self.config:
                    yield key

        tm = TaskManager(
            config,
            job_source_iterator=X(config)
        )
        self.assertEqual(
            [x for x in tm._get_iterator()],
            [y for y in config.keys()]
        )
开发者ID:FishingCactus,项目名称:socorro,代码行数:40,代码来源:test_task_manager.py


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