Compare commits

..

No commits in common. "0040dccd9a902d70277019433648b8b247f92e31" and "406b89fea168d13feb316f2e8d4c2fbb46ff0763" have entirely different histories.

2 changed files with 3 additions and 6 deletions

View File

@ -45,7 +45,7 @@ def from_pdf(pdf):
charge_tables = [] charge_tables = []
patrimoie_tables = [] patrimoie_tables = []
for page_number, page in enumerate(pdf.pages): for page in pdf.pages:
page_text = page.extract_text() page_text = page.extract_text()
date = extract_date(page_text) date = extract_date(page_text)
additionnal_fields = { additionnal_fields = {
@ -76,7 +76,7 @@ def from_pdf(pdf):
pass pass
else: else:
logging.warning(f"Page {page_number+1} non reconnu. Page ignorée.") raise ValueError("Page non reconnu")
df_charge = charge.table2df(recapitulatif_tables + charge_tables) df_charge = charge.table2df(recapitulatif_tables + charge_tables)
df_loc = locataire.table2df(loc_tables) df_loc = locataire.table2df(loc_tables)

View File

@ -32,10 +32,7 @@ def is_it(page_text):
def get_lot(txt): def get_lot(txt):
"""Return lot number from "RECAPITULATIF DES OPERATIONS" """ """Return lot number from "RECAPITULATIF DES OPERATIONS" """
regex = r"[BSM](\d+)(?=\s*-)" regex = r"[BSM](\d+)(?=\s*-)"
try: result = re.findall(regex, txt)
result = re.findall(regex, txt)
except TypeError:
return "*"
if result: if result:
return "{:02d}".format(int(result[0])) return "{:02d}".format(int(result[0]))
return "*" return "*"