Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix issue 389 #392

Merged
merged 5 commits into from
May 14, 2020
Merged

Fix issue 389 #392

merged 5 commits into from
May 14, 2020

Conversation

khdesai
Copy link
Contributor

@khdesai khdesai commented May 13, 2020

No description provided.

@codecov-io
Copy link

codecov-io commented May 13, 2020

Codecov Report

Merging #392 into master will decrease coverage by 0.00%.
The diff coverage is 92.30%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #392      +/-   ##
==========================================
- Coverage   98.45%   98.44%   -0.01%     
==========================================
  Files         127      127              
  Lines       14613    14613              
==========================================
- Hits        14387    14386       -1     
- Misses        226      227       +1     
Impacted Files Coverage Δ
stix2/properties.py 98.41% <0.00%> (ø)
stix2/base.py 97.89% <100.00%> (ø)
stix2/test/v21/test_observed_data.py 100.00% <100.00%> (ø)
stix2/canonicalization/Canonicalize.py 61.04% <0.00%> (-0.41%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 31cb2f8...998b4c0. Read the comment docs.

@rpiazza
Copy link
Contributor

rpiazza commented May 13, 2020

I had implemented this somewhat differently - Here is what I did:

   if properties_to_use:
        streamlined_object = {}
        if "hashes" in original_json_object and "hashes" in properties_to_use:
            possible_hash = choose_one_hash(original_json_object["hashes"])
            if possible_hash:
                streamlined_object["hashes"] = possible_hash
        for key in original_json_object.keys():
            if key in properties_to_use and key != "hashes":
                streamlined_object[key] = original_json_object[key]
        data = canonicalize(streamlined_object)

I think this makes more sense - because I think this is the way others would implement it.

What do you think?

@emmanvg emmanvg added this to the 2.0.0 milestone May 13, 2020
Copy link
Contributor

@clenk clenk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me; thanks @khdesai!

@clenk clenk merged commit 658e70b into oasis-open:master May 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants