summaryrefslogtreecommitdiff
path: root/giscanner/xmlwriter.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/xmlwriter.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/xmlwriter.py')
-rwxr-xr-xgiscanner/xmlwriter.py18
1 files changed, 8 insertions, 10 deletions
diff --git a/giscanner/xmlwriter.py b/giscanner/xmlwriter.py
index 4a1dc9fb..6efe684d 100755
--- a/giscanner/xmlwriter.py
+++ b/giscanner/xmlwriter.py
@@ -44,8 +44,7 @@ def _calc_attrs_length(attributes, indent, self_indent):
return attr_length + indent + self_indent
-def collect_attributes(tag_name, attributes, self_indent,
- self_indent_char, indent=-1):
+def collect_attributes(tag_name, attributes, self_indent, self_indent_char, indent=-1):
if not attributes:
return ''
if _calc_attrs_length(attributes, indent, self_indent) > 79:
@@ -68,6 +67,7 @@ def collect_attributes(tag_name, attributes, self_indent,
first = False
return attr_value
+
def build_xml_tag(tag_name, attributes=None, data=None, self_indent=0,
self_indent_char=' '):
if attributes is None:
@@ -86,6 +86,7 @@ def build_xml_tag(tag_name, attributes=None, data=None, self_indent=0,
len(prefix) + len(suffix))
return prefix + attrs + suffix
+
with LibtoolImporter(None, None):
if 'UNINSTALLED_INTROSPECTION_SRCDIR' in os.environ:
from _giscanner import collect_attributes
@@ -108,10 +109,8 @@ class XMLWriter(object):
def _open_tag(self, tag_name, attributes=None):
if attributes is None:
attributes = []
- attrs = collect_attributes(
- tag_name, attributes, self._indent,
- self._indent_char,
- len(tag_name) + 2)
+ attrs = collect_attributes(tag_name, attributes,
+ self._indent, self._indent_char, len(tag_name) + 2)
self.write_line(u'<%s%s>' % (tag_name, attrs))
def _close_tag(self, tag_name):
@@ -137,10 +136,9 @@ class XMLWriter(object):
if do_escape:
line = escape(line)
if indent:
- self._data.write('%s%s%s' % (
- self._indent_char * self._indent,
- line.encode('utf-8'),
- self._newline_char))
+ self._data.write('%s%s%s' % (self._indent_char * self._indent,
+ line.encode('utf-8'),
+ self._newline_char))
else:
self._data.write('%s%s' % (line.encode('utf-8'), self._newline_char))