diff options
author | Ed Bartosh <ed.bartosh@linux.intel.com> | 2016-05-04 16:06:16 +0300 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2016-05-14 07:26:42 +0100 |
commit | 003df7dfb932c551953fbf1bd769b3c31bd16fb4 (patch) | |
tree | a508854a79bc7d7a741047e51cd8a7c27c5ea4fe /scripts/lib/wic | |
parent | 5b14eb8d68aaca82de4f8f6bcb28ad6f4a5125d0 (diff) | |
download | openembedded-core-003df7dfb932c551953fbf1bd769b3c31bd16fb4.tar.gz openembedded-core-003df7dfb932c551953fbf1bd769b3c31bd16fb4.tar.bz2 openembedded-core-003df7dfb932c551953fbf1bd769b3c31bd16fb4.zip |
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]
Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts/lib/wic')
-rw-r--r-- | scripts/lib/wic/imager/baseimager.py | 2 | ||||
-rw-r--r-- | scripts/lib/wic/plugin.py | 2 | ||||
-rw-r--r-- | scripts/lib/wic/utils/partitionedfs.py | 6 |
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): } # update setting from createopts - for key in createopts.keys(): + for key in createopts: if key in optmap: option = optmap[key] 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): return_methods = None for _source_name, klass in self.get_plugins('source').items(): if _source_name == source_name: - for _method_name in methods.keys(): + for _method_name in methods: if not hasattr(klass, _method_name): msger.warning("Unimplemented %s source interface for: %s"\ % (_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): for num in range(len(self.partitions)): part = self.partitions[num] - if not self.disks.has_key(part['disk_name']): + if part['disk_name'] not in self.disks: raise ImageError("No disk %s for partition %s" \ % (part['disk_name'], part['mountpoint'])) @@ -236,7 +236,7 @@ class Image(object): def __format_disks(self): self.layout_partitions() - for dev in self.disks.keys(): + for dev in self.disks: disk = self.disks[dev] msger.debug("Initializing partition table for %s" % \ (disk['disk'].device)) @@ -354,7 +354,7 @@ class Image(object): os.rename(source, image_file + '.p%d' % part['num']) def create(self): - for dev in self.disks.keys(): + for dev in self.disks: disk = self.disks[dev] disk['disk'].create() |