From a777d0762a20fc051c93436e4e805cc208745953 Mon Sep 17 00:00:00 2001 From: Jean-Damien Date: Fri, 23 Dec 2022 17:11:14 +0100 Subject: [PATCH] deplace grape indiv function --- app/cmd/db.py | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/app/cmd/db.py b/app/cmd/db.py index 7afa919..0db351b 100644 --- a/app/cmd/db.py +++ b/app/cmd/db.py @@ -219,17 +219,6 @@ def _create_indiv(list_csv)-> None: for data in tqdm(individuals, desc="Populating Individual..."): Individual.create(**data) -def __grape_indiv(list_person, role: str): - """ ?????? """ - for persons in list_person: - for person_tag in persons.find_all("person"): - person_text = person_tag.text.replace("\n", "") - if person_text != "None": - prince_q = [t.id_indiv for t in Individual.select().where( - Individual.name_indiv == person_text)] - # duke_q = [t.id_duke for t in Duke.select().where( - # Duke.indiv_duke == prince_q[0])] - print(person_text, "==", prince_q[0]) def _create_involved_in(folder: str): """create involved in table @@ -320,6 +309,18 @@ def __find_indiv(folder: str, role: str)-> None: indiv_lst.append(person.text.replace("\n", "")) return set(indiv_lst) +def __grape_indiv(list_person, role: str): + """ ?????? """ + for persons in list_person: + for person_tag in persons.find_all("person"): + person_text = person_tag.text.replace("\n", "") + if person_text != "None": + prince_q = [t.id_indiv for t in Individual.select().where( + Individual.name_indiv == person_text)] + # duke_q = [t.id_duke for t in Duke.select().where( + # Duke.indiv_duke == prince_q[0])] + print(person_text, "==", prince_q[0]) + @db_cli.command() def init() -> None: """Initialization of the database"""