From ddccc6f93e05f0049ac1eb1272711e49499c9b7b Mon Sep 17 00:00:00 2001 From: Emmanuelle Vargas-Gonzalez Date: Fri, 11 Sep 2020 11:40:22 -0400 Subject: [PATCH] include results as summary in prop_scores, minor tweaks --- stix2/equivalence/graph_equivalence/__init__.py | 3 ++- stix2/equivalence/object_equivalence/__init__.py | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/stix2/equivalence/graph_equivalence/__init__.py b/stix2/equivalence/graph_equivalence/__init__.py index b87fd45c..7b25d3b7 100644 --- a/stix2/equivalence/graph_equivalence/__init__.py +++ b/stix2/equivalence/graph_equivalence/__init__.py @@ -81,9 +81,10 @@ def graphically_equivalent(ds1, ds2, prop_scores={}, **weight_dict): equivalence_score = (matching_score / sum_weights) * 100 prop_scores["matching_score"] = matching_score prop_scores["sum_weights"] = sum_weights + prop_scores["summary"] = results logger.debug( - "DONE\nSUM_WEIGHT: %.2f\tMATCHING_SCORE: %.2f\t SCORE: %.2f", + "DONE\t\tSUM_WEIGHT: %.2f\tMATCHING_SCORE: %.2f\t SCORE: %.2f", sum_weights, matching_score, equivalence_score, diff --git a/stix2/equivalence/object_equivalence/__init__.py b/stix2/equivalence/object_equivalence/__init__.py index 9895a632..219d89e5 100644 --- a/stix2/equivalence/object_equivalence/__init__.py +++ b/stix2/equivalence/object_equivalence/__init__.py @@ -330,11 +330,11 @@ def semantic_check(ref1, ref2, ds1, ds2, **weights): result = 1.0 elif type1 == type2: if weights["_internal"]["versioning_checks"]: - result = _versioned_checks(ref1, ref2, ds1, ds2, **weights) / 100 + result = _versioned_checks(ref1, ref2, ds1, ds2, **weights) / 100.0 else: o1, o2 = ds1.get(ref1), ds2.get(ref2) if o1 and o2: - result = semantically_equivalent(o1, o2, **weights) / 100 + result = semantically_equivalent(o1, o2, **weights) / 100.0 logger.debug( "--\t\tsemantic_check '%s' '%s'\tresult: '%s'",