[elbe-devel] [PATCH 32/40] pylint: annotate or remove unused variables

Torben Hohn torben.hohn at linutronix.de
Thu Sep 20 13:45:18 CEST 2018


On Fri, Sep 14, 2018 at 01:56:44PM +0200, Manuel Traut wrote:
> asyncworker.py:
>   annotate, because it's nice for consistency between the other
>   enqueue calls
> 
> efilesystem.py, initvmaction.py, repomanager.py:
>   remove unused variables
> 
> Signed-off-by: Manuel Traut <manut at linutronix.de>
> ---
>  elbepack/asyncworker.py  |  1 +
>  elbepack/efilesystem.py  |  4 +---
>  elbepack/initvmaction.py |  2 --
>  elbepack/repomanager.py  | 14 +++++++-------
>  4 files changed, 9 insertions(+), 12 deletions(-)
> 
> diff --git a/elbepack/asyncworker.py b/elbepack/asyncworker.py
> index 313d9234..b54de2ae 100644
> --- a/elbepack/asyncworker.py
> +++ b/elbepack/asyncworker.py
> @@ -26,6 +26,7 @@ class AsyncWorkerJob(object):
>          self.old_status = None
>  
>      def enqueue(self, queue, db):
> +        #pylint: disable=unused-argument

please use _db

>          queue.put(self)
>  
>      def execute(self, db):
> diff --git a/elbepack/efilesystem.py b/elbepack/efilesystem.py
> index e6a8c2ab..5ab6601b 100644
> --- a/elbepack/efilesystem.py
> +++ b/elbepack/efilesystem.py
> @@ -334,7 +334,6 @@ class TargetFs(ChRootFilesystem):
>                  pass
>  
>          if self.xml.has("target/package/cpio"):
> -            oldwd = os.getcwd()

we save the old directory, and then chdir ?
this looks like a bug to me.
we should be changing back to the old path, shouldnt we ?



>              cpio_name = self.xml.text("target/package/cpio/name")
>              os.chdir(self.fname(''))
>              try:
> @@ -349,7 +348,6 @@ class TargetFs(ChRootFilesystem):
>                  pass
>  
>          if self.xml.has("target/package/squashfs"):
> -            oldwd = os.getcwd()

same.

>              sfs_name = self.xml.text("target/package/squashfs/name")
>              os.chdir(self.fname(''))
>              try:
> @@ -358,7 +356,7 @@ class TargetFs(ChRootFilesystem):
>                      (self.fname(''), targetdir, sfs_name))
>                  # only append filename if creating mksquashfs was successful
>                  self.images.append(sfs_name)
> -            except CommandError as e:
> +            except CommandError:
>                  # error was logged; continue
>                  pass
>  
> diff --git a/elbepack/initvmaction.py b/elbepack/initvmaction.py
> index 8f9929cd..f7526cb6 100644
> --- a/elbepack/initvmaction.py
> +++ b/elbepack/initvmaction.py
> @@ -590,13 +590,11 @@ class SubmitAction(InitVMAction):
>              if args[0].endswith('.xml'):
>                  # We have an xml file, use that for elbe init
>                  xmlfile = args[0]
> -                url_validation = ''
>              elif args[0].endswith('.iso'):
>                  # We have an iso image, extract xml from there.
>                  tmp = extract_cdrom(args[0])
>  
>                  xmlfile = tmp.fname('source.xml')
> -                url_validation = '--skip-urlcheck'

ok. i think we have already removed the url validation from the soap
interface.



rest is good...

>                  cdrom = args[0]
>              else:
>                  print(
> diff --git a/elbepack/repomanager.py b/elbepack/repomanager.py
> index 4e37daeb..9b6085a6 100644
> --- a/elbepack/repomanager.py
> +++ b/elbepack/repomanager.py
> @@ -208,7 +208,7 @@ class RepoBase(object):
>                  # different md5 already.
>                  #
>                  # Try remove, and add again.
> -                self.removedeb(pkgname, component)
> +                self.removedeb(pkgname)
>                  self._includedeb(path, self.repo_attr.codename, component)
>              else:
>                  raise ce
> @@ -228,7 +228,7 @@ class RepoBase(object):
>              "reprepro --basedir %s remove %s %s" %
>              (self.fs.path, codename, pkgname))
>  
> -    def removedeb(self, pkgname, component="main"):
> +    def removedeb(self, pkgname):
>          self._removedeb(pkgname, self.repo_attr.codename)
>  
>      def _removesrc(self, srcname, codename):
> @@ -236,12 +236,12 @@ class RepoBase(object):
>              "reprepro --basedir %s removesrc %s %s" %
>              (self.fs.path, codename, srcname))
>  
> -    def removesrc(self, path, component="main"):
> +    def removesrc(self, path):
>          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):
>          os.environ['GNUPGHOME'] = "/var/cache/elbe/gnupg"
>          for p in Deb822.iter_paragraphs(file(path)):
>              if 'Source' in p:
> @@ -278,7 +278,7 @@ class RepoBase(object):
>                  # different md5 already.
>                  #
>                  # Try remove, and add again.
> -                self.removesrc(path, component)
> +                self.removesrc(path)
>                  self._includedsc(path, self.repo_attr.codename, component)
>              else:
>                  raise ce
> @@ -286,8 +286,8 @@ class RepoBase(object):
>      def include(self, path, component="main"):
>          self._include(path, self.repo_attr.codename, component)
>  
> -    def remove(self, path, component="main"):
> -        self._remove(path, self.repo_attr.codename, component)
> +    def remove(self, path):
> +        self._remove(path, self.repo_attr.codename)
>  
>      def include_init_dsc(self, path, component="main"):
>          self._includedsc(path, self.init_attr.codename, component)
> -- 
> 2.19.0.rc2
> 

-- 
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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <http://lists.linutronix.de/pipermail/elbe-devel/attachments/20180920/c2564773/attachment.sig>


More information about the elbe-devel mailing list