def from_gh_repo(gh_repo: Repository): return RadarGithubRepo(name=gh_repo.full_name, url=gh_repo.html_url, stars=gh_repo.stargazers_count, desc=gh_repo.description, topics=gh_repo.get_topics(), forks=gh_repo.forks_count, languages=gh_repo.get_languages())
def add_topic(repo: Repository): """Add hacktoberfest topic to the repo.""" topics_list = repo.get_topics() if "hacktoberfest" not in topics_list: topics_list.append("hacktoberfest") repo.replace_topics(topics_list)
def remove_topic(repo: Repository): """Remove hacktoberfest topic from repo.""" topics_list = repo.get_topics() if "hacktoberfest" in topics_list: topics_list = [t for t in topics_list if t != "hacktoberfest"] repo.replace_topics(topics_list)