[elbe-devel] [PATCH 65/75] aptpkgutils: Fix Pylint
Torben Hohn
torben.hohn at linutronix.de
Fri May 29 16:58:44 CEST 2020
On Mon, May 25, 2020 at 11:42:58AM -0400, Olivier Dion wrote:
> 32:13: W0212: (protected-access)
> 33:4: C0200: (consider-using-enumerate)
> 65:4: R1705: (no-else-return)
> 118:28: W0212: (protected-access)
> 120:45: W0212: (protected-access)
> 126:46: W0212: (protected-access)
> 133:8: W0715: (raising-format-tuple)
> 140:0: R0205: (useless-object-inherit)
>
> Signed-off-by: Olivier Dion <dion at linutronix.de>
Reviewed-by: Torben Hohn <torben.hohn at linutronix.de>
> ---
> elbepack/aptpkgutils.py | 22 +++++++++++++---------
> 1 file changed, 13 insertions(+), 9 deletions(-)
>
> diff --git a/elbepack/aptpkgutils.py b/elbepack/aptpkgutils.py
> index d63ebe0c..a2608e26 100644
> --- a/elbepack/aptpkgutils.py
> +++ b/elbepack/aptpkgutils.py
> @@ -29,7 +29,9 @@ statestring = {
> }
>
> def apt_pkg_md5(pkg):
> + # pylint: disable=protected-access
> hashes = pkg._records.hashes
> + # pylint: disable=consider-using-enumerate
> for i in range(len(hashes)):
> h = str(hashes[i])
> if h.startswith("MD5"):
> @@ -64,15 +66,14 @@ def getalldeps(c, pkgname):
> def pkgstate(pkg):
> if pkg.marked_install:
> return MARKED_INSTALL
> - elif pkg.marked_upgrade:
> + if pkg.marked_upgrade:
> return MARKED_UPGRADE
> - elif pkg.marked_delete:
> + if pkg.marked_delete:
> return MARKED_DELETE
> - elif pkg.is_upgradable:
> + if pkg.is_upgradable:
> return UPGRADABLE
> - elif pkg.is_installed:
> + if pkg.is_installed:
> return INSTALLED
> -
> return NOTINSTALLED
>
>
> @@ -115,12 +116,15 @@ def fetch_binary(version, destdir='', progress=None):
>
> Then fixed up to use sha256 and pass pycodestyle.
> """
> + # pylint: disable=protected-access
> base = os.path.basename(version._records.filename)
> destfile = os.path.join(destdir, base)
> + # pylint: disable=protected-access
> if _file_is_same(destfile, version.size, version._records.sha256_hash):
> logging.debug('Ignoring already existing file: %s', destfile)
> return os.path.abspath(destfile)
> acq = apt_pkg.Acquire(progress or apt.progress.text.AcquireProgress())
> + # pylint: disable=protected-access
> acqfile = apt_pkg.AcquireFile(acq,
> version.uri,
> "SHA256:" + version._records.sha256_hash,
> @@ -130,13 +134,13 @@ def fetch_binary(version, destdir='', progress=None):
> acq.run()
>
> if acqfile.status != acqfile.STAT_DONE:
> - raise FetchError("The item %r could not be fetched: %s",
> - acqfile.destfile,
> - acqfile.error_text)
> + raise FetchError("The item %r could not be fetched: %s" %
> + (acqfile.destfile, acqfile.error_text))
>
> return os.path.abspath(destfile)
>
> -
> +# TODO:py3 Remove object inheritance
> +# pylint: disable=useless-object-inheritance
> class PackageBase(object):
>
> # pylint: disable=too-many-instance-attributes
> --
> 2.26.2
>
>
> _______________________________________________
> elbe-devel mailing list
> elbe-devel at linutronix.de
> https://lists.linutronix.de/mailman/listinfo/elbe-devel
--
Torben Hohn
Linutronix GmbH | Bahnhofstrasse 3 | D-88690 Uhldingen-Mühlhofen
Phone: +49 7556 25 999 18; Fax.: +49 7556 25 999 99
Hinweise zum Datenschutz finden Sie hier (Informations on data privacy
can be found here): https://linutronix.de/kontakt/Datenschutz.php
Linutronix GmbH | Firmensitz (Registered Office): Uhldingen-Mühlhofen |
Registergericht (Registration Court): Amtsgericht Freiburg i.Br., HRB700
806 | Geschäftsführer (Managing Directors): Heinz Egger, Thomas Gleixner
More information about the elbe-devel
mailing list