From 966be7c4bf56c41668016f29cb0ffe28ab048ff2 Mon Sep 17 00:00:00 2001 From: Jean-Damien Date: Fri, 23 Dec 2022 16:57:58 +0100 Subject: [PATCH] docstring for functions related to indiv table --- app/cmd/db.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/app/cmd/db.py b/app/cmd/db.py index 8cc8159..7345c14 100644 --- a/app/cmd/db.py +++ b/app/cmd/db.py @@ -206,7 +206,11 @@ def _create_transcribed_by(folder: str)-> None: Transcribed_by.create(**data) -def _create_indiv(list_csv): +def _create_indiv(list_csv)-> None: + """create table indiv with lists made with function __csv_indiv_infos (see below) + :param list_csv: list of individuals of the same type (secretaries or princes) + :type list_csv: str + """ individuals = [{"name_indiv": actor[0], "role_indiv": actor[1], "house_indiv": [t.id_house for t in House.select().where( House.house_label == actor[2])][0], @@ -216,6 +220,7 @@ def _create_indiv(list_csv): 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", "") @@ -272,6 +277,13 @@ def _create_involved_in(folder: str): Involved_in.create(**data) def __csv_indiv_infos(indiv_type): + """extract individuals of the same type from static/csv/actors.csv + and make a list with them + :param indiv_type: or + :type indiv_type: str + :return: list of individuals of the choosen type + :rtype: list + """ with open(os.path.join(APPPATH, "static", "csv", "actors.csv"), 'r', encoding="utf-8") as opening: actors_csv = csv.reader(opening, delimiter=";") next(actors_csv, None)