From 9b2cd74186f74a3c3e7c10b0ce39ebd992b11d36 Mon Sep 17 00:00:00 2001 From: Helmut Grohne Date: Wed, 29 Dec 2021 21:14:38 +0100 Subject: webapp: avoid changing variable type Again static type checking is the driver for the change here. --- webapp.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/webapp.py b/webapp.py index d91d724..0d9e3f9 100755 --- a/webapp.py +++ b/webapp.py @@ -22,18 +22,18 @@ from dedup.utils import fetchiter jinjaenv = jinja2.Environment(loader=jinja2.PackageLoader("dedup", "templates")) def format_size(size): - size = float(size) + sizef = float(size) fmt = "%d B" - if size >= 1024: - size /= 1024 + if sizef >= 1024: + sizef /= 1024 fmt = "%.1f KB" - if size >= 1024: - size /= 1024 + if sizef >= 1024: + sizef /= 1024 fmt = "%.1f MB" - if size >= 1024: - size /= 1024 + if sizef >= 1024: + sizef /= 1024 fmt = "%.1f GB" - return fmt % size + return fmt % sizef def function_combination(function1, function2): if function1 == function2: -- cgit v1.2.3