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


Python DotDict.date_key方法代码示例

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


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

示例1: _summary_for_a_product_version_pair

# 需要导入模块: from socorrolib.lib.util import DotDict [as 别名]
# 或者: from socorrolib.lib.util.DotDict import date_key [as 别名]
    def _summary_for_a_product_version_pair(self, a_pv_accumulator):
        """in the original code, the counter structures were walked and
        manipulated to form the statistics.  Once a stat was determined,
        it was printed to stdout.  Since we want to have various means of
        outputting the data, instead of printing to stdout, this method
        save the statistic in a "summary_structure"  This structure will
        later be walked for printing or output to some future storage scheme

        The summary structure looks like this:
        pv_summary
            .date_key  # a list of the last six UUID characters present
            .notes  # any notes added by the algorithm to tell of problems
            .os_counters[os_name*]
                 .count
                 .signatures[a_signature*]
                     .count
                     .in_sig_ratio
                     .in_os_ratio
                     .in_os_count
                     .osys_count
                     .modules[a_module*]  # may be addons
                         .in_sig_ratio
                         .in_os_ratio
                         .in_os_count
                         .osys_count
                         .verisons[a_version*]  # may be addon versions
                             .sig_ver_ratio
                             .sig_ver_count
                             .sig_count
                             .os_ver_ratio
                             .os_ver_count
                             .osys_count
                             .version
        """

        options = self.config
        pv_summary = SocorroDotDict({"notes": []})
        if len(self.date_suffix) > 1:
            message = "crashes from more than one day %s" % str(tuple(self.date_suffix.keys()))
            ##            self.config.logger.debug(message)
            pv_summary.notes.append(message)
        pv_summary.date_key = self.date_suffix.keys()[0]
        pv_summary.os_counters = {}

        MIN_CRASHES = self.config.min_crashes
        counters_for_multiple_os = a_pv_accumulator.osyses

        # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        # begin - refactored code section
        # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        infostr_re = re.compile("^(.*) with (\d+) cores$")  # unused?

        for os_name in counters_for_multiple_os.keys():
            counters_for_an_os = counters_for_multiple_os[os_name]

            pv_summary.os_counters[os_name] = SocorroDotDict()
            pv_summary.os_counters[os_name].count = counters_for_multiple_os[os_name].count
            pv_summary.os_counters[os_name].signatures = {}
            filtered_signatures = [
                (signature, signature_counter)
                for (signature, signature_counter) in counters_for_an_os["signatures"].items()
                if signature_counter.count >= MIN_CRASHES
            ]
            for a_signature, a_signtaure_counter in filtered_signatures:
                pv_summary.os_counters[os_name].signatures[a_signature] = SocorroDotDict()
                pv_summary.os_counters[os_name].signatures[a_signature].count = a_signtaure_counter.count
                pv_summary.os_counters[os_name].signatures[a_signature].modules = {}
                modules_list = [
                    SocorroDotDict(
                        {
                            "libname": module_name,
                            "in_sig_count": a_module_counter.count,
                            "in_sig_ratio": float(a_module_counter.count) / a_signtaure_counter.count,
                            "in_sig_versions": a_module_counter.versions,
                            "in_os_count": counters_for_an_os.modules[module_name].count,
                            "in_os_ratio": (
                                float(counters_for_an_os.modules[module_name].count) / counters_for_an_os.count
                            ),
                            "in_os_versions": counters_for_an_os.modules[module_name].versions,
                        }
                    )
                    for module_name, a_module_counter in a_signtaure_counter.modules.iteritems()
                ]

                modules_list = [
                    module
                    for module in modules_list
                    if module.in_sig_ratio - module.in_os_ratio >= self.config.min_baseline_diff
                ]

                modules_list.sort(key=lambda module: module.in_sig_ratio - module.in_os_ratio, reverse=True)

                for module in modules_list:
                    module_name = module.libname
                    if options.addons:
                        info = addonids.info_for_id(module_name)
                        if info is not None:
                            module_name = module_name + u" ({0}, {1})".format(info.name, info.url)
                    if options.show_versions and len(module["in_os_versions"]) == 1:
                        onlyver = module.in_os_versions.keys()[0]
#.........这里部分代码省略.........
开发者ID:KaiRo-at,项目名称:socorro,代码行数:103,代码来源:interesting_rule.py


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