""" Copyright (c) 2020 Sdj Geek Voir le fichier LICENSE Classe d'accès aux données du site de l'Église """ import os import pandas as pd from membre_base import MembreBase, MembreProvider class ExcelIn(MembreProvider): def __init__(self, excel_path): self.excel_path = excel_path self.dataframe = None def __len__(self): return len(self.dataframe) class Member(MembreBase): def __init__(self, provider, row): super().__init__(provider) def get_name(self): return os.path.basename(self.excel_path) def load(self): self.dataframe = pd.read_excel(self.excel_path) return len(self.dataframe) def get_member_list(self): for index, row in self.dataframe.iterrows(): try: yield self.Member(self, row) except ValueError: print(f"Error with member [{row}]") continue