summaryrefslogtreecommitdiff
path: root/scripts/update_payload/applier.py
diff options
context:
space:
mode:
authorAmin Hassani <ahassani@google.com>2017-12-18 15:15:32 -0800
committerchrome-bot <chrome-bot@chromium.org>2018-01-05 18:37:15 -0800
commitb05a65a748bd2e2542e7b05f629d3bc69c8d8135 (patch)
treeed736d196e5f908deeb450ffdacdc16432d74b77 /scripts/update_payload/applier.py
parent8adc24346405a142e7d3b65c3e4aee0515320f73 (diff)
update_payload: Fix most of lint styling issues.
This patch fixes a lot of pylint issues in the update_engine scripts. Majority of this changes are based on recommendation found in: https://www.chromium.org/chromium-os/python-style-guidelines It is a good idea to do these changes now, because if there are many pylint errors when performing 'repo upload', serious problems can be overshadowed by a lot of noise and eventually cause problems. These fixes include: - Fixing executable shebangs to /usr/bin/python2. - Fixing import-error problems by disabiling them. - Removing pylint disables that are not valid anymore. - Changing all imports to proper absolute import format. - Change the import of PayloadError from update_payload.PayloadError for simplicity. - Add pydoc strings for functions and classes that were missing. The remaining unchanged pylint problmes include: - The header files of these scripts are in CrOS copyright format, but the the cros lint hook is configured to AoSP copyright format. - The test* functions in unittests are not compatible with CamelCase format. BUG=chromium:796338 TEST=unittests pass TEST=start_devserver TEST=cros flash TEST=scripts/paycheck.py Change-Id: I7eed4d1625eb7c510c7949fada120de5a6a26c7b Reviewed-on: https://chromium-review.googlesource.com/834875 Commit-Ready: Amin Hassani <ahassani@chromium.org> Tested-by: Amin Hassani <ahassani@chromium.org> Reviewed-by: Ben Chan <benchan@chromium.org> Reviewed-by: Sen Jiang <senj@chromium.org>
Diffstat (limited to 'scripts/update_payload/applier.py')
-rw-r--r--scripts/update_payload/applier.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/scripts/update_payload/applier.py b/scripts/update_payload/applier.py
index 3cb9741a..e470ac4e 100644
--- a/scripts/update_payload/applier.py
+++ b/scripts/update_payload/applier.py
@@ -24,8 +24,8 @@ import subprocess
import sys
import tempfile
-import common
-from error import PayloadError
+from update_payload import common
+from update_payload.error import PayloadError
#
@@ -44,7 +44,6 @@ def _VerifySha256(file_obj, expected_hash, name, length=-1):
PayloadError if computed hash doesn't match expected one, or if fails to
read the specified length of data.
"""
- # pylint: disable=E1101
hasher = hashlib.sha256()
block_length = 1024 * 1024
max_length = length if length >= 0 else sys.maxint
@@ -316,6 +315,7 @@ class PayloadApplier(object):
base_name = '%s.dst_extents' % op_name
# Iterate over the extents and write zero.
+ # pylint: disable=unused-variable
for ex, ex_name in common.ExtentIter(op.dst_extents, base_name):
# Only do actual writing if this is not a pseudo-extent.
if ex.start_block != common.PSEUDO_EXTENT_MARKER:
@@ -361,6 +361,7 @@ class PayloadApplier(object):
"""
length = 0
+ # pylint: disable=unused-variable
for ex, ex_name in common.ExtentIter(extents, base_name):
length += ex.num_blocks * self.block_size
return length