def prepare_authors(data: dict) -> List[Author]: """ Prepares list of authors without their publications list Args: data: dictionary with keyes: AUTHOR_ID: list of authors' ids IS_EMPLOYEE: list that defines which authors are employees IS_PHD_STUDENT: list that defines which authors are phd students CONTRIBUTION: list of authors' contributions IS_IN_N: list that defines which authors are in N All keys are defined in settings.py Returns: List of authors """ result = [] for idx in range(len(data[AUTHOR_ID])): author_id = data[AUTHOR_ID][idx] is_emp = data[IS_EMPLOYEE][idx] is_phd = data[IS_PHD_STUDENT][idx] cont = data[CONTRIBUTION][idx] in_n = data[IS_IN_N][idx] result.append(Author(author_id, is_emp, is_phd, cont, in_n)) return result
def create_example_author( a_id: str = AUTH_ID, is_emp: bool = IS_EMP, is_phd: bool = IS_PHD, contrib: float = CONTRIB, in_n: bool = IN_N, ): return Author(a_id, is_emp, is_phd, contrib, in_n)
def prepare_test_authors(data: dict): authors = [] for idx in range(len(data[AUTHOR_ID])): a_id = data[AUTHOR_ID][idx] is_emp = data[IS_EMPLOYEE][idx] is_phd = data[IS_PHD_STUDENT][idx] contrib = data[CONTRIBUTION][idx] in_n = data[IS_IN_N][idx] authors.append(Author(a_id, is_emp, is_phd, contrib, in_n)) return authors
def prepare_data_for_check_mono_limit_test(): """ Prepares data that fails _Author__check_moographs_limit() test """ is_phd = False is_emp = False is_mon = True tmp_sum = MONOGRAPH_COEFFICIENT * CONTRIB + 1.0 points = MONOGRAPH_LIMIT_MAX_POINTS / 2 author = Author(AUTH_ID, is_emp, is_phd, CONTRIB, CZYN) return author, is_mon, tmp_sum, points
def prepare_complex_test_data(): publications = create_complex_publications_list() author = Author("author", True, False, 0.5, 1) author.load_publications(publications) author.create_publications_ranking() return author, publications