diff options
author | Amin Hassani <ahassani@google.com> | 2017-12-18 15:15:32 -0800 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2018-01-05 18:37:15 -0800 |
commit | b05a65a748bd2e2542e7b05f629d3bc69c8d8135 (patch) | |
tree | ed736d196e5f908deeb450ffdacdc16432d74b77 /scripts/update_payload/checker.py | |
parent | 8adc24346405a142e7d3b65c3e4aee0515320f73 (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/checker.py')
-rw-r--r-- | scripts/update_payload/checker.py | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/scripts/update_payload/checker.py b/scripts/update_payload/checker.py index c710c47b..e4cb845f 100644 --- a/scripts/update_payload/checker.py +++ b/scripts/update_payload/checker.py @@ -21,11 +21,11 @@ import itertools import os import subprocess -import common -import error -import format_utils -import histogram -import update_metadata_pb2 +from update_payload import common +from update_payload import error +from update_payload import format_utils +from update_payload import histogram +from update_payload import update_metadata_pb2 # @@ -970,8 +970,6 @@ class PayloadChecker(object): op_name) # Check: Hash verifies correctly. - # pylint cannot find the method in hashlib, for some reason. - # pylint: disable=E1101 actual_hash = hashlib.sha256(self.payload.ReadDataBlob(data_offset, data_length)) if op.data_sha256_hash != actual_hash.digest(): @@ -1168,8 +1166,6 @@ class PayloadChecker(object): report.AddSection('signatures') # Check: At least one signature present. - # pylint cannot see through the protobuf object, it seems. - # pylint: disable=E1101 if not sigs.signatures: raise error.PayloadError('Signature block is empty.') |