-
Notifications
You must be signed in to change notification settings - Fork 569
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
Load .json.gz files directly #1990
Conversation
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
capa/helpers.py
Outdated
@@ -71,7 +71,11 @@ def assert_never(value) -> NoReturn: | |||
|
|||
|
|||
def get_format_from_report(sample: Path) -> str: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this function should return the report format, not the report itself
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't understand. The function returns report format right - FORMAT_CAPE or FORMAT_UNKNOWN
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah sorry, my bad, you are correct, however, there's other locations where cape reports (JSON) are read, see references to json.load
, would you change those as well? likely a helper function to load plain or compressed reports would be useful.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mr-tz, as you suggested, I've created a helper function load_json_from_path
that can load both plain and compressed JSON reports, and there are still a few json.loads
references, but they are used on strings, not for loading JSON reports (if I'm not wrong)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this looks great, please address my comments and add a test e.g. in test_main
(test_main_cape_gz
or similar)
and please add an entry in the changelog so we can recognize your work! |
@mr-tz, thanks for the feedback. I've added a test and made an entry in change log. |
yes, please |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
almost ready to go, thank you!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
amazing, thank you!
closes #1883
For loading .json.gz files directly, used the code from tests:
Checklist