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


Python Db.get_whorl_value_count方法代码示例

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


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

示例1: single_whorl_uniqueness

# 需要导入模块: from db import Db [as 别名]
# 或者: from db.Db import get_whorl_value_count [as 别名]
    def single_whorl_uniqueness(whorl_name, whorl_value):
        print "here"
        db = Db()
        db.connect()

        md5_whorl_value = FingerprintHelper.value_or_md5({whorl_name: whorl_value})[whorl_name]

        try:
            count = db.get_whorl_value_count(whorl_name, md5_whorl_value, config.epoched)
        except TypeError:
            return {"status": "Error: that value has not yet been recorded for '" + whorl_name + "'"}

        total = db.get_total_count(config.epoched)

        uniqueness = {"bits": round(-log(count / float(total), 2), 2), "one_in_x": round(float(total) / count, 2)}

        return uniqueness
开发者ID:EFForg,项目名称:panopticlick-python,代码行数:19,代码来源:entropy_helper.py

示例2: _fetch_counts

# 需要导入模块: from db import Db [as 别名]
# 或者: from db.Db import get_whorl_value_count [as 别名]
    def _fetch_counts(whorls):
        db = Db()
        db.connect()

        # result dict. 'total' is the total number of entries, 'sig_matches' is
        # the number matching signature in whorls, other keys are variables in
        # signature.
        counts = {}

        # query an incrementally updated totals table which has an index on
        # unique (variable, value)
        md5_whorls = FingerprintHelper.value_or_md5(whorls)
        for i in FingerprintHelper.whorl_names:
            counts[i] = db.get_whorl_value_count(i, md5_whorls[i], config.epoched)

        total = db.get_total_count(config.epoched)

        matching = db.get_signature_matches_count(whorls["signature"], config.epoched)

        return counts, total, matching
开发者ID:EFForg,项目名称:panopticlick-python,代码行数:22,代码来源:entropy_helper.py


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