summaryrefslogtreecommitdiff
path: root/giscanner/girparser.py
diff options
context:
space:
mode:
authorJohan Dahlin <johan@gnome.org>2008-08-14 09:28:38 +0000
committerJohan Dahlin <johan@src.gnome.org>2008-08-14 09:28:38 +0000
commitb0d43bbf08a9ebcba278af1601f0e83bdc78ff74 (patch)
treeeed0a4d393001f4dce1e46c2f89f99e63896bbf1 /giscanner/girparser.py
parente6d60320d8fa6493fa751021d4d26a6a48e46f7f (diff)
downloadgobject-introspection-b0d43bbf08a9ebcba278af1601f0e83bdc78ff74.tar.gz
Run pep8.py in make check, fix old errors.
2008-08-14 Johan Dahlin <johan@gnome.org> * giscanner/ast.py: * giscanner/girparser.py: * giscanner/glibtransformer.py: * tests/Makefile.am: Run pep8.py in make check, fix old errors. svn path=/trunk/; revision=366
Diffstat (limited to 'giscanner/girparser.py')
-rw-r--r--giscanner/girparser.py15
1 files changed, 5 insertions, 10 deletions
diff --git a/giscanner/girparser.py b/giscanner/girparser.py
index 05961ac7..a41e25fe 100644
--- a/giscanner/girparser.py
+++ b/giscanner/girparser.py
@@ -41,9 +41,11 @@ def _corens(tag):
def _glibns(tag):
return '{%s}%s' % (GLIB_NS, tag)
+
def _cns(tag):
return '{%s}%s' % (C_NS, tag)
+
class GIRParser(object):
def __init__(self, filename):
@@ -53,11 +55,9 @@ class GIRParser(object):
tree = parse(filename)
self._parse_api(tree.getroot())
-
def _add_node(self, node):
self._nodes.append(node)
-
def _parse_api(self, root):
assert root.tag == _corens('repository')
ns = root.find(_corens('namespace'))
@@ -78,7 +78,9 @@ class GIRParser(object):
self._parse_functions_props(child, c)
self._add_node(c)
if child.tag == _corens('interface'):
- c = GLibInterface(child.attrib['name'], child.attrib[_glibns('type-name')], child.attrib[_glibns('get-type')])
+ c = GLibInterface(child.attrib['name'],
+ child.attrib[_glibns('type-name')],
+ child.attrib[_glibns('get-type')])
self._parse_functions_props(child, c)
self._add_node(c)
if child.tag == _corens('record'):
@@ -91,11 +93,9 @@ class GIRParser(object):
]:
pass
-
def _parse_alias(self, child):
return Alias(child.attrib['name'], child.attrib['target'])
-
def _parse_functions_props(self, child, obj):
for meth in child.findall(_corens('method')):
obj.methods.append(self._parse_function(meth, Function))
@@ -104,7 +104,6 @@ class GIRParser(object):
for cb in child.findall(_corens('callback')):
obj.fields.append(self._parse_function(cb, Callback))
-
def _parse_function(self, child, klass):
retval = Return(self._parse_type(child.find(_corens('return-value'))))
params = []
@@ -123,18 +122,14 @@ class GIRParser(object):
args.append(ident)
return klass(*args)
-
def _parse_type(self, node):
typenode = node.find(_corens('type'))
if node is None:
raise ValueError("failed to find type")
return Type(typenode.attrib['name'], typenode.attrib[_cns('type')])
-
def get_namespace_name(self):
return self._namespace_name
-
def get_nodes(self):
return self._nodes
-