diff options
author | Jonathan Corbet <corbet@lwn.net> | 2013-02-08 12:48:44 -0700 |
---|---|---|
committer | Jonathan Corbet <corbet@lwn.net> | 2013-02-08 12:48:44 -0700 |
commit | 7ffc7561e6593a0775e0f5b9d770aa50f8aca104 (patch) | |
tree | 23712bf276b453e1324c14339935475ae3f0fb8b | |
parent | 9305420dd3f9fb2cb50fcb2a0a0b32c830a28eee (diff) |
Get rid of the space-before-paren formatting
Dunno why I ever did it that way. No functional change.
-rwxr-xr-x | gitdm | 236 |
1 files changed, 118 insertions, 118 deletions
@@ -69,13 +69,13 @@ CompanyFilter = None # -y Aggregrate the raw statistics by years instead of months # -z Dump out the hacker database at completion -def ParseOpts (): +def ParseOpts(): global MapUnknown, DevReports global DateStats, AuthorSOBs, FileFilter, AkpmOverLt, DumpDB global CFName, CSVFile, CSVPrefix,DirName, Aggregate, Numstat global ReportByFileType, ReportUnknowns, CompanyFilter - opts, rest = getopt.getopt (sys.argv[1:], 'ab:dC:c:Dh:l:no:p:r:stUuwx:yz') + opts, rest = getopt.getopt(sys.argv[1:], 'ab:dC:c:Dh:l:no:p:r:stUuwx:yz') for opt in opts: if opt[0] == '-a': AkpmOverLt = 1 @@ -90,18 +90,18 @@ def ParseOpts (): elif opt[0] == '-D': DateStats = 1 elif opt[0] == '-h': - reports.SetHTMLOutput (open (opt[1], 'w')) + reports.SetHTMLOutput(open(opt[1], 'w')) elif opt[0] == '-l': - reports.SetMaxList (int (opt[1])) + reports.SetMaxList(int(opt[1])) elif opt[0] == '-n': Numstat = 1 elif opt[0] == '-o': - reports.SetOutput (open (opt[1], 'w')) + reports.SetOutput(open(opt[1], 'w')) elif opt[0] == '-p': CSVPrefix = opt[1] elif opt[0] == '-r': print 'Filter on "%s"' % (opt[1]) - FileFilter = re.compile (opt[1]) + FileFilter = re.compile(opt[1]) elif opt[0] == '-s': AuthorSOBs = 0 elif opt[0] == '-t': @@ -111,7 +111,7 @@ def ParseOpts (): elif opt[0] == '-U': ReportUnknowns = True elif opt[0] == '-x': - CSVFile = open (opt[1], 'w') + CSVFile = open(opt[1], 'w') print "open output file " + opt[1] + "\n" elif opt [0] == '-w': Aggregate = 'week' @@ -122,15 +122,15 @@ def ParseOpts (): -def LookupStoreHacker (name, email): - email = database.RemapEmail (email) - h = database.LookupEmail (email) +def LookupStoreHacker(name, email): + email = database.RemapEmail(email) + h = database.LookupEmail(email) if h: # already there return h - elist = database.LookupEmployer (email, MapUnknown) - h = database.LookupName (name) + elist = database.LookupEmployer(email, MapUnknown) + h = database.LookupName(name) if h: # new email - h.addemail (email, elist) + h.addemail(email, elist) return h return database.StoreHacker(name, elist, email) @@ -150,14 +150,14 @@ def AddDateLines(date, lines): DateMap[date] = lines def PrintDateStats(): - dates = DateMap.keys () - dates.sort () + dates = DateMap.keys() + dates.sort() total = 0 - datef = open ('datelc.csv', 'w') + datef = open('datelc.csv', 'w') datef.write('Date,Changed,Total Changed\n') for date in dates: total += DateMap[date] - datef.write ('%d/%02d/%02d,%d,%d\n' % (date.year, date.month, date.day, + datef.write('%d/%02d/%02d,%d,%d\n' % (date.year, date.month, date.day, DateMap[date], total)) @@ -165,9 +165,9 @@ def PrintDateStats(): # Let's slowly try to move some smarts into this class. # class patch: - (ADDED, REMOVED) = range (2) + (ADDED, REMOVED) = range(2) - def __init__ (self, commit): + def __init__(self, commit): self.commit = commit self.merge = self.added = self.removed = 0 self.author = LookupStoreHacker('Unknown hacker', 'unknown@hacker.net') @@ -178,17 +178,17 @@ class patch: self.reports = [ ] self.filetypes = {} - def addreviewer (self, reviewer): - self.reviews.append (reviewer) + def addreviewer(self, reviewer): + self.reviews.append(reviewer) - def addtester (self, tester): - self.testers.append (tester) + def addtester(self, tester): + self.testers.append(tester) - def addreporter (self, reporter): - self.reports.append (reporter) + def addreporter(self, reporter): + self.reports.append(reporter) - def addfiletype (self, filetype, added, removed): - if self.filetypes.has_key (filetype): + def addfiletype(self, filetype, added, removed): + if self.filetypes.has_key(filetype): self.filetypes[filetype][self.ADDED] += added self.filetypes[filetype][self.REMOVED] += removed else: @@ -199,25 +199,25 @@ def parse_numstat(line, file_filter): Receive a line of text, determine if fits a numstat line and parse the added and removed lines as well as the file type. """ - m = patterns['numstat'].match (line) + m = patterns['numstat'].match(line) if m: - filename = m.group (3) + filename = m.group(3) # If we have a file filter, check for file lines. - if file_filter and not file_filter.search (filename): + if file_filter and not file_filter.search(filename): return None, None, None, None try: - added = int (m.group (1)) - removed = int (m.group (2)) + added = int(m.group(1)) + removed = int(m.group(2)) except ValueError: # A binary file (image, etc.) is marked with '-' added = removed = 0 - m = patterns['rename'].match (filename) + m = patterns['rename'].match(filename) if m: - filename = '%s%s%s' % (m.group (1), m.group (3), m.group (4)) + filename = '%s%s%s' % (m.group(1), m.group(3), m.group(4)) - filetype = database.FileTypes.guess_file_type (os.path.basename(filename)) + filetype = database.FileTypes.guess_file_type(os.path.basename(filename)) return filename, filetype, added, removed else: return None, None, None, None @@ -226,78 +226,78 @@ def parse_numstat(line, file_filter): # The core hack for grabbing the information about a changeset. # def grabpatch(logpatch): - m = patterns['commit'].match (logpatch[0]) + m = patterns['commit'].match(logpatch[0]) if not m: return None - p = patch(m.group (1)) + p = patch(m.group(1)) ignore = (FileFilter is not None) for Line in logpatch[1:]: # # Maybe it's an author line? # - m = patterns['author'].match (Line) + m = patterns['author'].match(Line) if m: - p.email = database.RemapEmail (m.group (2)) - p.author = LookupStoreHacker(m.group (1), p.email) + p.email = database.RemapEmail(m.group(2)) + p.author = LookupStoreHacker(m.group(1), p.email) continue # # Could be a signed-off-by: # - m = patterns['signed-off-by'].match (Line) + m = patterns['signed-off-by'].match(Line) if m: - email = database.RemapEmail (m.group (2)) - sobber = LookupStoreHacker(m.group (1), email) + email = database.RemapEmail(m.group(2)) + sobber = LookupStoreHacker(m.group(1), email) if sobber != p.author or AuthorSOBs: - p.sobs.append ((email, LookupStoreHacker(m.group (1), m.group (2)))) + p.sobs.append((email, LookupStoreHacker(m.group(1), m.group(2)))) continue # # Various other tags of interest. # - m = patterns['reviewed-by'].match (Line) + m = patterns['reviewed-by'].match(Line) if m: - email = database.RemapEmail (m.group (2)) - p.addreviewer (LookupStoreHacker(m.group (1), email)) + email = database.RemapEmail(m.group(2)) + p.addreviewer(LookupStoreHacker(m.group(1), email)) continue - m = patterns['tested-by'].match (Line) + m = patterns['tested-by'].match(Line) if m: - email = database.RemapEmail (m.group (2)) - p.addtester (LookupStoreHacker (m.group (1), email)) - p.author.testcredit (patch) + email = database.RemapEmail(m.group(2)) + p.addtester(LookupStoreHacker(m.group(1), email)) + p.author.testcredit(patch) continue # Reported-by: - m = patterns['reported-by'].match (Line) + m = patterns['reported-by'].match(Line) if m: - email = database.RemapEmail (m.group (2)) - p.addreporter (LookupStoreHacker (m.group (1), email)) - p.author.reportcredit (patch) + email = database.RemapEmail(m.group(2)) + p.addreporter(LookupStoreHacker(m.group(1), email)) + p.author.reportcredit(patch) continue # Reported-and-tested-by: - m = patterns['reported-and-tested-by'].match (Line) + m = patterns['reported-and-tested-by'].match(Line) if m: - email = database.RemapEmail (m.group (2)) - h = LookupStoreHacker (m.group (1), email) - p.addreporter (h) - p.addtester (h) - p.author.reportcredit (patch) - p.author.testcredit (patch) + email = database.RemapEmail(m.group(2)) + h = LookupStoreHacker(m.group(1), email) + p.addreporter(h) + p.addtester(h) + p.author.reportcredit(patch) + p.author.testcredit(patch) continue # # If this one is a merge, make note of the fact. # - m = patterns['merge'].match (Line) + m = patterns['merge'].match(Line) if m: p.merge = 1 continue # # See if it's the date. # - m = patterns['date'].match (Line) + m = patterns['date'].match(Line) if m: - dt = rfc822.parsedate(m.group (2)) - p.date = datetime.date (dt[0], dt[1], dt[2]) + dt = rfc822.parsedate(m.group(2)) + p.date = datetime.date(dt[0], dt[1], dt[2]) if p.date > Today: - sys.stderr.write ('Funky date: %s\n' % p.date) + sys.stderr.write('Funky date: %s\n' % p.date) p.date = Today continue if not Numstat: @@ -305,54 +305,54 @@ def grabpatch(logpatch): # If we have a file filter, check for file lines. # if FileFilter: - ignore = ApplyFileFilter (Line, ignore) + ignore = ApplyFileFilter(Line, ignore) # # OK, maybe it's part of the diff itself. # if not ignore: - if patterns['add'].match (Line): + if patterns['add'].match(Line): p.added += 1 continue - if patterns['rem'].match (Line): + if patterns['rem'].match(Line): p.removed += 1 else: # Get the statistics (lines added/removes) using numstats # and without requiring a diff (--numstat instead -p) - (filename, filetype, added, removed) = parse_numstat (Line, FileFilter) + (filename, filetype, added, removed) = parse_numstat(Line, FileFilter) if filename: p.added += added p.removed += removed - p.addfiletype (filetype, added, removed) + p.addfiletype(filetype, added, removed) if '@' in p.author.name: - GripeAboutAuthorName (p.author.name) + GripeAboutAuthorName(p.author.name) return p -def GripeAboutAuthorName (name): +def GripeAboutAuthorName(name): if name in GripedAuthorNames: return - GripedAuthorNames.append (name) + GripedAuthorNames.append(name) print '%s is an author name, probably not what you want' % (name) -def ApplyFileFilter (line, ignore): +def ApplyFileFilter(line, ignore): # # If this is the first file line (--- a/), set ignore one way # or the other. # - m = patterns['filea'].match (line) + m = patterns['filea'].match(line) if m: - file = m.group (1) - if FileFilter.search (file): + file = m.group(1) + if FileFilter.search(file): return 0 return 1 # # For the second line, we can turn ignore off, but not on # - m = patterns['fileb'].match (line) + m = patterns['fileb'].match(line) if m: - file = m.group (1) - if FileFilter.search (file): + file = m.group(1) + if FileFilter.search(file): return 0 return ignore @@ -366,8 +366,8 @@ def is_svntag(logpatch): for Line in logpatch: m = patterns['svn-tag'].match(Line.strip()) if m: - sys.stderr.write ('(W) detected a commit on a svn tag: %s\n' % - (m.group (0),)) + sys.stderr.write('(W) detected a commit on a svn tag: %s\n' % + (m.group(0),)) return True return False @@ -376,20 +376,20 @@ def is_svntag(logpatch): # If this patch is signed off by both Andrew Morton and Linus Torvalds, # remove the (redundant) Linus signoff. # -def TrimLTSOBs (p): +def TrimLTSOBs(p): if AkpmOverLt == 1 and Linus in p.sobs and Akpm in p.sobs: - p.sobs.remove (Linus) + p.sobs.remove(Linus) # # Here starts the real program. # -ParseOpts () +ParseOpts() # # Read the config files. # -ConfigFile.ConfigFile (CFName, DirName) +ConfigFile.ConfigFile(CFName, DirName) # # Let's pre-seed the database with a couple of hackers @@ -397,9 +397,9 @@ ConfigFile.ConfigFile (CFName, DirName) # if AkpmOverLt == 1: Linus = ('torvalds@linux-foundation.org', - LookupStoreHacker ('Linus Torvalds', 'torvalds@linux-foundation.org')) + LookupStoreHacker('Linus Torvalds', 'torvalds@linux-foundation.org')) Akpm = ('akpm@linux-foundation.org', - LookupStoreHacker ('Andrew Morton', 'akpm@linux-foundation.org')) + LookupStoreHacker('Andrew Morton', 'akpm@linux-foundation.org')) TotalChanged = TotalAdded = TotalRemoved = 0 @@ -446,68 +446,68 @@ for logpatch in patches: if ((p.added + p.removed) > 0 or not FileFilter) and not p.merge: TotalAdded += p.added TotalRemoved += p.removed - TotalChanged += max (p.added, p.removed) - AddDateLines (p.date, max (p.added, p.removed)) - empl.AddCSet (p) + TotalChanged += max(p.added, p.removed) + AddDateLines(p.date, max(p.added, p.removed)) + empl.AddCSet(p) if AkpmOverLt: - TrimLTSOBs (p) + TrimLTSOBs(p) for sobemail, sobber in p.sobs: - empl = sobber.emailemployer (sobemail, p.date) + empl = sobber.emailemployer(sobemail, p.date) empl.AddSOB() if not p.merge: - p.author.addpatch (p) + p.author.addpatch(p) for sobemail, sob in p.sobs: - sob.addsob (p) + sob.addsob(p) for hacker in p.reviews: - hacker.addreview (p) + hacker.addreview(p) for hacker in p.testers: - hacker.addtested (p) + hacker.addtested(p) for hacker in p.reports: - hacker.addreport (p) + hacker.addreport(p) CSCount += 1 - csvdump.AccumulatePatch (p, Aggregate) - csvdump.store_patch (p) + csvdump.AccumulatePatch(p, Aggregate) + csvdump.store_patch(p) print >> sys.stderr, 'Grabbing changesets...done ' if DumpDB: - database.DumpDB () -database.MixVirtuals () + database.DumpDB() +database.MixVirtuals() # # Say something # -hlist = database.AllHackers () -elist = database.AllEmployers () +hlist = database.AllHackers() +elist = database.AllEmployers() ndev = nempl = 0 for h in hlist: - if len (h.patches) > 0: + if len(h.patches) > 0: ndev += 1 for e in elist: if e.count > 0: nempl += 1 -reports.Write ('Processed %d csets from %d developers\n' % (CSCount, +reports.Write('Processed %d csets from %d developers\n' % (CSCount, ndev)) -reports.Write ('%d employers found\n' % (nempl)) -reports.Write ('A total of %d lines added, %d removed (delta %d)\n' % - (TotalAdded, TotalRemoved, TotalAdded - TotalRemoved)) +reports.Write('%d employers found\n' % (nempl)) +reports.Write('A total of %d lines added, %d removed (delta %d)\n' % + (TotalAdded, TotalRemoved, TotalAdded - TotalRemoved)) if TotalChanged == 0: TotalChanged = 1 # HACK to avoid div by zero if DateStats: - PrintDateStats () + PrintDateStats() if CSVPrefix: - csvdump.save_csv (CSVPrefix) + csvdump.save_csv(CSVPrefix) if CSVFile: - csvdump.OutputCSV (CSVFile) - CSVFile.close () + csvdump.OutputCSV(CSVFile) + CSVFile.close() if DevReports: - reports.DevReports (hlist, TotalChanged, CSCount, TotalRemoved) + reports.DevReports(hlist, TotalChanged, CSCount, TotalRemoved) if ReportUnknowns: reports.ReportUnknowns(hlist, CSCount) -reports.EmplReports (elist, TotalChanged, CSCount) +reports.EmplReports(elist, TotalChanged, CSCount) if ReportByFileType and Numstat: - reports.ReportByFileType (hlist) + reports.ReportByFileType(hlist) |