[gobject-introspection] giscanner: simplify the MainTransformer().transform() method
- From: Dieter Verfaillie <dieterv src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gobject-introspection] giscanner: simplify the MainTransformer().transform() method
- Date: Tue, 7 May 2013 14:07:51 +0000 (UTC)
commit 0dbd46680a7fac7ac74c2945e23b95dd04ff79dc
Author: Dieter Verfaillie <dieterv optionexplicit be>
Date: Thu Apr 25 17:08:56 2013 +0200
giscanner: simplify the MainTransformer().transform() method
The ast.Namespace.names instance attribute is an OrderedDict
which itself is a specialised dict() subclass. There are any
number of ways to test if a dict() is empty or not. Creating
a copy of it's keys by iterating over them just to count the
number of items in the copy is not the most elegant way though.
https://bugzilla.gnome.org/show_bug.cgi?id=699533
giscanner/maintransformer.py | 10 ++++------
1 files changed, 4 insertions(+), 6 deletions(-)
---
diff --git a/giscanner/maintransformer.py b/giscanner/maintransformer.py
index 6cf5a00..d2a8be7 100644
--- a/giscanner/maintransformer.py
+++ b/giscanner/maintransformer.py
@@ -48,12 +48,10 @@ class MainTransformer(object):
# Public API
def transform(self):
- contents = list(self._namespace.itervalues())
- if len(contents) == 0:
- message.fatal("""Namespace is empty; likely causes are:
-* Not including .h files to be scanned
-* Broken --identifier-prefix
-""")
+ if not self._namespace.names:
+ message.fatal('Namespace is empty; likely causes are:\n'
+ '* Not including .h files to be scanned\n'
+ '* Broken --identifier-prefix')
# Some initial namespace surgery
self._namespace.walk(self._pass_fixup_hidden_fields)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]