Add some thoughtful handling around "None" cases #12
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.
This PR is triggered by a scenario I had where some of my photos had
thumbhash: None
. This was throwing the following exception:This made me wonder... do we want to stack files where a key is None? Probably not!
I'm not sure if it's possible for localDateTime or originalFilename values to be None or absent, but the concern would apply there as well. Imagine stacking all photos that don't have a localDateTime - it's not logical.
The adjustments I recommend in this PR are:
[]
is how we represent a scenario where we had trouble creating the criteria keys. This could be because of a regex mismatch, null value, or something we haven't thought of yet.[]
is better than puttingNone
list because None causes with python's sort function.[]
) appears in the list of stacks. Also to be safe, raise an exception if any None values appear in the stack keys.[]
) results, not just regex mismatch.A realistic scenario:
Suppose:
The changes in the PR will:
The important takeaway from my perspective is there are no scenarios were all 5000 files are processed given the provided criteria.