77
88CURRENT_DIR = os .path .dirname (os .path .abspath (__file__ ))
99
10+
1011def extract_pwc (reviewers ):
1112 return list (set (sum (filter (lambda x : x , list (reviewers .values ())), [])))
1213
14+
1315def produce_conflicts_dict (reviewers , projects_with_confict ):
14- return {proj : list (filter (lambda x : proj in reviewers [x ], {k :v for k ,v in reviewers .items () if v })) for proj in projects_with_confict }
16+ return {
17+ proj : list (
18+ filter (lambda x : proj in reviewers [x ], {k : v for k , v in reviewers .items () if v })
19+ )
20+ for proj in projects_with_confict
21+ }
1522
16- def distribute_proposals (proposals , seed , reviews_per_proposal ):
1723
18- with open (os .path .join (CURRENT_DIR , 'reviewers_list.yaml' ), 'r' ) as f :
24+ def distribute_proposals (proposals , seed , reviews_per_proposal ):
25+ with open (os .path .join (CURRENT_DIR , "reviewers_list.yaml" ), "r" ) as f :
1926 reviewers_coi = yaml .safe_load (f .read ())
2027
2128 random .seed (seed )
@@ -33,7 +40,6 @@ def who_is_reviewing(proposal):
3340 def has_conflict (reviewer , proposal ):
3441 return proposal in conflicts and reviewer in conflicts [proposal ]
3542
36-
3743 # Sometimes this will fail because of a pathological random order of review
3844 # assignments. If it's run often enough, it should eventually succeed.
3945
@@ -51,19 +57,18 @@ def has_conflict(reviewer, proposal):
5157 if (
5258 has_conflict (reviewer , proposal )
5359 or
54- ( # This really might be more trouble than it's worth.
55- (
56- # If a reviewer has at least two more assignments than the
57- # other reviwer(s) with the least number of assignments.
58- len (assignments [reviewer ]) - min (len (assignments [r ]) for r in reviewers ) > 1
59- )
60- # and
61- # (
62- # # If we're getting low on non-conflicted reviewers,
63- # # don't worry about skewed review allocations.
64- # len(reviewers_left) - len(working_reviewers) >= (REVIEWS_PER_PROPOSAL - 1)
65- # )
60+ # This really might be more trouble than it's worth.
61+ (
62+ # If a reviewer has at least two more assignments than the
63+ # other reviwer(s) with the least number of assignments.
64+ len (assignments [reviewer ]) - min (len (assignments [r ]) for r in reviewers ) > 1
6665 )
66+ # and
67+ # (
68+ # # If we're getting low on non-conflicted reviewers,
69+ # # don't worry about skewed review allocations.
70+ # len(reviewers_left) - len(working_reviewers) >= (REVIEWS_PER_PROPOSAL - 1)
71+ # )
6772 ):
6873 working_reviewers .remove (reviewer )
6974
@@ -83,13 +88,12 @@ def has_conflict(reviewer, proposal):
8388 # Sometimes 1-2 reviewers are under-assigned. Can re-run
8489 # until a good split is achieved, or rebalance manually,
8590 # or leave as-is.
86- print ([f' { r } : { len (assignments [r ])} ' for r in reviewers ])
91+ print ([f" { r } : { len (assignments [r ])} " for r in reviewers ])
8792
8893 # Who has been assigned to each proposal?
8994 for p in proposals :
9095 print (f"{ p } : { who_is_reviewing (p )} " )
9196
92-
9397 # Which proposals was each person assigned?
9498 for r in assignments :
9599 print (r )
0 commit comments