summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohan Dahlin <johan@gnome.org>2008-08-09 13:07:11 +0000
committerJohan Dahlin <johan@src.gnome.org>2008-08-09 13:07:11 +0000
commite48a8b65b61dade42f23a3549ceb1b08afbe227b (patch)
treef4893526b9a90ce2a272255b6c8b8902d515cd08
parente714252256a2e0bbf47abeb38d83992069b3b17f (diff)
downloadgobject-introspection-e48a8b65b61dade42f23a3549ceb1b08afbe227b.tar.gz
PEP8ify
2008-08-09 Johan Dahlin <johan@gnome.org> * giscanner/__init__.py: * giscanner/ast.py: * giscanner/cgobject.py: * giscanner/gidlparser.py: * giscanner/gidlwriter.py: * giscanner/girparser.py: * giscanner/girwriter.py: * giscanner/glibast.py: * giscanner/glibtransformer.py: * giscanner/odict.py: * giscanner/sourcescanner.py: * giscanner/transformer.py: * giscanner/utils.py: * giscanner/xmlwriter.py: * tools/g-ir-scanner: PEP8ify svn path=/trunk/; revision=341
-rw-r--r--ChangeLog20
-rw-r--r--giscanner/__init__.py1
-rw-r--r--giscanner/ast.py65
-rw-r--r--giscanner/cgobject.py21
-rw-r--r--giscanner/gidlparser.py3
-rw-r--r--giscanner/gidlwriter.py1
-rw-r--r--giscanner/girparser.py5
-rw-r--r--giscanner/girwriter.py2
-rw-r--r--giscanner/glibast.py8
-rw-r--r--giscanner/glibtransformer.py5
-rw-r--r--giscanner/odict.py1
-rw-r--r--giscanner/sourcescanner.py17
-rw-r--r--giscanner/transformer.py15
-rw-r--r--giscanner/utils.py4
-rw-r--r--giscanner/xmlwriter.py11
-rwxr-xr-xtools/g-ir-scanner10
16 files changed, 135 insertions, 54 deletions
diff --git a/ChangeLog b/ChangeLog
index 343a29f2..a4007afa 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,25 @@
2008-08-09 Johan Dahlin <johan@gnome.org>
+ * giscanner/__init__.py:
+ * giscanner/ast.py:
+ * giscanner/cgobject.py:
+ * giscanner/gidlparser.py:
+ * giscanner/gidlwriter.py:
+ * giscanner/girparser.py:
+ * giscanner/girwriter.py:
+ * giscanner/glibast.py:
+ * giscanner/glibtransformer.py:
+ * giscanner/odict.py:
+ * giscanner/sourcescanner.py:
+ * giscanner/transformer.py:
+ * giscanner/utils.py:
+ * giscanner/xmlwriter.py:
+ * tools/g-ir-scanner:
+
+ PEP8ify
+
+2008-08-09 Johan Dahlin <johan@gnome.org>
+
* relaxng/api.xml:
* relaxng/c-types.xml:
* relaxng/g-types.xml:
diff --git a/giscanner/__init__.py b/giscanner/__init__.py
index 22797ada..02cf39a1 100644
--- a/giscanner/__init__.py
+++ b/giscanner/__init__.py
@@ -17,4 +17,3 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301, USA.
#
-
diff --git a/giscanner/ast.py b/giscanner/ast.py
index cf744a95..a0955c10 100644
--- a/giscanner/ast.py
+++ b/giscanner/ast.py
@@ -31,35 +31,35 @@ which is language/library/domain specific.
##
# Basic types
-TYPE_INT8 = 'int8'
-TYPE_UINT8 = 'uint8'
-TYPE_INT16 = 'int16'
-TYPE_UINT16 = 'uint16'
-TYPE_INT32 = 'int32'
-TYPE_UINT32 = 'uint32'
-TYPE_INT64 = 'int64'
-TYPE_UINT64 = 'uint64'
-TYPE_LONG = 'long'
-TYPE_ULONG = 'ulong'
+TYPE_INT8 = 'int8'
+TYPE_UINT8 = 'uint8'
+TYPE_INT16 = 'int16'
+TYPE_UINT16 = 'uint16'
+TYPE_INT32 = 'int32'
+TYPE_UINT32 = 'uint32'
+TYPE_INT64 = 'int64'
+TYPE_UINT64 = 'uint64'
+TYPE_LONG = 'long'
+TYPE_ULONG = 'ulong'
# Floating-point
-TYPE_FLOAT = 'float'
-TYPE_DOUBLE = 'double'
+TYPE_FLOAT = 'float'
+TYPE_DOUBLE = 'double'
# Higher-level data types
-TYPE_NONE = 'none'
-TYPE_ANY = 'any' # CORBA Any/Variant/GValue, holds anything.
-TYPE_BOOLEAN = 'boolean' # True/False
-TYPE_STRING = 'string' # Sequence of characters
+TYPE_NONE = 'none'
+TYPE_ANY = 'any' # CORBA Any/Variant/GValue, holds anything.
+TYPE_BOOLEAN = 'boolean' # True/False
+TYPE_STRING = 'string' # Sequence of characters
TYPE_SEQUENCE = 'sequence' # Sequence of something
-TYPE_CHAR = 'char' # Character
-TYPE_UCHAR = 'uchar' # Unsigned Character
-TYPE_SIZE = 'size' # Size type (memory, buffer etc)
-TYPE_SSIZE = 'ssize'
+TYPE_CHAR = 'char' # Character
+TYPE_UCHAR = 'uchar' # Unsigned Character
+TYPE_SIZE = 'size' # Size type (memory, buffer etc)
+TYPE_SSIZE = 'ssize'
# Wide/Unicode
-TYPE_UCHAR = 'uchar'
-TYPE_USTRING = 'ustring'
+TYPE_UCHAR = 'uchar'
+TYPE_USTRING = 'ustring'
# Domain specific, but practically useful
TYPE_FILENAME = 'filename'
@@ -106,6 +106,7 @@ class Node(object):
class Namespace(Node):
+
def __init__(self, name):
Node.__init__(self, name)
self.nodes = []
@@ -114,7 +115,9 @@ class Namespace(Node):
return '%s(%r, %r)' % (self.__class__.__name__, self.name,
self.nodes)
+
class Function(Node):
+
def __init__(self, name, retval, parameters, symbol):
Node.__init__(self, name)
self.retval = retval
@@ -132,12 +135,14 @@ class VFunction(Function):
class Type(Node):
+
def __init__(self, name, ctype=None):
Node.__init__(self, name)
self.ctype = ctype
class Parameter(Node):
+
def __init__(self, name, typenode):
Node.__init__(self, name)
self.type = typenode
@@ -150,6 +155,7 @@ class Parameter(Node):
class Enum(Node):
+
def __init__(self, name, symbol, members):
Node.__init__(self, name)
self.symbol = symbol
@@ -160,6 +166,7 @@ class Enum(Node):
class Member(Node):
+
def __init__(self, name, value, symbol):
Node.__init__(self, name)
self.value = value
@@ -170,6 +177,7 @@ class Member(Node):
class Struct(Node):
+
def __init__(self, name, symbol):
Node.__init__(self, name)
self.fields = []
@@ -177,6 +185,7 @@ class Struct(Node):
class Field(Node):
+
def __init__(self, name, typenode, symbol):
Node.__init__(self, name)
self.type = typenode
@@ -187,16 +196,18 @@ class Field(Node):
class Return(Node):
+
def __init__(self, rtype):
Node.__init__(self)
self.type = rtype
self.transfer = False
def __repr__(self):
- return 'Return(%r)' % (self.type,)
+ return 'Return(%r)' % (self.type, )
class Class(Node):
+
def __init__(self, name, parent):
Node.__init__(self, name)
self.ctype = name
@@ -213,6 +224,7 @@ class Class(Node):
class Interface(Node):
+
def __init__(self, name):
Node.__init__(self, name)
self.methods = []
@@ -226,6 +238,7 @@ class Interface(Node):
class Constant(Node):
+
def __init__(self, name, type_name, value):
Node.__init__(self, name)
self.type = Type(type_name)
@@ -237,6 +250,7 @@ class Constant(Node):
class Property(Node):
+
def __init__(self, name, type_name, ctype=None):
Node.__init__(self, name)
self.type = Type(type_name, ctype)
@@ -248,7 +262,10 @@ class Property(Node):
# FIXME: Inherit from Function
+
+
class Callback(Node):
+
def __init__(self, name, retval, parameters):
Node.__init__(self, name)
self.retval = retval
@@ -261,8 +278,8 @@ class Callback(Node):
class Sequence(Type):
# Subclass, because a Sequence is a kind of Type
+
def __init__(self, name, ctype, element_type):
Type.__init__(self, name, ctype)
self.element_type = element_type
self.transfer = False
-
diff --git a/giscanner/cgobject.py b/giscanner/cgobject.py
index 7fbe10b5..3244b6c2 100644
--- a/giscanner/cgobject.py
+++ b/giscanner/cgobject.py
@@ -51,6 +51,7 @@ GType = ctypes.c_ulong
# Structs
+
class GTypeClass(ctypes.Structure):
_fields_ = [('g_type', GType)]
@@ -72,7 +73,7 @@ class GFlagsValue(ctypes.Structure):
class GEnumClass(ctypes.Structure):
- _fields_ = [('g_type_class', GTypeClass),
+ _fields_ = [('g_type_class', GTypeClass),
('minimum', ctypes.c_int),
('maximum', ctypes.c_int),
('n_values', ctypes.c_uint),
@@ -137,20 +138,28 @@ _gobj.g_object_new(TYPE_OBJECT, None)
# Functions
_gobj.g_type_name.restype = ctypes.c_char_p
+
+
def type_name(type_id):
return _gobj.g_type_name(type_id)
_gobj.g_type_from_name.argtypes = [ctypes.c_char_p]
+
+
def type_from_name(name):
return _gobj.g_type_from_name(name)
+
def type_fundamental(type_id):
return _gobj.g_type_fundamental(type_id)
+
def type_parent(type_id):
return _gobj.g_type_parent(type_id)
_gobj.g_type_class_ref.restype = ctypes.POINTER(GTypeClass)
+
+
def type_class_ref(type_id):
fundamental_type = type_fundamental(type_id)
if fundamental_type == TYPE_INVALID:
@@ -166,6 +175,8 @@ def type_class_ref(type_id):
_gobj.g_object_class_list_properties.restype = ctypes.POINTER(
ctypes.POINTER(GParamSpec))
+
+
def object_class_list_properties(type_id):
klass = _gobj.g_type_class_ref(type_id)
n = ctypes.c_uint()
@@ -175,6 +186,8 @@ def object_class_list_properties(type_id):
_gobj.g_object_interface_list_properties.restype = ctypes.POINTER(
ctypes.POINTER(GParamSpec))
+
+
def object_interface_list_properties(type_id):
iface = _gobj.g_type_default_interface_ref(type_id)
n = ctypes.c_uint()
@@ -183,6 +196,8 @@ def object_interface_list_properties(type_id):
yield ctypes.cast(pspecs[i], ctypes.POINTER(GParamSpec)).contents
_gobj.g_type_interfaces.restype = ctypes.POINTER(ctypes.c_int)
+
+
def type_interfaces(type_id):
n = ctypes.c_uint()
type_ids = _gobj.g_type_interfaces(type_id, ctypes.byref(n))
@@ -190,6 +205,8 @@ def type_interfaces(type_id):
yield type_ids[i]
_gobj.g_type_interface_prerequisites.restype = ctypes.POINTER(ctypes.c_int)
+
+
def type_interface_prerequisites(type_id):
n = ctypes.c_uint()
type_ids = _gobj.g_type_interface_prerequisites(type_id, ctypes.byref(n))
@@ -197,6 +214,8 @@ def type_interface_prerequisites(type_id):
yield type_ids[i]
_gobj.g_signal_list_ids.restype = ctypes.POINTER(ctypes.c_int)
+
+
def signal_list(type_id):
n = ctypes.c_uint()
signal_ids = _gobj.g_signal_list_ids(type_id, ctypes.byref(n))
diff --git a/giscanner/gidlparser.py b/giscanner/gidlparser.py
index 1ac50952..db3b1d9a 100644
--- a/giscanner/gidlparser.py
+++ b/giscanner/gidlparser.py
@@ -24,6 +24,7 @@ from .glibast import GLibObject
class GIDLParser(object):
+
def __init__(self, filename):
self._nodes = []
self._namespace_name = None
@@ -39,7 +40,7 @@ class GIDLParser(object):
if child.tag == 'object':
self._parse_object(child)
else:
- print 'PARSER: Unhandled %s' % (child.tag,)
+ print 'PARSER: Unhandled %s' % (child.tag, )
def _parse_object(self, node):
gobj = GLibObject(node.attrib['name'],
diff --git a/giscanner/gidlwriter.py b/giscanner/gidlwriter.py
index 0cca2d27..fda525ef 100644
--- a/giscanner/gidlwriter.py
+++ b/giscanner/gidlwriter.py
@@ -27,6 +27,7 @@ from .xmlwriter import XMLWriter
class GIDLWriter(XMLWriter):
+
def __init__(self, namespace):
super(GIDLWriter, self).__init__()
self._write_api(namespace)
diff --git a/giscanner/girparser.py b/giscanner/girparser.py
index 00739ab6..5e1f15b8 100644
--- a/giscanner/girparser.py
+++ b/giscanner/girparser.py
@@ -25,14 +25,17 @@ from .glibast import GLibObject
CORE_NS = "http://www.gtk.org/introspection/core/1.0"
GLIB_NS = "http://www.gtk.org/introspection/glib/1.0"
+
def _corens(tag):
return '{%s}%s' % (CORE_NS, tag)
+
def _glibns(tag):
return '{%s}%s' % (GLIB_NS, tag)
class GIRParser(object):
+
def __init__(self, filename):
self._nodes = []
self._namespace_name = None
@@ -58,7 +61,7 @@ class GIRParser(object):
]:
continue
else:
- print 'PARSER: Unhandled %s' % (child.tag,)
+ print 'PARSER: Unhandled %s' % (child.tag, )
def _parse_object(self, node):
gobj = GLibObject(node.attrib['name'],
diff --git a/giscanner/girwriter.py b/giscanner/girwriter.py
index 7cf61b22..45d2b23c 100644
--- a/giscanner/girwriter.py
+++ b/giscanner/girwriter.py
@@ -28,6 +28,7 @@ from .xmlwriter import XMLWriter
class GIRWriter(XMLWriter):
+
def __init__(self, namespace):
super(GIRWriter, self).__init__()
self._write_repository(namespace)
@@ -229,4 +230,3 @@ class GIRWriter(XMLWriter):
with self.tagcontext('glib:signal', attrs):
self._write_return_type(signal.retval)
self._write_parameters(signal.parameters)
-
diff --git a/giscanner/glibast.py b/giscanner/glibast.py
index 1abea0a1..b0dec72d 100644
--- a/giscanner/glibast.py
+++ b/giscanner/glibast.py
@@ -46,7 +46,9 @@ type_names['gpointer'] = TYPE_ANY
type_names['gsize'] = TYPE_SIZE
type_names['gssize'] = TYPE_SSIZE
+
class GLibEnum(Enum):
+
def __init__(self, name, type_name, members, get_type):
Enum.__init__(self, name, type_name, members)
self.ctype = type_name
@@ -66,12 +68,14 @@ class GLibFlags(GLibEnum):
class GLibEnumMember(Member):
+
def __init__(self, name, value, symbol, nick):
Member.__init__(self, name, value, symbol)
self.nick = nick
class GLibObject(Class):
+
def __init__(self, name, parent, type_name, get_type):
Class.__init__(self, name, parent)
self.ctype = type_name
@@ -79,7 +83,9 @@ class GLibObject(Class):
self.get_type = get_type
self.signals = []
+
class GLibBoxed(Struct):
+
def __init__(self, name, type_name, get_type):
Struct.__init__(self, name, get_type)
self.ctype = name
@@ -91,6 +97,7 @@ class GLibBoxed(Struct):
class GLibInterface(Interface):
+
def __init__(self, name, type_name, get_type):
Interface.__init__(self, name)
self.ctype = type_name
@@ -104,6 +111,7 @@ class GLibProperty(Property):
class GLibSignal(Node):
+
def __init__(self, name, retval):
Node.__init__(self, name)
self.retval = retval
diff --git a/giscanner/glibtransformer.py b/giscanner/glibtransformer.py
index d1328901..80a9a98d 100644
--- a/giscanner/glibtransformer.py
+++ b/giscanner/glibtransformer.py
@@ -32,6 +32,7 @@ from .utils import resolve_libtool, to_underscores
class GLibTransformer(object):
+
def __init__(self, transformer):
self._transformer = transformer
self._namespace_name = None
@@ -245,7 +246,7 @@ class GLibTransformer(object):
elif fundamental_type_id == cgobject.TYPE_BOXED:
self._introspect_boxed(type_id, symbol)
else:
- print 'unhandled GType: %s' % (cgobject.type_name(type_id),)
+ print 'unhandled GType: %s' % (cgobject.type_name(type_id), )
def _introspect_enum(self, ftype_id, type_id, symbol):
type_class = cgobject.type_class_ref(type_id)
@@ -332,7 +333,7 @@ class GLibTransformer(object):
if i == 0:
name = 'object'
else:
- name = 'p%s' % (i-1,)
+ name = 'p%s' % (i-1, )
ptype = self._create_type(parameter)
param = Parameter(name, ptype)
signal.parameters.append(param)
diff --git a/giscanner/odict.py b/giscanner/odict.py
index 9dfc2c6c..2d7c58f9 100644
--- a/giscanner/odict.py
+++ b/giscanner/odict.py
@@ -24,6 +24,7 @@ from UserDict import DictMixin
class odict(DictMixin):
+
def __init__(self):
self._items = {}
self._keys = []
diff --git a/giscanner/sourcescanner.py b/giscanner/sourcescanner.py
index f79fe78e..ae7b6d07 100644
--- a/giscanner/sourcescanner.py
+++ b/giscanner/sourcescanner.py
@@ -67,6 +67,7 @@ FUNCTION_INLINE = 1 << 1
UNARY_BITWISE_COMPLEMENT,
UNARY_LOGICAL_NEGATION) = range(6)
+
def symbol_type_name(symbol_type):
return {
CSYMBOL_TYPE_INVALID: 'invalid',
@@ -80,6 +81,7 @@ def symbol_type_name(symbol_type):
CSYMBOL_TYPE_MEMBER: 'member',
}.get(symbol_type)
+
def ctype_name(ctype):
return {
CTYPE_INVALID: 'invalid',
@@ -91,12 +93,13 @@ def ctype_name(ctype):
CTYPE_ENUM: 'enum',
CTYPE_POINTER: 'pointer',
CTYPE_ARRAY: 'array',
- CTYPE_FUNCTION: 'function'
+ CTYPE_FUNCTION: 'function',
}.get(ctype)
class SourceType(object):
__members__ = ['type', 'base_type', 'name', 'child_list']
+
def __init__(self, scanner, stype):
self._scanner = scanner
self._stype = stype
@@ -106,7 +109,7 @@ class SourceType(object):
self.__class__.__name__,
ctype_name(self.type),
self.name)
-
+
@property
def type(self):
return self._stype.type
@@ -130,6 +133,7 @@ class SourceType(object):
class SourceSymbol(object):
__members__ = ['const_int', 'ident', 'type', 'base_type']
+
def __init__(self, scanner, symbol):
self._scanner = scanner
self._symbol = symbol
@@ -165,10 +169,11 @@ class SourceSymbol(object):
class SourceScanner(object):
+
def __init__(self):
self._scanner = _giscanner.SourceScanner()
self._filenames = []
- self._cpp_options = []
+ self._cpp_options = []
# Public API
@@ -216,7 +221,7 @@ class SourceScanner(object):
def _parse(self, filenames):
if not filenames:
return
-
+
cpp_args = [
'cpp',
'-C',
@@ -228,10 +233,10 @@ class SourceScanner(object):
proc = subprocess.Popen(cpp_args,
stdin=subprocess.PIPE,
stdout=subprocess.PIPE)
-
+
for filename in filenames:
filename = os.path.abspath(filename)
- proc.stdin.write('#include <%s>\n' % (filename,))
+ proc.stdin.write('#include <%s>\n' % (filename, ))
proc.stdin.close()
tmp = tempfile.mktemp()
diff --git a/giscanner/transformer.py b/giscanner/transformer.py
index 6f7e2a35..a843c3ea 100644
--- a/giscanner/transformer.py
+++ b/giscanner/transformer.py
@@ -32,6 +32,7 @@ from .utils import strip_common_prefix
class Transformer(object):
+
def __init__(self, generator, namespace_name):
self.generator = generator
self._namespace = Namespace(namespace_name)
@@ -122,7 +123,7 @@ class Transformer(object):
pass
else:
raise NotImplementedError(
- 'Transformer: unhandled symbol: %r' % (symbol,))
+ 'Transformer: unhandled symbol: %r' % (symbol, ))
def _create_enum(self, symbol):
members = []
@@ -141,7 +142,8 @@ class Transformer(object):
def _create_function(self, symbol):
directives = symbol.directives()
- parameters = list(self._create_parameters(symbol.base_type, directives))
+ parameters = list(self._create_parameters(
+ symbol.base_type, directives))
return_ = self._create_return(symbol.base_type.base_type,
directives.get('return', []))
name = self._remove_prefix(symbol.ident)
@@ -163,7 +165,7 @@ class Transformer(object):
value = self._create_source_type(source_type.base_type) + '*'
else:
print 'TRANSFORMER: Unhandled source type %r' % (
- source_type,)
+ source_type, )
value = '???'
return value
@@ -183,7 +185,7 @@ class Transformer(object):
ftype = self._create_type(symbol.base_type)
node = Field(symbol.ident, ftype, symbol.ident)
return node
-
+
def _create_typedef(self, symbol):
ctype = symbol.base_type.type
if (ctype == CTYPE_POINTER and
@@ -225,7 +227,7 @@ class Transformer(object):
param.allow_none = True
else:
print 'Unhandled parameter annotation option: %s' % (
- option,)
+ option, )
return param
def _create_return(self, source_type, options=None):
@@ -247,7 +249,7 @@ class Transformer(object):
return_.type = seq
else:
print 'Unhandled parameter annotation option: %s' % (
- option,)
+ option, )
return return_
def _create_typedef_struct(self, symbol):
@@ -294,4 +296,3 @@ class Transformer(object):
type_name = ptype.name
ptype.name = self._resolve_type_name(type_name)
return ptype
-
diff --git a/giscanner/utils.py b/giscanner/utils.py
index 488baadd..22656536 100644
--- a/giscanner/utils.py
+++ b/giscanner/utils.py
@@ -26,6 +26,7 @@ _upperstr_pat1 = re.compile(r'([^A-Z])([A-Z])')
_upperstr_pat2 = re.compile(r'([A-Z][A-Z])([A-Z][0-9a-z])')
_upperstr_pat3 = re.compile(r'^([A-Z])([A-Z])')
+
def to_underscores(name):
"""Converts a typename to the equivalent underscores name.
This is used to form the type conversion macros and enum/flag
@@ -37,6 +38,7 @@ def to_underscores(name):
_libtool_pat = re.compile("dlname='([A-z0-9\.\-\+]+)'\n")
+
def resolve_libtool(libname):
data = open(libname).read()
filename = _libtool_pat.search(data).groups()[0]
@@ -44,10 +46,10 @@ def resolve_libtool(libname):
'.libs', filename)
return libname
+
def strip_common_prefix(first, second):
first_underscore = to_underscores(first)
for i, c in enumerate(first_underscore.upper()):
if c != second[i]:
break
return second[i:]
-
diff --git a/giscanner/xmlwriter.py b/giscanner/xmlwriter.py
index 6c187a12..6b94a4d6 100644
--- a/giscanner/xmlwriter.py
+++ b/giscanner/xmlwriter.py
@@ -24,6 +24,7 @@ from xml.sax.saxutils import quoteattr
class XMLWriter(object):
+
def __init__(self):
self._data = StringIO()
self._tag_stack = []
@@ -40,7 +41,7 @@ class XMLWriter(object):
for attr, value in attributes:
if value is None:
raise ValueError(
- "value for attribute %r cannot be None" % (attr,))
+ "value for attribute %r cannot be None" % (attr, ))
attr_length += 2 + len(attr) + len(quoteattr(value))
return attr_length + indent + self._indent
@@ -58,7 +59,7 @@ class XMLWriter(object):
attr_value += '\n%s' % (self._indent_char * indent_len)
if value is None:
raise ValueError(
- "value for attribute %r cannot be None" % (attr,))
+ "value for attribute %r cannot be None" % (attr, ))
attr_value += ' %s=%s' % (attr, quoteattr(value))
if first:
first = False
@@ -70,7 +71,7 @@ class XMLWriter(object):
self.write_line('<%s%s>' % (tag_name, attrs))
def _close_tag(self, tag_name):
- self.write_line('</%s>' % (tag_name,))
+ self.write_line('</%s>' % (tag_name, ))
# Public API
@@ -83,7 +84,7 @@ class XMLWriter(object):
def write_tag(self, tag_name, attributes, data=None):
if attributes is None:
attributes = []
- prefix = '<%s' % (tag_name,)
+ prefix = '<%s' % (tag_name, )
if data is not None:
suffix = '>%s</%s>' % (data, tag_name)
else:
@@ -122,7 +123,7 @@ def test():
('value', '7'),
('c:identifier', 'GTK_ANCHOR_WEST'),
('glib:nick', 'west')])
-
+
w.pop_tag()
w.pop_tag()
w.pop_tag()
diff --git a/tools/g-ir-scanner b/tools/g-ir-scanner
index 07372431..e1ffa2b1 100755
--- a/tools/g-ir-scanner
+++ b/tools/g-ir-scanner
@@ -82,8 +82,10 @@ def _get_option_parser():
return parser
+
def _error(msg):
- raise SystemExit('ERROR: %s' % (msg,))
+ raise SystemExit('ERROR: %s' % (msg, ))
+
def main(args):
parser = _get_option_parser()
@@ -100,10 +102,10 @@ def main(args):
elif options.format == 'gidl':
from giscanner.gidlwriter import GIDLWriter as Writer
else:
- _error("Unknown format: %s" % (options.format,))
+ _error("Unknown format: %s" % (options.format, ))
for package in options.packages:
- output = commands.getoutput('pkg-config --cflags %s' % (package,))
+ output = commands.getoutput('pkg-config --cflags %s' % (package, ))
pkg_options, unused = parser.parse_args(output.split())
options.cpp_includes.extend(pkg_options.cpp_includes)
options.cpp_defines.extend(pkg_options.cpp_defines)
@@ -114,7 +116,7 @@ def main(args):
if (arg.endswith('.c') or
arg.endswith('.h')):
if not os.path.exists(arg):
- _error('%s: no such a file or directory' % (arg,))
+ _error('%s: no such a file or directory' % (arg, ))
filenames.append(arg)
# Run the preprocessor, tokenize and construct simple