def end_reviews( assignment_names: Iterable[str], students: Iterable[plug.StudentTeam], double_blind_key: Optional[str], api: plug.PlatformAPI, ) -> None: """Clean up review allocations. If normal no-blind review has been performed (i.e. ``double_blind_key`` is ``None``), then only review teams are deleted. If ``double_blind_key`` is provided, both review teams and anonymous repo copies are deleted. Args: assignment_names: Names of assignments. students: An iterble of student teams. double_blind_key: If not None, double-blind review is assumed and the key is used to compute hashed review team names. api: An implementation of :py:class:`repobee_plug.PlatformAPI` used to interface with the platform (e.g. GitHub or GitLab) instance. """ review_team_names = [ _review_team_name(student, assignment_name, double_blind_key) for student in students for assignment_name in assignment_names ] teams = progresswrappers.get_teams(review_team_names, api, desc="Deleting review teams") for team in teams: api.delete_team(team) plug.log.info(f"Deleted team {team.name}") progresswrappers.end_progress(teams) if double_blind_key: _delete_anonymous_repos(assignment_names, students, double_blind_key, api)
def end_reviews_repobee_4(allocations_file: pathlib.Path, api: plug.PlatformAPI) -> None: """Preview version of RepoBee 4's version of :py:fync:`end_reviews`.""" review_allocations = json.loads( allocations_file.read_text(sys.getdefaultencoding()))["allocations"] review_team_names = { allocation["review_team"]["name"] for allocation in review_allocations } for team in progresswrappers.get_teams(review_team_names, api): api.delete_team(team)
def purge_review_teams( assignment_names: Iterable[str], students: Iterable[plug.StudentTeam], api: plug.PlatformAPI, ) -> None: """Delete all review teams associated with the given assignment names and student teams. Args: assignment_names: Names of assignments. students: An iterble of student teams. api: An implementation of :py:class:`repobee_plug.PlatformAPI` used to interface with the platform (e.g. GitHub or GitLab) instance. """ review_team_names = [ plug.generate_review_team_name(student, assignment_name) for student in students for assignment_name in assignment_names ] teams = progresswrappers.get_teams(review_team_names, api, desc="Deleting review teams") for team in teams: api.delete_team(team) plug.log.info(f"Deleted {team.name}")