|
|
@@ -119,7 +119,9 @@ def getCreneauDataFrame(csv_filename: str) -> DataFrame[CreneauDataSchema]:
|
|
|
return CreneauDataSchema.validate(df_creneau)
|
|
|
|
|
|
|
|
|
-def getPlanningDataFrame(csv_filename, starting_date, skip_column=3):
|
|
|
+def getPlanningDataFrame(
|
|
|
+ csv_filename, starting_date, skip_column=3
|
|
|
+) -> DataFrame[CreneauSchema]:
|
|
|
list_creneau = []
|
|
|
with io.open(csv_filename, "r", encoding="utf-8") as f:
|
|
|
datas = [split_csv_row(s.replace("\n", "")) for s in f.readlines()]
|
|
|
@@ -211,7 +213,13 @@ def getPlanningDataFrame(csv_filename, starting_date, skip_column=3):
|
|
|
return CreneauSchema.validate(df)
|
|
|
|
|
|
|
|
|
-def parseGsheet(doc_uuid: str, saturday_date: datetime.datetime):
|
|
|
+def parseGsheet(
|
|
|
+ doc_uuid: str, saturday_date: datetime.datetime
|
|
|
+) -> tuple[
|
|
|
+ DataFrame[ContactSchema],
|
|
|
+ DataFrame[CreneauDataSchema],
|
|
|
+ DataFrame[CreneauSchema],
|
|
|
+]:
|
|
|
suffix = "_2023"
|
|
|
fname_planning = f"./planning{suffix}.csv"
|
|
|
fname_creneau = f"./creneau{suffix}.csv"
|
|
|
@@ -230,6 +238,7 @@ def parseGsheet(doc_uuid: str, saturday_date: datetime.datetime):
|
|
|
df_creneau = getCreneauDataFrame(fname_creneau)
|
|
|
except SchemaError as exc:
|
|
|
raise ParsingError("Donnée erronée des description des créneaux\n" + str(exc))
|
|
|
+
|
|
|
try:
|
|
|
df_planning = getPlanningDataFrame(fname_planning, saturday_date)
|
|
|
except SchemaError as exc:
|
|
|
@@ -238,4 +247,5 @@ def parseGsheet(doc_uuid: str, saturday_date: datetime.datetime):
|
|
|
os.remove(fname_planning)
|
|
|
os.remove(fname_creneau)
|
|
|
os.remove(fname_contact)
|
|
|
+
|
|
|
return df_contact, df_creneau, df_planning
|