Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(16)  |  Call(16)  |  Derive(0)  |  Import(0)

src/c/o/conceptdb-HEAD/conceptdb/db_merge.py   conceptdb(Download)
        conceptdb.connect_to_mongodb(db1)
        # New assertions, along with the reasons
        db2_tobeadded.append((db1_a, ReasonConjunction.objects.filter(target=db1_a.name)))
        # Check that each assertion does not exist in the DB with a different Assertion ID
        for db2_check in list(db2_assertions):
            if assertion_check(db1_a, db2_check):
                # Do not add multiple assertions
                db2_tobeadded.pop()
                # But DO add new reasons that point to existing assertions
                if ReasonConjunction.objects.filter(target=db1_a.name) is not None:
                # But DO add new reasons that point to existing assertions
                if ReasonConjunction.objects.filter(target=db1_a.name) is not None:
                    db2_tobeadded.append((None, (ReasonConjunction.objects.filter(target=db1_a.name), db2_check)))
                break         
    # Looping to find assertions in DB2 that are not in DB1
    for db2_a in [a2 for a2 in list(db2_assertions) if a2 not in list(db1_assertions)]:
        conceptdb.connect_to_mongodb(db2)
        # New assertions, along with the reasons
        db1_tobeadded.append((db2_a, ReasonConjunction.objects.filter(target=db2_a.name)))
                db1_tobeadded.pop()
                # But DO add new reasons that point to existing assertions
                if ReasonConjunction.objects.filter(target=db2_a.name) is not None:
                    db1_tobeadded.append((None, (ReasonConjunction.objects.filter(target=db2_a.name), db1_check)))
                break

src/c/o/conceptdb-HEAD/conceptdb/test/test_merge.py   conceptdb(Download)
            print "assertion: %s"%a1
            print "     confidence score: %s"%a1.confidence
            for r1 in list(ReasonConjunction.objects.filter(target=a1.name)):
                print "     reason: %s"%r1.factors
                assert r1.target == a1.name
            print "assertion: %s"%a2
            print "     confidence score: %s"%a2.confidence
            for r2 in list(ReasonConjunction.objects.filter(target=a2.name)):
                print "     reason: %s"%r2.factors
                assert r2.target == a2.name
            print "assertion: %s"%a1
            print "     confidence score: %s"%a1.confidence
            for r1 in list(ReasonConjunction.objects.filter(target=a1.name)):
                print "     reason: %s"%r1.factors
                assert r1.target == a1.name
            print "assertion: %s"%a2
            print "     confidence score: %s"%a2.confidence
            for r2 in list(ReasonConjunction.objects.filter(target=a2.name)):
                print "     reason: %s"%r2.factors
                assert r2.target == a2.name
            #print "assertion: %s"%a1
            #print "     confidence score: %s"%a1.confidence
            for r1 in list(ReasonConjunction.objects.filter(target=a1.name)):
                #print "     reason: %s"%r1.factors
                assert r1.target == a1.name