Resolve Pylint's identified [E]rrors in the codebase

Signed-off-by: Vladimir Diaz <vladimir.v.diaz@gmail.com>
This commit is contained in:
Vladimir Diaz 2017-11-15 16:34:34 -05:00
parent 3a972c7bbe
commit bb8729487d
No known key found for this signature in database
GPG key ID: 5DEE9B97B0E2289A
5 changed files with 12 additions and 12 deletions

View file

@ -2173,8 +2173,10 @@ def targets_of_role(self, rolename='targets'):
def get_one_valid_targetinfo(self, target_filepath):
"""
<Purpose>
Return the target information of 'target_filepath', and update its
corresponding metadata, if necessary.
Return the target information for 'target_filepath', and update its
corresponding metadata, if necessary. 'target_filepath' must match
exactly as it appears in metadata, and should not contain URL encoding
escapes.
<Arguments>
target_filepath:
@ -2202,10 +2204,6 @@ def get_one_valid_targetinfo(self, target_filepath):
# Raise 'securesystemslib.exceptions.FormatError' if there is a mismatch.
securesystemslib.formats.RELPATH_SCHEMA.check_match(target_filepath)
# 'target_filepath' might contain URL encoding escapes.
# http://docs.python.org/2/library/urllib.html#urllib.unquote
target_filepath = six.moves.urllib.parse.unquote(target_filepath)
if not target_filepath.startswith('/'):
target_filepath = '/' + target_filepath
@ -2214,8 +2212,9 @@ def get_one_valid_targetinfo(self, target_filepath):
# Raise an exception if the target information could not be retrieved.
if target is None:
logger.error(target_filepath + ' not found.')
raise tuf.exceptions.UnknownTargetError(target_filepath + ' not found.')
logger.error(repr(target_filepath) + ' not found.')
raise tuf.exceptions.UnknownTargetError(repr(target_filepath) + ' not'
' found.')
# Otherwise, return the found target.
else:

View file

@ -432,7 +432,7 @@ def status(self):
except securesystemslib.exceptions.Error as e:
signable = e[1]
self._log_status(self._project_name, signable, repository_name)
self._log_status(self._project_name, signable, self._repository_name)
return
finally:

View file

@ -651,7 +651,7 @@ def _check_downloaded_length(total_downloaded, required_length,
logger.debug('Good average download speed: ' +
repr(average_download_speed) + ' bytes per second')
raise securesystemslib.exceptions.DownloadLengthMismatchError(required_length, total_downloaded)
raise tuf.exceptions.DownloadLengthMismatchError(required_length, total_downloaded)
else:
# We specifically disabled strict checking of required length, but we

View file

@ -465,7 +465,7 @@ class MetaFile(object):
between Metadata File objects.
"""
info = None
info = {}
def __eq__(self, other):
return isinstance(other, MetaFile) and self.info == other.info

View file

@ -82,7 +82,8 @@
# Set the format for logging messages.
# Example format for '_FORMAT_STRING':
# [2013-08-13 15:21:18,068 localtime] [tuf] [INFO][_update_metadata:851@updater.py]
# [2013-08-13 15:21:18,068 localtime] [tuf]
# [INFO][_update_metadata:851@updater.py]
_FORMAT_STRING = '[%(asctime)s UTC] [%(name)s] [%(levelname)s] '+\
'[%(funcName)s:%(lineno)s@%(filename)s]\n%(message)s\n'