rework division handling
Python 3 changed the / operator to return a float all the time.
Change to using // in cases where we want integer division, and
import future division in modules where we want float behavior.
We don't enforce the future division import all the time since
pylint will enforce those two states all the time.
BUG=chromium:980619
TEST=lint is unchanged in chromite
TEST=unittests pass
Change-Id: Iae007d3dc868746f755eba30ab0923e4f4502eae
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/chromite/+/1768871
Reviewed-by: Michael Mortensen <mmortensen@google.com>
Commit-Queue: Mike Frysinger <vapier@chromium.org>
Tested-by: Mike Frysinger <vapier@chromium.org>
diff --git a/cli/flash.py b/cli/flash.py
index 0bba664..2e5e2ac 100644
--- a/cli/flash.py
+++ b/cli/flash.py
@@ -5,6 +5,7 @@
"""Install/copy the image to the device."""
+from __future__ import division
from __future__ import print_function
import os
@@ -79,7 +80,7 @@
if match:
self._transferred = match.groups()[0]
- self.ProgressBar(float(self._transferred) / self._size)
+ self.ProgressBar(self._transferred / self._size)
def _IsFilePathGPTDiskImage(file_path, require_pmbr=False):