summaryrefslogtreecommitdiff
path: root/giscanner/girwriter.py
diff options
context:
space:
mode:
authorDieter Verfaillie <dieterv@optionexplicit.be>2013-04-24 14:06:18 +0200
committerDieter Verfaillie <dieterv@optionexplicit.be>2013-05-07 23:38:22 +0200
commitc9e2d880011c530ff1454fe31a2d40d189860be5 (patch)
tree9acdf7d7cf409ffd8d0f7967ebf9d03497d31269 /giscanner/girwriter.py
parenta031129d8ab28e2f51e95e7266f1274bdc592557 (diff)
downloadgobject-introspection-c9e2d880011c530ff1454fe31a2d40d189860be5.tar.gz
tests: Update misc/pep8.py to 1.4.5
Version in our tree is a wee bit outdated. For example, later work will introduce an utf8 encoded python source file which our old pep8.py does not yet understand (yeah, it really was *that* ancient)... Updated from: https://raw.github.com/jcrocholl/pep8/1.4.5/pep8.py Takes 552c1f1525e37a30376790151c1ba437776682c5, f941537d1c0a40f0906490ed160db6c79af572d3, 5a4afe2a77d0ff7d9fea13dd93c3304a6ca993de and a17f157e19bd6792c00321c8020dca5e5a281f45 into account... https://bugzilla.gnome.org/show_bug.cgi?id=699535
Diffstat (limited to 'giscanner/girwriter.py')
-rw-r--r--giscanner/girwriter.py21
1 files changed, 10 insertions, 11 deletions
diff --git a/giscanner/girwriter.py b/giscanner/girwriter.py
index 2578a331..e7af2533 100644
--- a/giscanner/girwriter.py
+++ b/giscanner/girwriter.py
@@ -28,14 +28,15 @@ from .xmlwriter import XMLWriter
# Compatible changes we just make inline
COMPATIBLE_GIR_VERSION = '1.2'
+
class GIRWriter(XMLWriter):
def __init__(self, namespace):
super(GIRWriter, self).__init__()
self.write_comment(
-'''This file was automatically generated from C sources - DO NOT EDIT!
-To affect the contents of this file, edit the original C definitions,
-and/or use gtk-doc annotations. ''')
+ 'This file was automatically generated from C sources - DO NOT EDIT!\n'
+ 'To affect the contents of this file, edit the original C definitions,\n'
+ 'and/or use gtk-doc annotations. ')
self._write_repository(namespace)
def _write_repository(self, namespace):
@@ -43,8 +44,7 @@ and/or use gtk-doc annotations. ''')
('version', COMPATIBLE_GIR_VERSION),
('xmlns', 'http://www.gtk.org/introspection/core/1.0'),
('xmlns:c', 'http://www.gtk.org/introspection/c/1.0'),
- ('xmlns:glib', 'http://www.gtk.org/introspection/glib/1.0'),
- ]
+ ('xmlns:glib', 'http://www.gtk.org/introspection/glib/1.0')]
with self.tagcontext('repository', attrs):
for include in sorted(namespace.includes):
self._write_include(include)
@@ -292,8 +292,8 @@ and/or use gtk-doc annotations. ''')
attrs.append(('fixed-size', '%d' % (ntype.size, )))
if ntype.length_param_name is not None:
assert function
- attrs.insert(0, ('length', '%d'
- % (function.get_parameter_index(ntype.length_param_name, ))))
+ length = function.get_parameter_index(ntype.length_param_name)
+ attrs.insert(0, ('length', '%d' % (length, )))
with self.tagcontext('array', attrs):
self._write_type(ntype.element_type)
@@ -482,7 +482,7 @@ and/or use gtk-doc annotations. ''')
attrs = list(extra_attrs)
if record.name is not None:
attrs.append(('name', record.name))
- if record.ctype is not None: # the record might be anonymous
+ if record.ctype is not None: # the record might be anonymous
attrs.append(('c:type', record.ctype))
if record.disguised:
attrs.append(('disguised', '1'))
@@ -513,7 +513,7 @@ and/or use gtk-doc annotations. ''')
attrs = []
if union.name is not None:
attrs.append(('name', union.name))
- if union.ctype is not None: # the union might be anonymous
+ if union.ctype is not None: # the union might be anonymous
attrs.append(('c:type', union.ctype))
self._append_version(union, attrs)
self._append_node_generic(union, attrs)
@@ -544,8 +544,7 @@ and/or use gtk-doc annotations. ''')
elif isinstance(field.anonymous_node, ast.Union):
self._write_union(field.anonymous_node)
else:
- raise AssertionError("Unknown field anonymous: %r" \
- % (field.anonymous_node, ))
+ raise AssertionError("Unknown field anonymous: %r" % (field.anonymous_node, ))
else:
attrs = [('name', field.name)]
self._append_node_generic(field, attrs)