Skip to content

Commit 4e20401

Browse files
committed
fix: formatting fixes
Signed-off-by: Zack Koppert <zkoppert@github.com>
1 parent f0ba828 commit 4e20401

File tree

1 file changed

+37
-22
lines changed

1 file changed

+37
-22
lines changed

measure_innersource.py

Lines changed: 37 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -119,31 +119,36 @@ def main(): # pragma: no cover
119119
f"Original commit author: {original_commit_author}, \
120120
with manager: {original_commit_author_manager}"
121121
)
122-
122+
123123
# Create a dictionary mapping users to their managers for faster lookups
124124
user_to_manager = {}
125125
manager_to_reports = {}
126-
126+
127127
for user, data in org_data.items():
128128
manager = data["manager"]
129129
user_to_manager[user] = manager
130-
130+
131131
# Also create reverse mapping of manager to direct reports
132132
if manager not in manager_to_reports:
133133
manager_to_reports[manager] = []
134134
manager_to_reports[manager].append(user)
135-
135+
136136
# Find all users that report up to the same manager as the original commit author
137137
team_members_that_own_the_repo.append(original_commit_author)
138138
team_members_that_own_the_repo.append(original_commit_author_manager)
139139

140140
# Add all users reporting to the same manager
141141
if original_commit_author_manager in manager_to_reports:
142-
team_members_that_own_the_repo.extend(manager_to_reports[original_commit_author_manager])
142+
team_members_that_own_the_repo.extend(
143+
manager_to_reports[original_commit_author_manager]
144+
)
143145

144146
# Add everyone that has one of the team members listed as their manager
145147
for user, manager in user_to_manager.items():
146-
if manager in team_members_that_own_the_repo and user not in team_members_that_own_the_repo:
148+
if (
149+
manager in team_members_that_own_the_repo
150+
and user not in team_members_that_own_the_repo
151+
):
147152
team_members_that_own_the_repo.append(user)
148153

149154
# Remove duplicates from the team members list
@@ -168,49 +173,55 @@ def main(): # pragma: no cover
168173
print("Fetching all pull requests...")
169174
all_pulls = list(repo_data.pull_requests(state="all"))
170175
print(f"Found {len(all_pulls)} pull requests")
171-
176+
172177
print("Fetching all issues...")
173178
all_issues = list(repo_data.issues(state="all"))
174179
print(f"Found {len(all_issues)} issues")
175180

176181
# Pre-process all data to create mappings of user to contribution counts
177182
print("Pre-processing contribution data...")
178-
183+
179184
# Create mapping of commit authors to commit counts
180185
commit_author_counts = {}
181186
for commit in commit_list:
182187
if hasattr(commit.author, "login"):
183188
author = commit.author.login
184189
commit_author_counts[author] = commit_author_counts.get(author, 0) + 1
185-
190+
186191
# Create mapping of PR authors to PR counts
187192
pr_author_counts = {}
188193
for pull in all_pulls:
189194
author = pull.user.login
190195
pr_author_counts[author] = pr_author_counts.get(author, 0) + 1
191-
196+
192197
# Create mapping of issue authors to issue counts
193198
issue_author_counts = {}
194199
for issue in all_issues:
195200
if hasattr(issue.user, "login"):
196201
author = issue.user.login
197202
issue_author_counts[author] = issue_author_counts.get(author, 0) + 1
198-
203+
199204
# Count contributions for each innersource contributor
200205
innersource_contribution_counts = {}
201206
print("Counting contributions for each innersource contributor...")
202207
for contributor in innersource_contributors:
203208
# Initialize counter for this contributor
204209
innersource_contribution_counts[contributor] = 0
205-
210+
206211
# Add commit counts
207-
innersource_contribution_counts[contributor] += commit_author_counts.get(contributor, 0)
208-
212+
innersource_contribution_counts[contributor] += commit_author_counts.get(
213+
contributor, 0
214+
)
215+
209216
# Add PR counts
210-
innersource_contribution_counts[contributor] += pr_author_counts.get(contributor, 0)
211-
217+
innersource_contribution_counts[contributor] += pr_author_counts.get(
218+
contributor, 0
219+
)
220+
212221
# Add issue counts
213-
innersource_contribution_counts[contributor] += issue_author_counts.get(contributor, 0)
222+
innersource_contribution_counts[contributor] += issue_author_counts.get(
223+
contributor, 0
224+
)
214225

215226
print("Innersource contribution counts:")
216227
for contributor, count in innersource_contribution_counts.items():
@@ -222,15 +233,19 @@ def main(): # pragma: no cover
222233
for member in team_members_that_own_the_repo:
223234
# Initialize counter for this team member
224235
team_member_contribution_counts[member] = 0
225-
236+
226237
# Add commit counts
227-
team_member_contribution_counts[member] += commit_author_counts.get(member, 0)
228-
238+
team_member_contribution_counts[member] += commit_author_counts.get(
239+
member, 0
240+
)
241+
229242
# Add PR counts
230243
team_member_contribution_counts[member] += pr_author_counts.get(member, 0)
231-
244+
232245
# Add issue counts
233-
team_member_contribution_counts[member] += issue_author_counts.get(member, 0)
246+
team_member_contribution_counts[member] += issue_author_counts.get(
247+
member, 0
248+
)
234249

235250
print("Team member contribution counts:")
236251
for member, count in team_member_contribution_counts.items():

0 commit comments

Comments
 (0)