[elbe-devel] [PATCH 40/75] repomanager: Fix Pylint

Torben Hohn torben.hohn at linutronix.de
Fri May 29 12:56:06 CEST 2020


On Mon, May 25, 2020 at 11:42:33AM -0400, Olivier Dion wrote:
> 23:0:   R0205: (useless-object-inheritance)
> 53:0:   R0205: (useless-object-inheritance)
> 227:33: W0613: (unused-argument)
> 236:40: E0602: (undefined-variable)
> 235:30: W0613: (unused-argument)
> 241:40: E0602: (undefined-variable)
> 240:38: W0613: (unused-argument)
> 12:0:   W0611: (unused-import)
> 
> Signed-off-by: Olivier Dion <dion at linutronix.de>
> ---
>  elbepack/repomanager.py | 15 +++++++++------
>  1 file changed, 9 insertions(+), 6 deletions(-)
> 
> diff --git a/elbepack/repomanager.py b/elbepack/repomanager.py
> index 909d13ea..bce55830 100644
> --- a/elbepack/repomanager.py
> +++ b/elbepack/repomanager.py
> @@ -9,7 +9,6 @@
>  
>  import os
>  import shutil
> -import logging
>  
>  from debian.deb822 import Deb822
>  
> @@ -19,7 +18,8 @@ from elbepack.pkgutils import get_dsc_size
>  from elbepack.egpg import generate_elbe_internal_key, export_key, unlock_key
>  from elbepack.shellhelper import CommandError, do
>  
> -
> +# TODO:py3 Remove object inheritance
> +# pylint: disable=useless-object-inheritance
>  class RepoAttributes(object):
>      def __init__(self, codename, arch, components,
>                   mirror='http://ftp.de.debian.org/debian'):
> @@ -49,7 +49,8 @@ class RepoAttributes(object):
>  
>          return [RepoAttributes(self.codename, ret_arch, ret_comp, self.mirror)]
>  
> -
> +# TODO:py3 Remove object inheritance
> +# pylint: disable=useless-object-inheritance
>  class RepoBase(object):
>  
>      # pylint: disable=too-many-instance-attributes
> @@ -224,7 +225,7 @@ class RepoBase(object):
>          do(cmd % (self.fs.path, codename, pkgname),
>             env_add={'GNUPGHOME': '/var/cache/elbe/gnupg'})
>  
> -    def removedeb(self, pkgname, component="main"):
> +    def removedeb(self, pkgname, _component="main"):
>          self._removedeb(pkgname, self.repo_attr.codename)

i dont think that it makes sense to ignore the component.
With your new changes, we might have different versions of some package
in different components, and we probably dont want to remove the wrong
ones.
Maybe the code is not used currently, but this might lead to unexpected
behaviour down the road.
Please specify the component on the reprepro commandline.
But first make sure about the default behaviour. What happens, when no
component is specified ? Does it remove from all components ?
Then we might want to have a default of component=None or something.


>  
>      def _removesrc(self, srcname, codename):
> @@ -232,12 +233,14 @@ class RepoBase(object):
>          do(cmd % (self.fs.path, codename, srcname),
>             env_add={'GNUPGHOME': '/var/cache/elbe/gnupg'})
>  
> -    def removesrc(self, path, component="main"):
> +    def removesrc(self, path, _component="main"):
> +        # pylint: disable=undefined-variable
>          for p in Deb822.iter_paragraphs(file(path)):
>              if 'Source' in p:
>                  self._removesrc(p['Source'], self.repo_attr.codename)
>  
> -    def _remove(self, path, codename, component):
> +    def _remove(self, path, codename, _component):
> +        # pylint: disable=undefined-variable
>          for p in Deb822.iter_paragraphs(file(path)):
>              if 'Source' in p:
>                  self._removesrc(p['Source'], codename)
> -- 
> 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