diff options
author | Dieter Verfaillie <dieterv@optionexplicit.be> | 2013-04-25 17:08:56 +0200 |
---|---|---|
committer | Dieter Verfaillie <dieterv@optionexplicit.be> | 2013-05-07 15:36:09 +0200 |
commit | 0dbd46680a7fac7ac74c2945e23b95dd04ff79dc (patch) | |
tree | cd608980a95960b804df5ff69fcce1d56c8fd823 /giscanner/maintransformer.py | |
parent | 44ff0d355021f527a518d320f403aa0717fd0bc8 (diff) | |
download | gobject-introspection-0dbd46680a7fac7ac74c2945e23b95dd04ff79dc.tar.gz |
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
Diffstat (limited to 'giscanner/maintransformer.py')
-rw-r--r-- | giscanner/maintransformer.py | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/giscanner/maintransformer.py b/giscanner/maintransformer.py index 6cf5a006..d2a8be7b 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) |