]> code.ossystems Code Review - openembedded-core.git/commitdiff
wic: code cleanup: superfluous-parens
authorEd Bartosh <ed.bartosh@linux.intel.com>
Wed, 17 Jun 2015 11:47:47 +0000 (14:47 +0300)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Tue, 23 Jun 2015 10:38:16 +0000 (11:38 +0100)
Removed unncecessary parents after 'if' 'del' and 'print' keywords.
Fixed pyling warning: Unnecessary parens after 'xxx' keyword

Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
scripts/lib/image/engine.py
scripts/lib/image/help.py
scripts/lib/wic/3rdparty/pykickstart/options.py
scripts/lib/wic/kickstart/custom_commands/partition.py
scripts/lib/wic/plugin.py
scripts/lib/wic/plugins/source/fsimage.py
scripts/lib/wic/plugins/source/rawcopy.py
scripts/lib/wic/utils/oe/misc.py

index 05c26386e788252f7124fafa4e624503213d29a8..c568d695df09b6948c92262ecd851ff7b9cd53dd 100644 (file)
@@ -70,13 +70,13 @@ def find_artifacts(image_name):
     rootfs_dir = kernel_dir = bootimg_dir = native_sysroot = ""
 
     for line in bitbake_env_lines.split('\n'):
-        if (misc.get_line_val(line, "IMAGE_ROOTFS")):
+        if misc.get_line_val(line, "IMAGE_ROOTFS"):
             rootfs_dir = misc.get_line_val(line, "IMAGE_ROOTFS")
             continue
-        if (misc.get_line_val(line, "DEPLOY_DIR_IMAGE")):
+        if misc.get_line_val(line, "DEPLOY_DIR_IMAGE"):
             kernel_dir = misc.get_line_val(line, "DEPLOY_DIR_IMAGE")
             continue
-        if (misc.get_line_val(line, "STAGING_DIR_NATIVE")):
+        if misc.get_line_val(line, "STAGING_DIR_NATIVE"):
             native_sysroot = misc.get_line_val(line, "STAGING_DIR_NATIVE")
             continue
 
