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


Python DatabaseManager.store_submission_match方法代码示例

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


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

示例1: max

# 需要导入模块: from database import DatabaseManager [as 别名]
# 或者: from database.DatabaseManager import store_submission_match [as 别名]
        matching_signatures = database.lookup_matching_signatures(submission_id)
        submissions = [database.fetch_a_submission(submission_id)]
        signatures_by_document = grouper.group_signatures_by_document(matching_signatures, False)

        # find the submission that matches this one the most
        other_submission_id = max(signatures_by_document.iteritems(), key=lambda x: len(x[1]))[0]
        # load that submission
        submissions.append(database.fetch_a_submission(other_submission_id))
        print 'Matched to', other_submission_id

        # find matches between the two
        line_matches, num_matches = match(submissions)

        # if there are real matches, store it
        if line_matches[0]:
            database.store_submission_match(submissions[0].assignment_id, submission_id, other_submission_id,  len(signatures_by_document[other_submission_id]), num_matches)
            database.store_matches(submission_id, other_submission_id, line_matches[0], line_matches[1])
        else:
            continue
        print 'done'

        # the submission of this file may match older submissions better than the currently
        # stored matches. Let's check to see if that's true and update it if so
        for other_submission_id2, signatures in signatures_by_document.iteritems():
            num_signatures = len(signatures)
            signature_match = database.fetch_submission_match(other_submission_id2)

            if signature_match is None:
                continue

            # having more signatures than the stored one is a good indicator
开发者ID:MrHamdulay,项目名称:csc3-capstone,代码行数:33,代码来源:matchesworker.py


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