mirror of
https://git.yoctoproject.org/poky
synced 2026-06-12 04:40:24 +00:00
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>
This commit is contained in:
committed by
Richard Purdie
parent
e36d04abb7
commit
52ce79dcba
@@ -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()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user