-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpreprocess.py
33 lines (23 loc) · 956 Bytes
/
preprocess.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
29
30
31
32
33
from previous_pairs import previous_pairs
def initialize_dicts(full_list):
candidates = {}
user_list = [user.get_username() for user in full_list]
# prepare potential matches list
for user in user_list:
candidates[user] = user_list.copy()
# remove self from possible candidaes
candidates[user].remove(user)
#if user in previous_pairs.keys():
# orig_set = set(candidates[user])
# remove_set = set(previous_pairs[user])
# candidates[user] = list(orig_set - remove_set)
return candidates
def create_object_list(participants, ss_map):
participant_map = {}
for p in participants:
participant_map[p.get_username()] = p
ss_list = [(key, value) for key, value in ss_map.items()]
ss_object_list = []
for (santa, recp) in ss_list:
ss_object_list.append((participant_map[santa], participant_map[recp]))
return ss_object_list