summaryrefslogtreecommitdiffstats
path: root/scripts/lib
diff options
context:
space:
mode:
authorEd Bartosh <ed.bartosh@linux.intel.com>2016-05-04 16:06:16 +0300
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-05-14 23:05:13 +0100
commit52ce79dcba4c161509a6cc3ee3afe5cd6a99d53f (patch)
tree305ca59109812b075e8eda7f637c60276ee51517 /scripts/lib
parente36d04abb724002be015e7ea0f776b0d326c9dcb (diff)
downloadpoky-52ce79dcba4c161509a6cc3ee3afe5cd6a99d53f.tar.gz
wic: don't use dict.keys and dict.has_key
Replaced calls of dict.keys and dict.has_key methods with the 'key in dict' statement. 'key in dict' is more pythonic, faster and readable. dict.has_key doesn't exist in Python 3. [YOCTO #9412] (From OE-Core rev: 003df7dfb932c551953fbf1bd769b3c31bd16fb4) Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts/lib')
-rw-r--r--scripts/lib/wic/imager/baseimager.py2
-rw-r--r--scripts/lib/wic/plugin.py2
-rw-r--r--scripts/lib/wic/utils/partitionedfs.py6
3 files changed, 5 insertions, 5 deletions
diff --git a/scripts/lib/wic/imager/baseimager.py b/scripts/lib/wic/imager/baseimager.py
index 760cf8a58a..557f536677 100644
--- a/scripts/lib/wic/imager/baseimager.py
+++ b/scripts/lib/wic/imager/baseimager.py
@@ -68,7 +68,7 @@ class BaseImageCreator(object):
68 } 68 }
69 69
70 # update setting from createopts 70 # update setting from createopts
71 for key in createopts.keys(): 71 for key in createopts:
72 if key in optmap: 72 if key in optmap:
73 option = optmap[key] 73 option = optmap[key]
74 else: 74 else:
diff --git a/scripts/lib/wic/plugin.py b/scripts/lib/wic/plugin.py
index 80c609cf8c..933647d7c7 100644
--- a/scripts/lib/wic/plugin.py
+++ b/scripts/lib/wic/plugin.py
@@ -137,7 +137,7 @@ class PluginMgr(object):
137 return_methods = None 137 return_methods = None
138 for _source_name, klass in self.get_plugins('source').items(): 138 for _source_name, klass in self.get_plugins('source').items():
139 if _source_name == source_name: 139 if _source_name == source_name:
140 for _method_name in methods.keys(): 140 for _method_name in methods:
141 if not hasattr(klass, _method_name): 141 if not hasattr(klass, _method_name):
142 msger.warning("Unimplemented %s source interface for: %s"\ 142 msger.warning("Unimplemented %s source interface for: %s"\
143 % (_method_name, _source_name)) 143 % (_method_name, _source_name))
diff --git a/scripts/lib/wic/utils/partitionedfs.py b/scripts/lib/wic/utils/partitionedfs.py
index 534635b2ac..89a7c13758 100644
--- a/scripts/lib/wic/utils/partitionedfs.py
+++ b/scripts/lib/wic/utils/partitionedfs.py
@@ -132,7 +132,7 @@ class Image(object):
132 for num in range(len(self.partitions)): 132 for num in range(len(self.partitions)):
133 part = self.partitions[num] 133 part = self.partitions[num]
134 134
135 if not self.disks.has_key(part['disk_name']): 135 if part['disk_name'] not in self.disks:
136 raise ImageError("No disk %s for partition %s" \ 136 raise ImageError("No disk %s for partition %s" \
137 % (part['disk_name'], part['mountpoint'])) 137 % (part['disk_name'], part['mountpoint']))
138 138
@@ -236,7 +236,7 @@ class Image(object):
236 def __format_disks(self): 236 def __format_disks(self):
237 self.layout_partitions() 237 self.layout_partitions()
238 238
239 for dev in self.disks.keys(): 239 for dev in self.disks:
240 disk = self.disks[dev] 240 disk = self.disks[dev]
241 msger.debug("Initializing partition table for %s" % \ 241 msger.debug("Initializing partition table for %s" % \
242 (disk['disk'].device)) 242 (disk['disk'].device))
@@ -354,7 +354,7 @@ class Image(object):
354 os.rename(source, image_file + '.p%d' % part['num']) 354 os.rename(source, image_file + '.p%d' % part['num'])
355 355
356 def create(self): 356 def create(self):
357 for dev in self.disks.keys(): 357 for dev in self.disks:
358 disk = self.disks[dev] 358 disk = self.disks[dev]
359 disk['disk'].create() 359 disk['disk'].create()
360 360