[issue40691] misleading output from difflib unified_diff

2020-05-19 Thread Chris Danis


New submission from Chris Danis :

When difflib.unified_diff is asked to produce a diff of inputs a.txt and b.txt 
(attached), with 10 context lines, it produces the following:

--- codfw/groupLoadsBySection live
+++ codfw/groupLoadsBySection generated
@@ -90,37 +90,31 @@
 },
 "s4": {
 "api": {
 "db2106": 300,
 "db2110": 100
 },
 "contributions": {
 "db2084:3314": 100,
 "db2091:3314": 100
 },
-"dump": {
-"db2073": 100
-},
-"logpager": {
-"db2084:3314": 100,
-"db2091:3314": 100
-},
-"recentchanges": {
-"db2084:3314": 100,
-"db2091:3314": 100
-},
-"recentchangeslinked": {
-"db2084:3314": 100,
-"db2091:3314": 100
-},
-"vslow": {
-"db2073": 100
+"logpager": {
+"db2084:3314": 100,
+"db2091:3314": 100
+},
+"recentchanges": {
+"db2084:3314": 100,
+"db2091:3314": 100
+},
+"recentchangeslinked": {
+"db2084:3314": 100,
+"db2091:3314": 100
 },
 "watchlist": {
 "db2084:3314": 100,
 "db2091:3314": 100
 }
 },
 "s5": {
 "api": {
 "db2075": 300,
 "db2128": 100


However, this could simply and much more readably be rendered as:

@@ -90,38 +90,32 @@
   },
   "s4": {
 "api": {
   "db2106": 3,
   "db2110": 1
 },
 "contributions": {
   "db2084:3314": 1,
   "db2091:3314": 1
 },
-"dump": {
-  "db2073": 1
-},
 "logpager": {
   "db2084:3314": 1,
   "db2091:3314": 1
 },
 "recentchanges": {
   "db2084:3314": 1,
   "db2091:3314": 1
 },
 "recentchangeslinked": {
   "db2084:3314": 1,
   "db2091:3314": 1
 },
-"vslow": {
-  "db2073": 1
-},
 "watchlist": {
   "db2084:3314": 1,
   "db2091:3314": 1
 }
   },
   "s5": {
 "api": {
   "db2059": 1,
   "db2066": 1
 },

(This is what diff -u10 produces.)

--
components: Library (Lib)
files: a.txt
messages: 369390
nosy: cdanis
priority: normal
severity: normal
status: open
title: misleading output from difflib unified_diff
versions: Python 3.7
Added file: https://bugs.python.org/file49171/a.txt

___
Python tracker 
<https://bugs.python.org/issue40691>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40691] misleading output from difflib unified_diff

2020-05-19 Thread Chris Danis


Change by Chris Danis :


Added file: https://bugs.python.org/file49172/b.txt

___
Python tracker 
<https://bugs.python.org/issue40691>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com