Browse Source

add changes_by_date_by_author

MFTECH 1 year ago
parent
commit
fc688b8cc3
1 changed files with 6 additions and 6 deletions
  1. 6
    6
      gitstats

+ 6
- 6
gitstats View File

99
 	return defaultrange
99
 	return defaultrange
100
 
100
 
101
 def getkeyssortedbyvalues(dict):
101
 def getkeyssortedbyvalues(dict):
102
-	return list(map(lambda el : el[1], sorted(map(lambda el : (el[1], el[0]), dict.items()))))
102
+	return [el[1] for el in sorted([(el[1], el[0]) for el in list(dict.items())])]
103
 
103
 
104
 # dict['author'] = { 'commits': 512 } - ...key(dict, 'commits')
104
 # dict['author'] = { 'commits': 512 } - ...key(dict, 'commits')
105
 def getkeyssortedbyvaluekey(d, key):
105
 def getkeyssortedbyvaluekey(d, key):
106
-	return list(map(lambda el : el[1], sorted(map(lambda el : (d[el][key], el), d.keys()))))
106
+	return [el[1] for el in sorted([(d[el][key], el) for el in list(d.keys())])]
107
 
107
 
108
 def getstatsummarycounts(line):
108
 def getstatsummarycounts(line):
109
 	numbers = re.findall('\d+', line)
109
 	numbers = re.findall('\d+', line)
168
 		self.lineactivity_by_hour_of_week_busiest = 0
168
 		self.lineactivity_by_hour_of_week_busiest = 0
169
 		self.lineactivity_by_year_week = {} # yy_wNN -> commits
169
 		self.lineactivity_by_year_week = {} # yy_wNN -> commits
170
 		self.lineactivity_by_year_week_peak = 0
170
 		self.lineactivity_by_year_week_peak = 0
171
+		self.changes_by_date_by_author = {} # stamp -> author -> lines_added
171
 
172
 
172
 		self.authors = {} # name -> {commits, first_commit_stamp, last_commit_stamp, last_active_day, active_days, lines_added, lines_removed}
173
 		self.authors = {} # name -> {commits, first_commit_stamp, last_commit_stamp, last_active_day, active_days, lines_added, lines_removed}
173
 
174
 
649
 
650
 
650
 							numbers = getstatsummarycounts(last_line)
651
 							numbers = getstatsummarycounts(last_line)
651
 							if len(numbers) == 3:
652
 							if len(numbers) == 3:
652
-								(files, inserted, deleted) = map(lambda el : int(el), numbers)
653
+								(files, inserted, deleted) = [int(el) for el in numbers]
653
 								total_lines += inserted
654
 								total_lines += inserted
654
 								total_lines -= deleted
655
 								total_lines -= deleted
655
 								self.total_lines_added += inserted
656
 								self.total_lines_added += inserted
669
 		# Per-author statistics
670
 		# Per-author statistics
670
 
671
 
671
 		# defined for stamp, author only if author commited at this timestamp.
672
 		# defined for stamp, author only if author commited at this timestamp.
672
-		self.changes_by_date_by_author = {} # stamp -> author -> lines_added
673
 
673
 
674
 		# Similar to the above, but never use --first-parent
674
 		# Similar to the above, but never use --first-parent
675
 		# (we need to walk through every commit to know who
675
 		# (we need to walk through every commit to know who
714
 				numbers = getstatsummarycounts(line);
714
 				numbers = getstatsummarycounts(line);
715
 
715
 
716
 				if len(numbers) == 3:
716
 				if len(numbers) == 3:
717
-					(files, inserted, deleted) = list(map(lambda el : int(el), numbers))
717
+					(files, inserted, deleted) = [int(el) for el in numbers]
718
 				else:
718
 				else:
719
 					print('Warning: failed to handle line "%s"' % line)
719
 					print('Warning: failed to handle line "%s"' % line)
720
 					(files, inserted, deleted) = (0, 0, 0)
720
 					(files, inserted, deleted) = (0, 0, 0)
1432
 		f.write('<table class="tags">')
1432
 		f.write('<table class="tags">')
1433
 		f.write('<tr><th>Name</th><th>Date</th><th>Commits</th><th>Authors</th></tr>')
1433
 		f.write('<tr><th>Name</th><th>Date</th><th>Commits</th><th>Authors</th></tr>')
1434
 		# sort the tags by date desc
1434
 		# sort the tags by date desc
1435
-		tags_sorted_by_date_desc = list(map(lambda el : el[1], reversed(sorted(map(lambda el : (el[1]['date'], el[0]), data.tags.items())))))
1435
+		tags_sorted_by_date_desc = [el[1] for el in reversed(sorted([(el[1]['date'], el[0]) for el in list(data.tags.items())]))]
1436
 		for tag in tags_sorted_by_date_desc:
1436
 		for tag in tags_sorted_by_date_desc:
1437
 			authorinfo = []
1437
 			authorinfo = []
1438
 			self.authors_by_commits = getkeyssortedbyvalues(data.tags[tag]['authors'])
1438
 			self.authors_by_commits = getkeyssortedbyvalues(data.tags[tag]['authors'])