problem_report: let load() return skipped keys#580
Open
bdrung wants to merge 1 commit intocanonical:mainfrom
Open
problem_report: let load() return skipped keys#580bdrung wants to merge 1 commit intocanonical:mainfrom
bdrung wants to merge 1 commit intocanonical:mainfrom
Conversation
c55cd5d to
8432d1c
Compare
The documentation for `ProblemReport.load()` says: > If binary is False, binary data is not loaded; the dictionary key is > created, but its value will be an empty string. Commit 64820a0 ("apport-unpack: Fix ValueError: ['separator'] has no binary content") changed this behavior to fix a crash in apport-unpack. Setting non-loaded values to `None` will make type hints more complicated and less useful. Values in the problem report should not be allowed to be `None`. Instead of adding dictionary keys with a special value for not loaded keys, just let `load()` return the keys that were skipped. This reduces guess work and make the code more robust. Remove `ProblemReport.has_removed_fields()` since that information is lost and this function was only used in Apport tests.
8432d1c to
48f97fe
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #580 +/- ##
==========================================
- Coverage 84.45% 84.44% -0.01%
==========================================
Files 104 104
Lines 20939 20931 -8
Branches 3212 3210 -2
==========================================
- Hits 17683 17675 -8
+ Misses 2816 2815 -1
- Partials 440 441 +1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The documentation for
ProblemReport.load()says:Commit 64820a0 ("apport-unpack: Fix ValueError: ['separator'] has no binary content") changed this behavior to fix a crash in apport-unpack.
Setting non-loaded values to
Nonewill make type hints more complicated and less useful. Values in the problem report should not be allowed to beNone.Instead of adding dictionary keys with a special value for not loaded keys, just let
load()return the keys that were skipped. This reduces guess work and make the code more robust.Remove
ProblemReport.has_removed_fields()since that information is lost and this function was only used in Apport tests.