aboutsummaryrefslogtreecommitdiffstats
path: root/src/intel
diff options
context:
space:
mode:
authorMathieu Bridon <[email protected]>2018-07-06 12:20:26 +0200
committerDylan Baker <[email protected]>2018-07-24 11:07:04 -0700
commit5530cb1296cef759ea2f94e581da0a4d853a9f5f (patch)
tree58a8bd7809d98f0fc8425615282b56b64c059086 /src/intel
parentfdf946ffbfa23afde1b42fd8a342f5c42e413cc0 (diff)
python: Better iterate over dictionaries
In Python 2, dictionaries have 2 sets of methods to iterate over their keys and values: keys()/values()/items() and iterkeys()/itervalues()/iteritems(). The former return lists while the latter return iterators. Python 3 dropped the method which return lists, and renamed the methods returning iterators to keys()/values()/items(). Using those names makes the scripts compatible with both Python 2 and 3. Signed-off-by: Mathieu Bridon <[email protected]> Reviewed-by: Eric Engestrom <[email protected]> Reviewed-by: Dylan Baker <[email protected]>
Diffstat (limited to 'src/intel')
-rw-r--r--src/intel/genxml/gen_bits_header.py10
-rw-r--r--src/intel/vulkan/anv_entrypoints_gen.py2
2 files changed, 6 insertions, 6 deletions
diff --git a/src/intel/genxml/gen_bits_header.py b/src/intel/genxml/gen_bits_header.py
index faba79dcd34..e31e9ff1035 100644
--- a/src/intel/genxml/gen_bits_header.py
+++ b/src/intel/genxml/gen_bits_header.py
@@ -108,13 +108,13 @@ ${item.token_name}_${prop}(const struct gen_device_info *devinfo)
#ifdef __cplusplus
extern "C" {
#endif
-% for _, container in sorted(containers.iteritems(), key=itemgetter(0)):
+% for _, container in sorted(containers.items(), key=itemgetter(0)):
/* ${container.name} */
${emit_per_gen_prop_func(container, 'length')}
-% for _, field in sorted(container.fields.iteritems(), key=itemgetter(0)):
+% for _, field in sorted(container.fields.items(), key=itemgetter(0)):
/* ${container.name}::${field.name} */
@@ -220,7 +220,7 @@ class Container(object):
def iter_prop(self, prop):
if prop == 'length':
- return self.length_by_gen.iteritems()
+ return self.length_by_gen.items()
else:
raise ValueError('Invalid property: "{0}"'.format(prop))
@@ -253,9 +253,9 @@ class Field(object):
def iter_prop(self, prop):
if prop == 'bits':
- return self.bits_by_gen.iteritems()
+ return self.bits_by_gen.items()
elif prop == 'start':
- return self.start_by_gen.iteritems()
+ return self.start_by_gen.items()
else:
raise ValueError('Invalid property: "{0}"'.format(prop))
diff --git a/src/intel/vulkan/anv_entrypoints_gen.py b/src/intel/vulkan/anv_entrypoints_gen.py
index db350698501..8a373364961 100644
--- a/src/intel/vulkan/anv_entrypoints_gen.py
+++ b/src/intel/vulkan/anv_entrypoints_gen.py
@@ -504,7 +504,7 @@ def get_entrypoints(doc, entrypoints_to_defines, start_index):
assert e.core_version is None
e.extensions.append(ext)
- return [e for e in entrypoints.itervalues() if e.enabled]
+ return [e for e in entrypoints.values() if e.enabled]
def get_entrypoints_defines(doc):