[virt-tools-list] [virt-bootstrap] [PATCH v2 01/14] setup: Use explicit import

Cedric Bosdonnat cbosdonnat at suse.com
Tue Aug 1 13:09:42 UTC 2017


On Tue, 2017-08-01 at 12:28 +0100, Radostin Stoyanov wrote:
> Reduce the number of import statements and improve readability.

Sounds like a good idea. However I wonder if you left the subprocess
imports as is on purpose. If not it would be good to add these to this
cleanup commit.

--
Cedric

> ---
>  setup.py | 13 ++++++-------
>  1 file changed, 6 insertions(+), 7 deletions(-)
> 
> diff --git a/setup.py b/setup.py
> index 2f299b6..2d06144 100755
> --- a/setup.py
> +++ b/setup.py
> @@ -9,9 +9,8 @@ based on setuptools.
>  import codecs
>  import os
>  import sys
> -from subprocess import call
> -from setuptools import Command
> -from setuptools import setup
> +import subprocess
> +import setuptools
>  
>  
>  def read(fname):
> @@ -23,7 +22,7 @@ def read(fname):
>          return fobj.read()
>  
>  
> -class CheckPylint(Command):
> +class CheckPylint(setuptools.Command):
>      """
>      Check python source files with pylint and pycodestyle.
>      """
> @@ -55,7 +54,7 @@ class CheckPylint(Command):
>  
>          print(">>> Running pycodestyle ...")
>          cmd = "pycodestyle "
> -        if (call(cmd + files, shell=True) != 0):
> +        if (subprocess.call(cmd + files, shell=True) != 0):
>              res = 1
>  
>          print(">>> Running pylint ...")
> @@ -63,13 +62,13 @@ class CheckPylint(Command):
>          if self.errors_only:
>              args = "-E"
>          cmd = "pylint %s --output-format=%s " % (args, format(output_format))
> -        if (call(cmd + files, shell=True) != 0):
> +        if (subprocess.call(cmd + files, shell=True) != 0):
>              res = 1
>  
>          sys.exit(res)
>  
>  
> -setup(
> +setuptools.setup(
>      name='virt-bootstrap',
>      version='0.1.0',
>      author='Cedric Bosdonnat',




More information about the virt-tools-list mailing list