Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Here's another way to go at it using dictionaries to group by sha and directory. This also gets rid of the random lists in the file names.</p> <pre><code>new_fail = {} # {sha: {dir: [filenames]}} for item in fail: # split data into it's parts sha, directory, filename = item # make sure the correct elements exist in the data structure if sha not in new_fail: new_fail[sha] = {} if directory not in new_fail[sha]: new_fail[sha][directory] = [] # this is where the lists are removed from the file names if type(filename) == type([]): filename = filename[0] new_fail[sha][directory].append(filename) diff = [] dup = [] # loop through the data, analyzing it for sha, val in new_fail.iteritems(): for directory, filenames in val.iteritems(): # check to see if the sha/dir combo has more than one file name if len(filenames) &gt; 1: for filename in filenames: dup.append([sha, directory, filename]) else: diff.append([sha, dir, filenames[0]]) </code></pre> <p>To print it:</p> <pre><code>print 'diff:' for i in diff: print i print '\ndup:' for i in dup: print i </code></pre> <p>Sample data looks like this:</p> <pre> diff: ['da39a3ee5e6b4b0d3255bfef95601890afd80709', 'ron\\d', 'Sourcecheck.py'] ['da39a3ee5e6b4b0d3255bfef95601890afd80709', 'ron\\b\\include', 'Test.java'] ['da39a3ee5e6b4b0d3255bfef95601890afd80709', 'ron\\a\\include', 'svin.txt'] ['b5cc17d3a35877ca8b76f0b2e07497039c250696', 'ron\\a', 'apa2.txt'] ['b5cc17d3a35877ca8b76f0b2e07497039c250696', 'ron\\c', 'apa1.txt'] dup: ['95d1543adea47e88923c3d4ad56e9f65c2b40c76', 'ron\\c', 'knark.txt'] ['95d1543adea47e88923c3d4ad56e9f65c2b40c76', 'ron\\c', 'apa.txt']</pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload