-
Notifications
You must be signed in to change notification settings - Fork 475
Fix typos #1240
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
base: main
Are you sure you want to change the base?
Fix typos #1240
Conversation
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.
Code Review
This pull request fixes a number of typos across the codebase. The changes are mostly correct. I've found a couple of minor issues:
- In
python/scripts/test_magika_model.py, a typo was fixed but replaced with another incorrect word. I've suggested a fix. - In
python/CHANGELOG.md, the numbering of a list is inconsistent, which I've pointed out for better readability.
Overall, good catch on the typos!
| ``` | ||
|
|
||
| 1. **CLI Output Format Change (v0.6.0):** The JSON output format of the CLI has changed. Those changes are analogous to the changes to the Python APIs. The `score` field is now at the top level, alongside `dl` and `output`, and is no longer nested within `dl` or `output`. The output also includes `is_text` and `extensions` fields. The `magic` metadata has been removed as it was often either incorrect or reduntant; use `description` instead. Moreover, similarly to what happens under the hood with the `StatusOr` pattern, `result.status` indicates whether the prediction was successful, and the prediction results are available under the `result.value` key. | ||
| 1. **CLI Output Format Change (v0.6.0):** The JSON output format of the CLI has changed. Those changes are analogous to the changes to the Python APIs. The `score` field is now at the top level, alongside `dl` and `output`, and is no longer nested within `dl` or `output`. The output also includes `is_text` and `extensions` fields. The `magic` metadata has been removed as it was often either incorrect or redundant; use `description` instead. Moreover, similarly to what happens under the hood with the `StatusOr` pattern, `result.status` indicates whether the prediction was successful, and the prediction results are available under the `result.value` key. |
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.
While this PR fixes a typo, I noticed that the numbered list items in the 'Breaking Changes and Migration Guide' section all start with 1.. For better readability of the raw markdown file, it would be clearer to number them sequentially. This item should be 2., and subsequent items in this list should be numbered 3., 4., and so on.
| 1. **CLI Output Format Change (v0.6.0):** The JSON output format of the CLI has changed. Those changes are analogous to the changes to the Python APIs. The `score` field is now at the top level, alongside `dl` and `output`, and is no longer nested within `dl` or `output`. The output also includes `is_text` and `extensions` fields. The `magic` metadata has been removed as it was often either incorrect or redundant; use `description` instead. Moreover, similarly to what happens under the hood with the `StatusOr` pattern, `result.status` indicates whether the prediction was successful, and the prediction results are available under the `result.value` key. | |
| 2. **CLI Output Format Change (v0.6.0):** The JSON output format of the CLI has changed. Those changes are analogous to the changes to the Python APIs. The `score` field is now at the top level, alongside `dl` and `output`, and is no longer nested within `dl` or `output`. The output also includes `is_text` and `extensions` fields. The `magic` metadata has been removed as it was often either incorrect or redundant; use `description` instead. Moreover, similarly to what happens under the hood with the `StatusOr` pattern, `result.status` indicates whether the prediction was successful, and the prediction results are available under the `result.value` key. |
| predicated_content_type = mr.prediction.output.label | ||
| expected_content_type = test_path.parent.name | ||
| if prediceted_content_type != expected_content_type: | ||
| if predicated_content_type != expected_content_type: | ||
| with_error = True | ||
| log_error( | ||
| f'{test_path} predicted as "{prediceted_content_type}" (score: {mr.prediction.score:.4f}), expected "{expected_content_type}".' | ||
| f'{test_path} predicted as "{predicated_content_type}" (score: {mr.prediction.score:.4f}), expected "{expected_content_type}".' | ||
| ) |
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 fixes one typo (prediceted), but introduces another. The correct spelling is predicted, not predicated. 'Predicated' means 'based on', while 'predicted' refers to a future outcome, which is what the model does.
| predicated_content_type = mr.prediction.output.label | |
| expected_content_type = test_path.parent.name | |
| if prediceted_content_type != expected_content_type: | |
| if predicated_content_type != expected_content_type: | |
| with_error = True | |
| log_error( | |
| f'{test_path} predicted as "{prediceted_content_type}" (score: {mr.prediction.score:.4f}), expected "{expected_content_type}".' | |
| f'{test_path} predicted as "{predicated_content_type}" (score: {mr.prediction.score:.4f}), expected "{expected_content_type}".' | |
| ) | |
| predicted_content_type = mr.prediction.output.label | |
| expected_content_type = test_path.parent.name | |
| if predicted_content_type != expected_content_type: | |
| with_error = True | |
| log_error( | |
| f'{test_path} predicted as "{predicted_content_type}" (score: {mr.prediction.score:.4f}), expected "{expected_content_type}".' | |
| ) |
|
Thanks! This touches many files, and I'll first need to update the versioning of the packages as well. I'll get to it. BTW, is the git diff coming from just using those tools above automatically, or you used the tools and then you manually checked what were reasonable findings? I'm wondering whether we could add these commands as part of our CI... |
Noted.
Manually check one by one, as suggested by the tools. Corrections were applied based on my understanding of the context or intended usage of the doc/code. |
Found via
codespell -S *.json,*.lock,tests_data -L hve,afterallandtypos --hidden --format brief