-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcode_review_order.py
28 lines (22 loc) · 1.04 KB
/
code_review_order.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
"""Display order of code review pull requests for CP1404."""
USERNAMES_FILENAME = "data/github_usernames_b.txt"
OUTPUT_FILENAME = "output/code_reviews.md"
FIRST_PRAC = 5 # 5 at start of study period
LAST_PRAC = 10
def main():
"""Create code review orders as text for CP1404 pull requests."""
print("# CP1404 Code Reviews")
with open(USERNAMES_FILENAME) as in_file:
usernames = [line.strip() for line in in_file.readlines()]
max_length = max(len(username) for username in usernames)
with open(OUTPUT_FILENAME, "w") as out_file:
for i in range(0, LAST_PRAC - FIRST_PRAC + 1):
print(f"\n## Prac {i + FIRST_PRAC}", file=out_file)
print("\n```", file=out_file)
for position, username in enumerate(usernames):
other_username = usernames[position - (i + 1)]
print(f"{username:{max_length}} mentions: {other_username}", file=out_file)
print("```", file=out_file)
print(f"See Markdown file: {OUTPUT_FILENAME}")
if __name__ == '__main__':
main()