4
4
import pathlib
5
5
import sys
6
6
from pathlib import Path
7
- from typing import Union , Type , List , Dict , Tuple , Generator , Callable
7
+ from typing import Union , Type , List , Dict , Tuple , Generator , Callable , TypeVar
8
8
9
9
from munkres import Munkres , make_cost_matrix , Matrix # type: ignore
10
10
16
16
from matching .export import ExportToSpreadsheet
17
17
18
18
19
+ MenteeType = TypeVar ("MenteeType" , bound = Mentee )
20
+ MentorType = TypeVar ("MentorType" , bound = Mentor )
21
+
22
+
19
23
def generate_match_matrix (
20
- mentor_list : List [Mentor ], mentee_list : List [Mentee ], rules : List [rl .RuleProtocol ]
24
+ mentor_list : List [MentorType ],
25
+ mentee_list : List [MenteeType ],
26
+ rules : List [rl .RuleProtocol ],
21
27
) -> List [List [Match ]]:
22
28
return [
23
29
[Match (mentor , mentee , rules ).calculate_match () for mentee in mentee_list ]
@@ -92,8 +98,10 @@ def match_and_assign_participants(
92
98
93
99
94
100
def process_data (
95
- mentors : List [Mentor ], mentees : List [Mentee ], all_rules : List [List [rl .RuleProtocol ]]
96
- ) -> Tuple [List [Mentor ], List [Mentee ]]:
101
+ mentors : List [MentorType ],
102
+ mentees : List [MenteeType ],
103
+ all_rules : List [List [rl .RuleProtocol ]],
104
+ ) -> Tuple [List [MentorType ], List [MenteeType ]]:
97
105
"""
98
106
This is the main entrypoint for this software. It lazily generates three matrices, which allows for them to be
99
107
mutated over the course of the matching process.
@@ -113,7 +121,7 @@ def process_data(
113
121
114
122
def conduct_matching_from_file (
115
123
path_to_data : Path , rules : list [list [rl .RuleProtocol ]]
116
- ) -> Tuple [List [Mentor ], List [Mentee ]]:
124
+ ) -> Tuple [List [MentorType ], List [MenteeType ]]:
117
125
mentors = create_participant_list_from_path (Mentor , path_to_data )
118
126
mentees = create_participant_list_from_path (Mentee , path_to_data )
119
127
return process_data (mentors , mentees , rules )
0 commit comments