From 0a2ef84ed751ffcb922ca51dc4dedb051f28cc57 Mon Sep 17 00:00:00 2001 From: "Jurriaan H. Spaaks" Date: Thu, 11 Mar 2021 07:52:16 +0100 Subject: [PATCH 1/5] now closes progressbar when done, printing looks ok --- fairtally/cli.py | 1 + 1 file changed, 1 insertion(+) diff --git a/fairtally/cli.py b/fairtally/cli.py index f9d1568..1146bac 100644 --- a/fairtally/cli.py +++ b/fairtally/cli.py @@ -35,6 +35,7 @@ def cli(urls, input_file, output_format, output_filename): url_progressbar = tqdm(all_urls, bar_format="fairtally progress: |{bar}| {n_fmt}/{total_fmt}", ncols=70, position=0) current_value = tqdm(total=0, bar_format="{desc}", position=1) results = [check_url(url, current_value) for url in url_progressbar] + current_value.close() if output_filename == DEFAULT_OUTPUT_FILENAME and output_format == "json": output_filename = "tally.json" From 3ecf07a4ae58251915b3dc87644ba72acb8ac3b7 Mon Sep 17 00:00:00 2001 From: "Jurriaan H. Spaaks" Date: Thu, 11 Mar 2021 07:52:43 +0100 Subject: [PATCH 2/5] updated .gitignore with venv and tally.html --- .gitignore | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.gitignore b/.gitignore index a1ecd2f..80080b9 100644 --- a/.gitignore +++ b/.gitignore @@ -23,3 +23,9 @@ docs/apidocs # Mac .DS_Store + +# fairtally default output file with results +/tally.html + +# virtual environment +/venv3 From e56710c2efd0c2cae0071621c8fa4f30f0157fac Mon Sep 17 00:00:00 2001 From: "Jurriaan H. Spaaks" Date: Thu, 11 Mar 2021 08:17:36 +0100 Subject: [PATCH 3/5] closing the helper bar should happen lower down --- fairtally/cli.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fairtally/cli.py b/fairtally/cli.py index 1146bac..84ade5f 100644 --- a/fairtally/cli.py +++ b/fairtally/cli.py @@ -35,7 +35,6 @@ def cli(urls, input_file, output_format, output_filename): url_progressbar = tqdm(all_urls, bar_format="fairtally progress: |{bar}| {n_fmt}/{total_fmt}", ncols=70, position=0) current_value = tqdm(total=0, bar_format="{desc}", position=1) results = [check_url(url, current_value) for url in url_progressbar] - current_value.close() if output_filename == DEFAULT_OUTPUT_FILENAME and output_format == "json": output_filename = "tally.json" @@ -51,3 +50,4 @@ def cli(urls, input_file, output_format, output_filename): msg = f"Completed fairtally on {len(all_urls)} URLs and written report to {output_filename}" current_value.set_description_str(msg) + current_value.close() From 59c3009cb8e0bee0df53d41900c5f434e3f1a4e1 Mon Sep 17 00:00:00 2001 From: "Jurriaan H. Spaaks" Date: Tue, 16 Mar 2021 09:34:21 +0100 Subject: [PATCH 4/5] Update fairtally/cli.py Co-authored-by: Stefan Verhoeven --- fairtally/cli.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/fairtally/cli.py b/fairtally/cli.py index 84ade5f..eb00ea3 100644 --- a/fairtally/cli.py +++ b/fairtally/cli.py @@ -49,5 +49,6 @@ def cli(urls, input_file, output_format, output_filename): sys.exit(1) msg = f"Completed fairtally on {len(all_urls)} URLs and written report to {output_filename}" - current_value.set_description_str(msg) + current_value.set_description_str((len("currently checking ") + max([len(u) for u in all_urls])) * ' ') current_value.close() + click.echo(msg, err=True) From b088800e3c5058960cacb84c9331a97c99314628 Mon Sep 17 00:00:00 2001 From: "Jurriaan H. Spaaks" Date: Tue, 16 Mar 2021 09:52:55 +0100 Subject: [PATCH 5/5] now initializing with leave=False and cleaning up with no-args set_description_str --- fairtally/cli.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fairtally/cli.py b/fairtally/cli.py index eb00ea3..b36c7d4 100644 --- a/fairtally/cli.py +++ b/fairtally/cli.py @@ -33,7 +33,7 @@ def cli(urls, input_file, output_format, output_filename): sys.exit(1) url_progressbar = tqdm(all_urls, bar_format="fairtally progress: |{bar}| {n_fmt}/{total_fmt}", ncols=70, position=0) - current_value = tqdm(total=0, bar_format="{desc}", position=1) + current_value = tqdm(total=0, bar_format="{desc}", position=1, leave=False) results = [check_url(url, current_value) for url in url_progressbar] if output_filename == DEFAULT_OUTPUT_FILENAME and output_format == "json": @@ -49,6 +49,6 @@ def cli(urls, input_file, output_format, output_filename): sys.exit(1) msg = f"Completed fairtally on {len(all_urls)} URLs and written report to {output_filename}" - current_value.set_description_str((len("currently checking ") + max([len(u) for u in all_urls])) * ' ') + current_value.set_description_str() current_value.close() click.echo(msg, err=True)