[join-] prevent diff error for empty merge cells #2400
Merged
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.
After merging sheets, cells in
MergeColumn
holdNone
for rows that were not present on the sheet that theMergeColumn
came from. Visidata shows errors when those⌀
cells appear on screen:test_merge.vdj.txt
cd sample_data; vd -p test_merge.vdj
The
return
statements in this PR could be shortened to a one-line conditional:return col and ((row[col.sheet] is None) or (value != col.getValue(row[col.sheet])
. But I broke it up to multiple lines because I foundrow
andcol
to be quite difficult objects to think about. In fact, I wanted to add a comment to describe what situation would makerow[col.sheet]
beNone
. Butrow
comes fromgroupRowsByKey()
, and it's complex enough that I'm not sure I can describe it correctly:visidata/visidata/features/join.py
Line 121 in a48c4ee
This change to
isDiff()
only silences the error. It doesn't actually change the color of the⌀
cells, for two reasons:color_diff
is not set by default, soisDiff()
has no visible effect.color_diff
is set, it would not be used for⌀
, becausecolor_note_type
takes precedence.