[libvirt] [PATCH sandbox-image 8/9] cli: Remove redundant global statements

Radostin Stoyanov rstoyanov1 at gmail.com
Wed Apr 18 20:57:46 UTC 2018


The global statement is needed for assignment of variables in global
scope [1]. In this case, we only read the value of those variables,
therefore we do not need to explicitly use the global statement.

[1] https://docs.python.org/3/reference/simple_stmts.html#the-global-statement

Signed-off-by: Radostin Stoyanov <rstoyanov1 at gmail.com>
---
 libvirt_sandbox_image/cli.py | 2 --
 1 file changed, 2 deletions(-)

diff --git a/libvirt_sandbox_image/cli.py b/libvirt_sandbox_image/cli.py
index e96d422..95c5147 100644
--- a/libvirt_sandbox_image/cli.py
+++ b/libvirt_sandbox_image/cli.py
@@ -167,13 +167,11 @@ def requires_connect(parser):
                         help=_("Connect string for libvirt"))
 
 def requires_template_dir(parser):
-    global default_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",
                         default=default_image_dir,
                         help=_("Image directory for saving images"))
-- 
2.14.3




More information about the libvir-list mailing list