diff --git a/src/csvdump.py b/src/csvdump.py index 6dbecb66..6a7a69f2 100755 --- a/src/csvdump.py +++ b/src/csvdump.py @@ -53,7 +53,7 @@ def store_patch(patch): ChangeSets.append([patch.commit, str(patch.date), email_encode(patch.email), domain, _author, employer, patch.added, patch.removed, max(patch.added, patch.removed)]) - for (filetype, (added, removed)) in patch.filetypes.iteritems(): + for (filetype, (added, removed)) in patch.filetypes.items(): FileTypes.append([patch.commit, filetype, added, removed]) diff --git a/src/database.py b/src/database.py index b9e751a5..06ccc428 100755 --- a/src/database.py +++ b/src/database.py @@ -59,7 +59,7 @@ def emailemployer (self, email, date): return empl # pdb.set_trace() # If there is a circular alias - this bug will appear! - print 'OOPS. ', self.name, self.employer, self.email, email, date + print('OOPS. ', self.name, self.employer, self.email, email, date) return None # Should not happen def addpatch (self, patch): @@ -148,7 +148,7 @@ def AllFilesCSV(file, hlist, FileFilter, InvertFilter): aname = patch.author.name datestr = str(patch.date) emplstr = empl.name.replace ('"', '.').replace ('\\', '.') - for (filename, filedata) in patch.files.iteritems(): + for (filename, filedata) in patch.files.items(): if filedata[2] == 0: continue if FileFilter: @@ -186,7 +186,7 @@ def AllAffsCSV(file, hlist): writer.writerow ([email_encode(email), email_encode(name), emplstr, datestr, source]) for em in ReverseAlias(email): if em in emails: - print 'This is bad, reverse email already in emails, check: `em`, `email`, `emails`' + print('This is bad, reverse email already in emails, check: `em`, `email`, `emails`') pdb.set_trace() writer.writerow ([email_encode(em), email_encode(name), emplstr, datestr, source]) @@ -305,7 +305,7 @@ def applysplits (self): def store (self): if self.name in Employers: - print Employers[self.name] + print(Employers[self.name]) sys.stderr.write ('WARNING: Virtual empl %s overwrites another\n' % (self.name)) if len (self.splits) == 0: @@ -385,7 +385,7 @@ def AddEmailEmployerMapping (email, employer, end = nextyear, domain = False): for i in range (0, len(l)): date, xempl, dom = l[i] if date == end: # probably both nextyear - print 'WARNING: duplicate email/empl for %s' % (email_encode(email)) + print('WARNING: duplicate email/empl for %s' % (email_encode(email))) if date > end: l.insert (i, (end, empl, domain)) return @@ -418,7 +418,7 @@ def MapToEmployer (email, unknown = 0): pass namedom = email.split ('@') if len (namedom) < 2: - print 'Oops...funky email %s' % email_encode(email) + print('Oops...funky email %s' % email_encode(email)) return [(nextyear, GetEmployer ('Funky'), False)] s = namedom[1].split ('.') for dots in range (len (s) - 2, -1, -1): @@ -437,7 +437,7 @@ def MapToEmployer (email, unknown = 0): elif unknown == 2: return [(nextyear, GetEmployer ('(Unknown)'), False)] else: - print "Unsupported unknown parameter handling value" + print("Unsupported unknown parameter handling value") def LookupEmployer (email, mapunknown = 0): diff --git a/src/reports.py b/src/reports.py index 695f4366..3a9535b2 100755 --- a/src/reports.py +++ b/src/reports.py @@ -542,7 +542,7 @@ def ReportByFileType (hacker_list): by_hacker = {} for patch in h.patches: # Get a summary by hacker - for (filetype, (added, removed)) in patch.filetypes.iteritems(): + for (filetype, (added, removed)) in patch.filetypes.items(): if filetype in by_hacker: by_hacker[filetype][patch.ADDED] += added by_hacker[filetype][patch.REMOVED] += removed @@ -557,21 +557,21 @@ def ReportByFileType (hacker_list): total[filetype] = [added, removed, []] # Print a summary by hacker - print email_encode(h.full_name_with_aff()) - for filetype, counters in by_hacker.iteritems(): - print '\t', filetype, counters + print(email_encode(h.full_name_with_aff())) + for filetype, counters in by_hacker.items(): + print('\t', filetype, counters) h_added = by_hacker[filetype][patch.ADDED] h_removed = by_hacker[filetype][patch.REMOVED] total[filetype][2].append ([h.full_name_with_aff(), h_added, h_removed]) # Print the global summary BeginReport ('Contributions by type and developers') - for filetype, (added, removed, hackers) in total.iteritems(): - print filetype, added, removed + for filetype, (added, removed, hackers) in total.items(): + print(filetype, added, removed) for h, h_added, h_removed in hackers: - print email_encode('\t%s: [%d, %d]' % (h, h_added, h_removed)) + print(email_encode('\t%s: [%d, %d]' % (h, h_added, h_removed))) # Print the very global summary BeginReport ('General contributions by type') - for filetype, (added, removed, hackers) in total.iteritems(): - print filetype, added, removed + for filetype, (added, removed, hackers) in total.items(): + print(filetype, added, removed)