index 93211498d5601d09d2ca59b9639f221763442e48..886437ba6046d07dcfc7538d4f2c6a64374d046f 100644 (file)
@@ -53,7 +53,7 @@ def wic_help(args, usage_str, subcommands):
     Subcommand help dispatcher.
     """
     if len(args) == 1 or not display_help(args[1], subcommands):
-        print(usage_str)
+        print usage_str
 
 
 def get_wic_plugins_help():
index b2d8e3e51615cdbd844a218759154271fd8cfc15..ebc23eda63c20459f24910e583d03e07dbdf4a4e 100644 (file)
@@ -145,19 +145,19 @@ def _check_string(option, opt, value):
 
 def _check_size(option, opt, value):
     # Former default was MB
-    if (value.isdigit()):
+    if value.isdigit():
         return int(value) * 1024L
 
     mapping = {"opt": opt, "value": value}
-    if (not value[:-1].isdigit()):
+    if not value[:-1].isdigit():
         raise OptionValueError(_("Option %(opt)s: invalid size value: %(value)r") % mapping)
 
     size = int(value[:-1])
-    if (value.endswith("k") or value.endswith("K")):
+    if value.endswith("k") or value.endswith("K"):
         return size
-    if (value.endswith("M")):
+    if value.endswith("M"):
         return size * 1024L
-    if (value.endswith("G")):
+    if value.endswith("G"):
         return size * 1024L * 1024L
     raise OptionValueError(_("Option %(opt)s: invalid size value: %(value)r") % mapping)
 
index 40c27729149ebf522c4840865db380b8eba2d58a..324ea690ec23c821d96476cbe1577bc26479e6d9 100644 (file)
@@ -268,7 +268,7 @@ class Wic_PartData(Mic_PartData):
         extra_imagecmd = "-i 8192"
 
         label_str = ""
-        if (self.label):
+        if self.label:
             label_str = "-L %s" % self.label
 
         mkfs_cmd = "mkfs.%s -F %s %s %s -d %s" % \
@@ -315,7 +315,7 @@ class Wic_PartData(Mic_PartData):
         exec_cmd(dd_cmd)
 
         label_str = ""
-        if (self.label):
+        if self.label:
             label_str = "-L %s" % self.label
 
         mkfs_cmd = "mkfs.%s -b %d -r %s %s %s" % \
@@ -361,7 +361,7 @@ class Wic_PartData(Mic_PartData):
             blocks += (16 - (blocks % 16))
 
         label_str = "-n boot"
-        if (self.label):
+        if self.label:
             label_str = "-n %s" % self.label
 
         dosfs_cmd = "mkdosfs %s -S 512 -C %s %d" % (label_str, rootfs, blocks)
@@ -436,7 +436,7 @@ class Wic_PartData(Mic_PartData):
         extra_imagecmd = "-i 8192"
 
         label_str = ""
-        if (self.label):
+        if self.label:
             label_str = "-L %s" % self.label
 
         mkfs_cmd = "mkfs.%s -F %s %s %s" % \
@@ -460,7 +460,7 @@ class Wic_PartData(Mic_PartData):
         exec_cmd(dd_cmd)
 
         label_str = ""
-        if (self.label):
+        if self.label:
             label_str = "-L %s" % self.label
 
         mkfs_cmd = "mkfs.%s -b %d %s %s" % \
@@ -482,7 +482,7 @@ class Wic_PartData(Mic_PartData):
         blocks = self.size
 
         label_str = "-n boot"
-        if (self.label):
+        if self.label:
             label_str = "-n %s" % self.label
 
         dosfs_cmd = "mkdosfs %s -S 512 -C %s %d" % (label_str, fs, blocks)
@@ -553,7 +553,7 @@ class Wic_Partition(Mic_Partition):
 
     def _getParser(self):
         def overhead_cb (option, opt_str, value, parser):
-            if (value < 1):
+            if value < 1:
                 raise OptionValueError("Option %s: invalid value: %r" % (option, value))
             setattr(parser.values, option.dest, value)
 
index 9872d209854c2498a13359c3e2353f539a92796d..fff02c063bf022e891e41219a9a823997eac9031 100644 (file)
@@ -103,7 +103,7 @@ class PluginMgr(object):
                                 % (os.path.basename(pdir), mod, err)
                             msger.warning(msg)
 
-            del(sys.path[0])
+            del sys.path[0]
 
     def get_plugins(self, ptype):
         """ the return value is dict of name:class pairs """
index 98f02a1e097a743f44a1d7b34c97a1ecbf0fb78d..f894e893677501aa5c1378f149b0cc97a5161a27 100644 (file)
@@ -62,7 +62,7 @@ class FSImagePlugin(SourcePlugin):
 
         msger.debug('Bootimg dir: %s' % bootimg_dir)
 
-        if ('file' not in source_params):
+        if 'file' not in source_params:
             msger.error("No file specified\n")
             return
 
index 071b2d2032748626a53f16620e5c1740efe27f21..f0691baa91db2a5ab5fd8ba4bf50ec154dd610bf 100644 (file)
@@ -62,14 +62,14 @@ class RawCopyPlugin(SourcePlugin):
 
         msger.debug('Bootimg dir: %s' % bootimg_dir)
 
-        if ('file' not in source_params):
+        if 'file' not in source_params:
             msger.error("No file specified\n")
             return
 
         src = os.path.join(bootimg_dir, source_params['file'])
         dst = src
 
-        if ('skip' in source_params):
+        if 'skip' in source_params:
             dst = os.path.join(cr_workdir, source_params['file'])
             dd_cmd = "dd if=%s of=%s ibs=%s skip=1 conv=notrunc" % \
                     (src, dst, source_params['skip'])
index f08ff15a3461e3b2acc96dfe761c6557e3e4569e..2f916ddf45c034ed0ba4afbe0e66a9af01e75b3a 100644 (file)
@@ -38,7 +38,7 @@ def __exec_cmd(cmd_and_args, as_shell=False, catch=3):
     args = cmd_and_args.split()
     msger.debug(args)
 
-    if (as_shell):
+    if as_shell:
         rc, out = runner.runtool(cmd_and_args, catch)
     else:
         rc, out = runner.runtool(args, catch)
@@ -142,7 +142,7 @@ def find_artifact(bitbake_env_lines, variable):
     retval = ""
 
     for line in bitbake_env_lines.split('\n'):
-        if (get_line_val(line, variable)):
+        if get_line_val(line, variable):
             retval = get_line_val(line, variable)
             break
 
@@ -160,7 +160,7 @@ def get_line_val(line, key):
 
 def get_bitbake_var(key):
     for line in __bitbake_env_lines.split('\n'):
-        if (get_line_val(line, key)):
+        if get_line_val(line, key):
             val = get_line_val(line, key)
             return val
     return None