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


Python DotDict.keys方法代码示例

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


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

示例1: FakeStorageSource

# 需要导入模块: from collector.lib.util import DotDict [as 别名]
# 或者: from collector.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_dump(self, ooid):
                return 'this is a fake dump'

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

示例2: FakeStorageSource

# 需要导入模块: from collector.lib.util import DotDict [as 别名]
# 或者: from collector.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'}),
                                     })
                self.number_of_close_calls = 0

            def close(self):
                self.number_of_close_calls += 1

            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:yangluphil,项目名称:socorro-collector,代码行数:32,代码来源:test_crash_mover_app.py

示例3: test_get_iterator

# 需要导入模块: from collector.lib.util import DotDict [as 别名]
# 或者: from collector.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:willkg,项目名称:socorro-collector,代码行数:42,代码来源:test_task_manager.py


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