Skip to content

Commit 9f52392

Browse files
pre-commit-ci[bot]shenxianpeng
authored andcommitted
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent 5b2ac3b commit 9f52392

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

gitstats/main.py

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -147,16 +147,18 @@ def get_canonical_author(self, author, email):
147147
self.author_emails[email] = author
148148
self.author_name_counts[email] = {author: 1}
149149
return author
150-
150+
151151
# Track name usage for this email
152152
if author not in self.author_name_counts[email]:
153153
self.author_name_counts[email][author] = 0
154154
self.author_name_counts[email][author] += 1
155-
155+
156156
# Update canonical name to the most frequently used one
157-
most_used_name = max(self.author_name_counts[email].items(), key=lambda x: x[1])[0]
157+
most_used_name = max(
158+
self.author_name_counts[email].items(), key=lambda x: x[1]
159+
)[0]
158160
self.author_emails[email] = most_used_name
159-
161+
160162
return self.author_emails[email]
161163

162164
def collect(self, dir):
@@ -268,10 +270,10 @@ def collect(self, dir):
268270
author, mail = parts[4].split("<", 1)
269271
author = author.rstrip()
270272
mail = mail.rstrip(">")
271-
273+
272274
# Get canonical author name based on email
273275
author = self.get_canonical_author(author, mail)
274-
276+
275277
domain = "?"
276278
if mail.find("@") != -1:
277279
domain = mail.rsplit("@", 1)[1]
@@ -606,9 +608,9 @@ def collect(self, dir):
606608
if pos != -1:
607609
try:
608610
oldstamp = stamp
609-
stamp_str, author_and_email = line[:pos], line[pos + 1:]
611+
stamp_str, author_and_email = line[:pos], line[pos + 1 :]
610612
stamp = int(stamp_str)
611-
613+
612614
# Parse "Name <email>" format
613615
if "<" in author_and_email and ">" in author_and_email:
614616
author, mail = author_and_email.split("<", 1)
@@ -619,7 +621,7 @@ def collect(self, dir):
619621
else:
620622
# Fallback if no email found (shouldn't happen with new format)
621623
author = author_and_email
622-
624+
623625
if oldstamp > stamp:
624626
# clock skew, keep old timestamp to avoid having ugly graph
625627
stamp = oldstamp

0 commit comments

Comments
 (0)