From 8b0c518be1589c7100940ab02a4df3447944aa89 Mon Sep 17 00:00:00 2001 From: putro Date: Fri, 17 Apr 2020 16:43:36 +0200 Subject: [PATCH] added some description to functions --- README | 2 +- openlamb.py | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/README b/README index bb02e52..837ee1e 100644 --- a/README +++ b/README @@ -39,7 +39,7 @@ ogni volta che si lancia lo script viene salvato un file export.csv che contiene requisiti: python3 - pip3 install sodapy matplotlib pandas + pip3 install sodapy matplotlib pandas tabulate sintassi: diff --git a/openlamb.py b/openlamb.py index 442fbcf..6f7f322 100755 --- a/openlamb.py +++ b/openlamb.py @@ -111,6 +111,7 @@ def plot_dataframe(dataframe): def list_of_csv_files(dir_name): + """ restituisce la lista dei files .zip presenti in una directory """ saved = getcwd() os.chdir(dir_name) filelist = glob.glob('*.zip') @@ -119,6 +120,7 @@ def list_of_csv_files(dir_name): def parse_range(x): + """ espande un range di anni nel formato NNNN-NNNN restituendo una lista dei singoli anni """ x = x.strip() if x.isdigit(): yield str(x) @@ -130,6 +132,7 @@ def parse_range(x): def get_csv_dict(dict): + """ prende un dizionario dei files csv e assegna ad ogni anno un filename e una sigla id, restituendo un dict """ d = {} for (k, v) in dict.items(): filename, id = k, v @@ -140,7 +143,7 @@ def get_csv_dict(dict): elif match_single: years = [match_single.group()] else: - print("no match") + print("\nError: no match, the filename does not contain any year") for year in years: d.update({year: [filename, id]}) return d