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 23:05:13 +0100 |
commit | 52ce79dcba4c161509a6cc3ee3afe5cd6a99d53f (patch) | |
tree | 305ca59109812b075e8eda7f637c60276ee51517 /scripts/lib/wic/utils/partitionedfs.py | |
parent | e36d04abb724002be015e7ea0f776b0d326c9dcb (diff) | |
download | poky-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/wic/utils/partitionedfs.py')
-rw-r--r-- | scripts/lib/wic/utils/partitionedfs.py | 6 |
1 files changed, 3 insertions, 3 deletions
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 | ||