From 6ed55c07d45092b9527bff6b064b636295896132 Mon Sep 17 00:00:00 2001 From: Bertrand Benjamin Date: Sun, 18 Apr 2021 16:44:23 +0200 Subject: [PATCH] Feat: formating --- recopytex/database/filesystem/loader.py | 40 +++++++++++++++++++++---- 1 file changed, 35 insertions(+), 5 deletions(-) diff --git a/recopytex/database/filesystem/loader.py b/recopytex/database/filesystem/loader.py index a48a83b..30899f9 100644 --- a/recopytex/database/filesystem/loader.py +++ b/recopytex/database/filesystem/loader.py @@ -45,15 +45,46 @@ class CSVLoader(Loader): @property def exam_columns(self): - return pd.Index(['name', 'date', 'term', 'origin', 'tribe', 'id']) + return pd.Index(["name", "date", "term", "origin", "tribe", "id"]) @property def question_columns(self): - return pd.Index(['exercise', 'question', 'competence', 'theme', 'comment', 'score_rate', 'is_leveled', 'origin', 'exam_id', 'id']) + return pd.Index( + [ + "exercise", + "question", + "competence", + "theme", + "comment", + "score_rate", + "is_leveled", + "origin", + "exam_id", + "id", + ] + ) @property def score_columns(self): - return pd.Index(['term', 'exam', 'date', 'exercise', 'question', 'competence', 'theme', 'comment', 'score_rate', 'is_leveled', 'origin', 'exam_id', 'question_id', 'student_name', 'score']) + return pd.Index( + [ + "term", + "exam", + "date", + "exercise", + "question", + "competence", + "theme", + "comment", + "score_rate", + "is_leveled", + "origin", + "exam_id", + "question_id", + "student_name", + "score", + ] + ) def rename_columns(self, dataframe): """Rename dataframe column to match with `csv_fields` @@ -221,7 +252,7 @@ class CSVLoader(Loader): return pd.concat(scores) def get_exam_scores(self, exams=[]): - """ Get scores for all question of the exam + """Get scores for all question of the exam :param exams: list or dataframe of exams metadatas (need origin field to find the csv) @@ -238,7 +269,6 @@ class CSVLoader(Loader): questions = self.get_exam_questions(exams) return self.get_questions_scores(questions) - def get_students(self, tribes=[]): """Get student list