This changes aim to resolve Pylint C0326. http://pylint-messages.wikidot.com/messages:c0326 Signed-off-by: Radostin Stoyanov <rstoyanov1@xxxxxxxxx> --- libvirt_sandbox_image/cli.py | 26 +++++++++++++------------- libvirt_sandbox_image/sources/base.py | 4 ++-- libvirt_sandbox_image/sources/docker.py | 4 ++-- libvirt_sandbox_image/sources/virtbuilder.py | 4 ++-- libvirt_sandbox_image/template.py | 4 ++-- setup.py | 4 ++-- 6 files changed, 23 insertions(+), 23 deletions(-) diff --git a/libvirt_sandbox_image/cli.py b/libvirt_sandbox_image/cli.py index ec5fd6d..08c88a4 100644 --- a/libvirt_sandbox_image/cli.py +++ b/libvirt_sandbox_image/cli.py @@ -48,7 +48,7 @@ gettext.textdomain("libvirt-sandbox") try: gettext.install("libvirt-sandbox", localedir="/usr/share/locale", - codeset = 'utf-8') + codeset='utf-8') except IOError: import builtins builtins.__dict__['_'] = str @@ -109,7 +109,7 @@ def run(args): if args.connect is not None: cmd.append("-c") cmd.append(args.connect) - params = ['-m','host-image:/=%s,format=qcow2' % diskfile] + params = ['-m', 'host-image:/=%s,format=qcow2' % diskfile] networkArgs = args.network if networkArgs is not None: @@ -144,40 +144,40 @@ def list_cached(args): tmpls.extend(template.Template.get_all(source, "%s/%s" % (args.template_dir, source))) for tmpl in tmpls: - print (tmpl) + print(tmpl) def requires_template(parser): parser.add_argument("template", help=_("URI of the template")) def requires_name(parser): - parser.add_argument("-n","--name", + parser.add_argument("-n", "--name", help=_("Name of the running sandbox")) def requires_debug(parser): - parser.add_argument("-d","--debug", + parser.add_argument("-d", "--debug", default=False, action="store_true", help=_("Run in debug mode")) def check_connect(connectstr): - supportedDrivers = ['lxc:///','qemu:///session','qemu:///system'] + supportedDrivers = ['lxc:///', 'qemu:///session', 'qemu:///system'] if not connectstr in supportedDrivers: raise ValueError("URI '%s' is not supported by virt-sandbox-image" % connectstr) return True def requires_connect(parser): - parser.add_argument("-c","--connect", + parser.add_argument("-c", "--connect", help=_("Connect string for libvirt")) def requires_template_dir(parser): global default_template_dir - parser.add_argument("-t","--template-dir", + parser.add_argument("-t", "--template-dir", default=default_template_dir, help=_("Template directory for saving templates")) def requires_image_dir(parser): global default_image_dir - parser.add_argument("-I","--image-dir", + parser.add_argument("-I", "--image-dir", default=default_image_dir, help=_("Image directory for saving images")) @@ -222,9 +222,9 @@ def gen_run_args(subparser): parser.add_argument("args", nargs=argparse.REMAINDER, help=_("command arguments to run")) - parser.add_argument("-N","--network", + parser.add_argument("-N", "--network", help=_("Network params for running template")) - parser.add_argument("-e","--env",action="append", + parser.add_argument("-e", "--env", action="append", help=_("Environment params for running template")) parser.set_defaults(func=run) @@ -234,7 +234,7 @@ def gen_list_args(subparser): _("List locally cached images")) requires_template_dir(parser) - parser.add_argument("-s","--source", + parser.add_argument("-s", "--source", help=_("Name of the template source")) parser.set_defaults(func=list_cached) @@ -275,5 +275,5 @@ def main(): sys.stderr.flush() sys.exit(1) except Exception as e: - print (e) + print(e) sys.exit(1) diff --git a/libvirt_sandbox_image/sources/base.py b/libvirt_sandbox_image/sources/base.py index 0fc9243..c132489 100644 --- a/libvirt_sandbox_image/sources/base.py +++ b/libvirt_sandbox_image/sources/base.py @@ -127,13 +127,13 @@ class Source(): # Utility functions to share between the sources. - def format_disk(self,disk,format,connect): + def format_disk(self, disk, format, connect): cmd = ['virt-sandbox'] if connect is not None: cmd.append("-c") cmd.append(connect) cmd.append("-p") - params = ['--disk=file:disk_image=%s,format=%s' %(disk,format), + params = ['--disk=file:disk_image=%s,format=%s' %(disk, format), '/sbin/mkfs.ext3', '/dev/disk/by-tag/disk_image'] cmd = cmd + params diff --git a/libvirt_sandbox_image/sources/docker.py b/libvirt_sandbox_image/sources/docker.py index 94eb6d1..3ca1b10 100755 --- a/libvirt_sandbox_image/sources/docker.py +++ b/libvirt_sandbox_image/sources/docker.py @@ -533,7 +533,7 @@ class DockerSource(base.Source): parentImage = None for imagetagid in imagelist: templateImage = templatedir + "/" + imagetagid + "/template.qcow2" - cmd = ["qemu-img","create","-f","qcow2"] + cmd = ["qemu-img", "create", "-f", "qcow2"] if parentImage is not None: cmd.append("-o") cmd.append("backing_fmt=qcow2,backing_file=%s" % parentImage) @@ -657,7 +657,7 @@ class DockerSource(base.Source): tempfile = imagedir + "/" + sandboxname.split('/')[-1] + ".qcow2" if not os.path.exists(imagedir): os.makedirs(imagedir) - cmd = ["qemu-img","create","-q","-f","qcow2"] + cmd = ["qemu-img", "create", "-q", "-f", "qcow2"] cmd.append("-o") cmd.append("backing_fmt=qcow2,backing_file=%s" % diskfile) cmd.append(tempfile) diff --git a/libvirt_sandbox_image/sources/virtbuilder.py b/libvirt_sandbox_image/sources/virtbuilder.py index ba554e8..5e723e6 100755 --- a/libvirt_sandbox_image/sources/virtbuilder.py +++ b/libvirt_sandbox_image/sources/virtbuilder.py @@ -93,7 +93,7 @@ class VirtBuilderSource(base.Source): def get_command(self, template, templatedir, userargs): return userargs - def get_disk(self,template, templatedir, imagedir, sandboxname): + def get_disk(self, template, templatedir, imagedir, sandboxname): diskfile = "%s/%s.qcow2" % (templatedir, self._get_template_name(template)) tempfile = imagedir + "/" + sandboxname + ".qcow2" if not os.path.exists(imagedir): @@ -105,5 +105,5 @@ class VirtBuilderSource(base.Source): subprocess.check_call(cmd) return tempfile - def get_env(self,template, templatedir): + def get_env(self, template, templatedir): return [] diff --git a/libvirt_sandbox_image/template.py b/libvirt_sandbox_image/template.py index 25c43e6..a69ef53 100644 --- a/libvirt_sandbox_image/template.py +++ b/libvirt_sandbox_image/template.py @@ -71,7 +71,7 @@ class Template(object): classimpl = getattr(mod, classname) return classimpl() except Exception as e: - print (e) + print(e) raise Exception("Invalid source: '%s'" % source) def get_source_impl(self): @@ -120,7 +120,7 @@ class Template(object): if o.query is not None and o.query != "": for param in o.query.split("&"): (key, val) = param.split("=") - query[key] = val + query[key] = val return klass(source, protocol, o.hostname, o.port, o.username, o.password, diff --git a/setup.py b/setup.py index dd22fd5..0b16ae7 100644 --- a/setup.py +++ b/setup.py @@ -96,10 +96,10 @@ setup( "libvirt_sandbox_image/sources" ], install_requires=[], - cmdclass = { + cmdclass={ 'build': my_build, }, - classifiers = [ + classifiers=[ "License :: OSI Approved :: GNU Lesser General Public License v2 or later (LGPLv2+)", "Programming Language :: Python", "Programming Language :: Python :: 3", -- 2.14.3 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list