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>
diff --git a/scripts/update_payload/payload.py b/scripts/update_payload/payload.py
index 9450d02..8e50c1f 100644
--- a/scripts/update_payload/payload.py
+++ b/scripts/update_payload/payload.py
@@ -13,8 +13,8 @@
from update_payload import block_tracer
from update_payload import checker
from update_payload import common
-from update_payload.error import PayloadError
from update_payload import update_metadata_pb2
+from update_payload.error import PayloadError
#
@@ -189,8 +189,6 @@
if self.is_init:
raise PayloadError('payload object already initialized')
- # Initialize hash context.
- # pylint: disable=E1101
self.manifest_hasher = hashlib.sha256()
# Read the file header.
@@ -232,11 +230,9 @@
_DisplayIndentedValue('Build version', image_info.build_version)
if self.manifest.HasField('old_image_info'):
- # pylint: disable=E1101
_DescribeImageInfo('Old Image', self.manifest.old_image_info)
if self.manifest.HasField('new_image_info'):
- # pylint: disable=E1101
_DescribeImageInfo('New Image', self.manifest.new_image_info)
def _AssertInit(self):