From e09c0a2bca45016daee064669ef5b1c9a748a566 Mon Sep 17 00:00:00 2001 From: Simon Feltman Date: Mon, 28 Apr 2014 22:57:00 -0700 Subject: giscanner: Use items() instead of iteritems() Replace usage of iteritems() and itervalues() with items() and values() respectively. https://bugzilla.gnome.org/show_bug.cgi?id=679438 --- giscanner/ast.py | 10 +++++----- giscanner/codegen.py | 2 +- giscanner/docwriter.py | 4 ++-- giscanner/gdumpparser.py | 10 +++++----- giscanner/girwriter.py | 2 +- giscanner/maintransformer.py | 8 ++++---- giscanner/sectionparser.py | 2 +- giscanner/shlibs.py | 2 +- giscanner/transformer.py | 6 +++--- 9 files changed, 23 insertions(+), 23 deletions(-) diff --git a/giscanner/ast.py b/giscanner/ast.py index 405a71fd..9f1e4cc0 100644 --- a/giscanner/ast.py +++ b/giscanner/ast.py @@ -463,11 +463,11 @@ functions via get_by_symbol().""" def __iter__(self): return iter(self.names) - def iteritems(self): - return self.names.iteritems() + def items(self): + return self.names.items() - def itervalues(self): - return self.names.itervalues() + def values(self): + return self.names.values() def get(self, name): return self.names.get(name) @@ -479,7 +479,7 @@ functions via get_by_symbol().""" return self.symbols.get(symbol) def walk(self, callback): - for node in self.itervalues(): + for node in self.values(): node.walk(callback, []) diff --git a/giscanner/codegen.py b/giscanner/codegen.py index fcf1fc51..20e087b4 100644 --- a/giscanner/codegen.py +++ b/giscanner/codegen.py @@ -164,7 +164,7 @@ class CCodeGenerator(object): self._codegen_start() - for node in self.namespace.itervalues(): + for node in self.namespace.values(): if isinstance(node, ast.Function): with self._function(node): body = self._function_bodies.get(node) diff --git a/giscanner/docwriter.py b/giscanner/docwriter.py index 86e11dd0..8052a424 100644 --- a/giscanner/docwriter.py +++ b/giscanner/docwriter.py @@ -131,7 +131,7 @@ class TemplatedScanner(object): groupdict = match.groupdict() properties = {name: groupdict.pop(name)} name = name + "_" - for group, value in groupdict.iteritems(): + for group, value in groupdict.items(): if group.startswith(name): key = group[len(name):] properties[key] = value @@ -435,7 +435,7 @@ class DocFormatter(object): node_name = node.namespace.name + '.' + node.name impl = [] - for c in node.namespace.itervalues(): + for c in node.namespace.values(): if not isinstance(c, ast.Class): continue for implemented in c.interfaces: diff --git a/giscanner/gdumpparser.py b/giscanner/gdumpparser.py index ebd33f98..405ce28c 100644 --- a/giscanner/gdumpparser.py +++ b/giscanner/gdumpparser.py @@ -84,12 +84,12 @@ class GDumpParser(object): """ # First pass: parsing - for node in self._namespace.itervalues(): + for node in self._namespace.values(): if isinstance(node, ast.Function): self._initparse_function(node) if self._namespace.name == 'GObject' or self._namespace.name == 'GLib': - for node in self._namespace.itervalues(): + for node in self._namespace.values(): if isinstance(node, ast.Record): self._initparse_gobject_record(node) @@ -116,16 +116,16 @@ class GDumpParser(object): self._introspect_type(child) # Pair up boxed types and class records - for name, boxed in self._boxed_types.iteritems(): + for name, boxed in self._boxed_types.items(): self._pair_boxed_type(boxed) - for node in self._namespace.itervalues(): + for node in self._namespace.values(): if isinstance(node, (ast.Class, ast.Interface)): self._find_class_record(node) # Clear the _get_type functions out of the namespace; # Anyone who wants them can get them from the ast.Class/Interface/Boxed to_remove = [] - for name, node in self._namespace.iteritems(): + for name, node in self._namespace.items(): if isinstance(node, ast.Registered) and node.get_type is not None: get_type_name = node.get_type if get_type_name == 'intern': diff --git a/giscanner/girwriter.py b/giscanner/girwriter.py index 3bea2a1c..1af1ba5c 100644 --- a/giscanner/girwriter.py +++ b/giscanner/girwriter.py @@ -88,7 +88,7 @@ class GIRWriter(XMLWriter): return 1 else: return cmp(a, b) - for node in sorted(namespace.itervalues(), cmp=nscmp): + for node in sorted(namespace.values(), cmp=nscmp): self._write_node(node) def _write_node(self, node): diff --git a/giscanner/maintransformer.py b/giscanner/maintransformer.py index 2871abac..f2949822 100644 --- a/giscanner/maintransformer.py +++ b/giscanner/maintransformer.py @@ -74,14 +74,14 @@ class MainTransformer(object): self._namespace.walk(self._pass_type_resolution) # Generate a reverse mapping "bar_baz" -> BarBaz - for node in self._namespace.itervalues(): + for node in self._namespace.values(): if isinstance(node, ast.Registered) and node.get_type is not None: self._uscore_type_names[node.c_symbol_prefix] = node elif isinstance(node, (ast.Record, ast.Union)): uscored = to_underscores_noprefix(node.name).lower() self._uscore_type_names[uscored] = node - for node in list(self._namespace.itervalues()): + for node in list(self._namespace.values()): if isinstance(node, ast.Function): # Discover which toplevel functions are actually methods self._pair_function(node) @@ -980,14 +980,14 @@ the ones that failed to resolve removed.""" # but only covers enums that are registered as GObject enums. # Create a fallback mapping based on all known enums in this module. uscore_enums = {} - for enum in self._namespace.itervalues(): + for enum in self._namespace.values(): if not isinstance(enum, ast.Enum): continue uscored = to_underscores_noprefix(enum.name).lower() uscore_enums[uscored] = enum uscore_enums[enum.name] = enum - for node in self._namespace.itervalues(): + for node in self._namespace.values(): if not isinstance(node, ast.ErrorQuarkFunction): continue full = node.symbol[:-len('_quark')] diff --git a/giscanner/sectionparser.py b/giscanner/sectionparser.py index ffe41afc..ed4660fe 100644 --- a/giscanner/sectionparser.py +++ b/giscanner/sectionparser.py @@ -134,7 +134,7 @@ def generate_sections_file(transformer): general_section = new_section("main", "Main") - for node in ns.itervalues(): + for node in ns.values(): if isinstance(node, ast.Function): append_symbol(general_section, node.symbol) elif isinstance(node, (ast.Class, ast.Interface)): diff --git a/giscanner/shlibs.py b/giscanner/shlibs.py index 838d3430..cd0c10f1 100644 --- a/giscanner/shlibs.py +++ b/giscanner/shlibs.py @@ -111,7 +111,7 @@ def _resolve_non_libtool(options, binary, libraries): shlibs = [] for line in proc.stdout: - for library, pattern in patterns.iteritems(): + for library, pattern in patterns.items(): m = pattern.search(line) if m: del patterns[library] diff --git a/giscanner/transformer.py b/giscanner/transformer.py index 2d5c04d7..133edd4b 100644 --- a/giscanner/transformer.py +++ b/giscanner/transformer.py @@ -116,7 +116,7 @@ class Transformer(object): # Run through the tag namespace looking for structs that have not been # promoted into the main namespace. In this case we simply promote them # with their struct tag. - for tag_name, struct in self._tag_ns.iteritems(): + for tag_name, struct in self._tag_ns.items(): if not struct.name: try: name = self.strip_identifier(tag_name) @@ -235,7 +235,7 @@ None.""" """Return an iterator over all included namespaces; the currently-scanned namespace is first.""" yield self._namespace - for ns in self._parsed_includes.itervalues(): + for ns in self._parsed_includes.values(): yield ns def _sort_matches(self, x, y): @@ -906,7 +906,7 @@ Note that type resolution may not succeed.""" # which has nominal namespace of "Meta", but a few classes are # "Mutter". We don't export that data in introspection currently. # Basically the library should be fixed, but we'll hack around it here. - for namespace in self._parsed_includes.itervalues(): + for namespace in self._parsed_includes.values(): target = namespace.get_by_ctype(pointer_stripped) if target: typeval.target_giname = '%s.%s' % (namespace.name, target.name) -- cgit v1.2.1