deep-diff2 icon indicating copy to clipboard operation
deep-diff2 copied to clipboard

How to skip printing values same in both structures?

Open holyjak opened this issue 6 years ago • 5 comments

How to skip printing values same in both structures? I am sorry, I am overwhelmed by fipp and puget and haven't managed to understand how to only print +/-/mismatches. Is there a way to override print-other to be a noop or something? Sorry and thank you!

holyjak avatar Aug 20 '19 16:08 holyjak

This is not currently supported.

On Tue, Aug 20, 2019, 18:03 Jakub Holy [email protected] wrote:

How to skip printing values same in both structures? I am sorry, I am overwhelmed by fipp and puget and haven't managed to understand how to only print +/-/mismatches. Is there a way to override print-other to be a noop or something? Sorry and thank you!

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/lambdaisland/deep-diff/issues/13?email_source=notifications&email_token=AAAH3VDFXEGTPIKMOWFJNLLQFQIUTA5CNFSM4INZJAGKYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4HGJHVBQ, or mute the thread https://github.com/notifications/unsubscribe-auth/AAAH3VEKGNLBJCF4S5AGVNLQFQIUTANCNFSM4INZJAGA .

plexus avatar Aug 20 '19 16:08 plexus

Ah, ok. Thank you.

On Tue, Aug 20, 2019, 6:56 PM Arne Brasseur [email protected] wrote:

This is not currently supported.

On Tue, Aug 20, 2019, 18:03 Jakub Holy [email protected] wrote:

How to skip printing values same in both structures? I am sorry, I am overwhelmed by fipp and puget and haven't managed to understand how to only print +/-/mismatches. Is there a way to override print-other to be a noop or something? Sorry and thank you!

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub < https://github.com/lambdaisland/deep-diff/issues/13?email_source=notifications&email_token=AAAH3VDFXEGTPIKMOWFJNLLQFQIUTA5CNFSM4INZJAGKYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4HGJHVBQ , or mute the thread < https://github.com/notifications/unsubscribe-auth/AAAH3VEKGNLBJCF4S5AGVNLQFQIUTANCNFSM4INZJAGA

.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/lambdaisland/deep-diff/issues/13?email_source=notifications&email_token=AAEYSPQ4ONPRXL6QUVQCZSTQFQO2VA5CNFSM4INZJAGKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD4W6UTI#issuecomment-523102797, or mute the thread https://github.com/notifications/unsubscribe-auth/AAEYSPV6OXMRGQ5T7CPREPLQFQO2VANCNFSM4INZJAGA .

holyjak avatar Aug 20 '19 20:08 holyjak

is this still not supported? I had a look at the diff datastructure. seems changes are of a special type, so one could filter the keys that way.

awb99 avatar Jun 30 '21 15:06 awb99

If it had been you would probably see it mentioned here. I don't think anyone has stepped up yet to implement this.

plexus avatar Jul 01 '21 07:07 plexus

This isn't a solution in terms of dropping things while diffing or while printing, but it's functional as an intermediate step:

https://gist.github.com/hsartoris-bard/856d79d3a13f6cafaaa6e5079c76cd97

Even for relatively small data, the time cost incurred postwalking the diff is often negligible compared to how much faster rendering the diff is without the unchanged values.

hsartoris-bard avatar Jan 27 '22 17:01 hsartoris-bard

This isn't a solution in terms of dropping things while diffing or while printing, but it's functional as an intermediate step:

https://gist.github.com/hsartoris-bard/856d79d3a13f6cafaaa6e5079c76cd97

Even for relatively small data, the time cost incurred postwalking the diff is often negligible compared to how much faster rendering the diff is without the unchanged values.

Run the gist with the newest main commit, it does not work.

humorless avatar Mar 21 '23 13:03 humorless

hsartoris-bard

My friend kindly pointed out my English expression can probably make people misinterpret my intention. What I want to express is: "hi, I've tried running this code on the latest main branch, but it doesn't seem to be working anymore."

The code base sometimes changes quickly (so the gist does not work now), but the gist actually provided a good way to help me understand the issue.

humorless avatar Mar 22 '23 16:03 humorless

An modified version of the solution provided by @hsartoris-bard https://gist.github.com/humorless/166ead294433179abb0b840305950914

humorless avatar Mar 24 '23 15:03 humorless

This is great @humorless , let's add that remove-unchanged function in so at least we have API for this, we can consider separately how to expose this in kaocha.

plexus avatar Mar 28 '23 13:03 plexus

In the newest release, there is a new function minimize, which can solve this issue. https://github.com/lambdaisland/deep-diff2#minimizing

humorless avatar Mar 31 '23 02:03 humorless