[elbe-devel] [PATCH 1/1] archivedir:fix style errors

Torben Hohn torben.hohn at linutronix.de
Tue Sep 10 15:05:22 CEST 2019


On Tue, Sep 10, 2019 at 02:25:22PM +0200, Akash Satamkar wrote:
> pycodestyle complains:
> 
> elbepack/archivedir.py:12:37: E231 missing whitespace after ','
> elbepack/archivedir.py:14:33: E231 missing whitespace after ','
> elbepack/archivedir.py:23:1: E302 expected 2 blank lines, found 1
> elbepack/archivedir.py:26:1: E302 expected 2 blank lines, found 1
> elbepack/archivedir.py:42:1: E302 expected 2 blank lines, found 1
> elbepack/archivedir.py:50:1: E302 expected 2 blank lines, found 1
> elbepack/archivedir.py:70:1: E302 expected 2 blank lines, found 1
> elbepack/archivedir.py:72:40: E228 missing whitespace around modulo operator
> elbepack/archivedir.py:75:1: E302 expected 2 blank lines, found 1
> elbepack/archivedir.py:83:1: E302 expected 2 blank lines, found 1
> elbepack/archivedir.py:87:1: E302 expected 2 blank lines, found 1
> elbepack/archivedir.py:93:1: E302 expected 2 blank lines, found 1
> elbepack/archivedir.py:117:1: E302 expected 2 blank lines, found 1
> 
> fixed it.
> 
> Signed-off-by: Akash Satamkar <akash at linutronix.de>

Reviewed-by: Torben Hohn <torben.hohn at linutronix.de>

> ---
>  elbepack/archivedir.py | 16 +++++++++++++---
>  1 file changed, 13 insertions(+), 3 deletions(-)
> 
> diff --git a/elbepack/archivedir.py b/elbepack/archivedir.py
> index 10155228..ac389971 100644
> --- a/elbepack/archivedir.py
> +++ b/elbepack/archivedir.py
> @@ -9,9 +9,9 @@ import sys
>  
>  # The urlparse module is renamed to urllib.parse in Python 3.
>  try:
> -    from urllib.parse import urljoin,urlparse
> +    from urllib.parse import urljoin, urlparse
>  except ImportError:
> -    from urlparse import urljoin,urlparse
> +    from urlparse import urljoin, urlparse
>  
>  from base64 import standard_b64encode
>  from bz2 import compress as bz2compress
> @@ -20,9 +20,11 @@ from subprocess import CalledProcessError
>  from elbepack.treeutils import etree
>  from elbepack.shellhelper import system
>  
> +
>  class ArchivedirError(Exception):
>      pass
>  
> +
>  def enbase(fname, compress=True):
>      infile = file(fname, "r")
>      s = infile.read()
> @@ -39,6 +41,7 @@ def enbase(fname, compress=True):
>  
>      return splited
>  
> +
>  def collect(tararchive, path, keep):
>      if keep:
>          cmd = 'tar rf ' + tararchive + ' -C '
> @@ -47,6 +50,7 @@ def collect(tararchive, path, keep):
>      cmd += path + ' .'
>      system(cmd)
>  
> +
>  def chg_archive(xml, path, keep):
>      if os.path.isdir(path):
>          archive = '.archive.tar'
> @@ -67,11 +71,13 @@ def chg_archive(xml, path, keep):
>  
>      return xml
>  
> +
>  def prepare_path(url):
>      url = urlparse(url)
> -    path = url.geturl().replace("%s://"%url.scheme, '', 1)
> +    path = url.geturl().replace(" % s://" % url.scheme, '', 1)
>      return re.sub(r'/$', "", path)
>  
> +
>  def get_and_append_local(url, tararchive, keep):
>      if urlparse(url).netloc:
>          msg = "Reject suspicious file:// URI \"{}\". ".format(url)
> @@ -80,16 +86,19 @@ def get_and_append_local(url, tararchive, keep):
>          raise ArchivedirError(msg)
>      collect(tararchive, prepare_path(url), keep)
>  
> +
>  def get_and_append_unknown(url, _archive):
>      msg = "unhandled scheme \"{}://\"".format(urlparse(url).scheme)
>      raise NotImplementedError(msg)
>  
> +
>  def get_and_append_method(url):
>      return {
>          '': get_and_append_local,
>          'file': get_and_append_local,
>      }.get(urlparse(url).scheme, get_and_append_unknown)
>  
> +
>  def _combinearchivedir(xml):
>      elbexml = etree(None)
>      elbexml.et = xml
> @@ -114,6 +123,7 @@ def _combinearchivedir(xml):
>  
>      return xml
>  
> +
>  def combinearchivedir(xml):
>      if xml.find("archivedir") is None:
>          return xml
> -- 
> 2.20.1
> 
> 
> _______________________________________________
> 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