summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJasper St. Pierre <jstpierre@mecheye.net>2013-02-02 11:07:42 -0500
committerJasper St. Pierre <jstpierre@mecheye.net>2013-02-11 12:34:52 -0500
commitff80c6d88a28b26576508ab891c9b9da0b13ac49 (patch)
tree3ecfcda8e893aaf19a279edd36323a42999570cd
parent3818b98a9785026c8aab2cf07e35855caf32a768 (diff)
downloadgobject-introspection-ff80c6d88a28b26576508ab891c9b9da0b13ac49.tar.gz
doctool: Don't use zip(range(L))
Instead, remove it entirely (since we don't need the index) or instead use enumerate().
-rw-r--r--giscanner/doctemplates/C/function.tmpl6
-rw-r--r--giscanner/doctemplates/Gjs/class.tmpl2
-rw-r--r--giscanner/doctemplates/Gjs/enum.tmpl2
-rw-r--r--giscanner/doctemplates/Gjs/function.tmpl2
-rw-r--r--giscanner/doctemplates/Gjs/vfunc.tmpl2
-rw-r--r--giscanner/doctemplates/Python/class.tmpl2
-rw-r--r--giscanner/doctemplates/Python/enum.tmpl2
-rw-r--r--giscanner/doctemplates/Python/function.tmpl4
-rw-r--r--giscanner/doctemplates/Python/signal.tmpl4
-rw-r--r--giscanner/doctemplates/Python/vfunc.tmpl4
10 files changed, 15 insertions, 15 deletions
diff --git a/giscanner/doctemplates/C/function.tmpl b/giscanner/doctemplates/C/function.tmpl
index 94036986..e76eda31 100644
--- a/giscanner/doctemplates/C/function.tmpl
+++ b/giscanner/doctemplates/C/function.tmpl
@@ -25,10 +25,10 @@
<%block name="synopsis">
<synopsis><code mime="text/x-csrc">
${node.retval.type.ctype} ${formatter.format_function_name(node)} (\
-% if len(node.all_parameters) == 0:
+% if not node.all_parameters:
void\
% else:
-% for arg, ix in zip(node.all_parameters, range(len(node.all_parameters))):
+% for ix, arg in enumerate(node.all_parameters):
% if ix != 0:
${' ' * (len(formatter.format_type(node.retval.type)) + len(formatter.format_function_name(node)) + 3)}\
% endif
@@ -48,7 +48,7 @@ ${formatter.format_type(arg.type) | x} ${arg.argname}\
<%block name="details">
% if node.all_parameters or node.retval:
<dl>
-% for arg, ix in zip(node.parameters, range(len(node.parameters))):
+% for arg in node.parameters:
<dt><p>${arg.argname} :</p></dt>
<dd>${formatter.format(node, arg.doc)}</dd>
% endfor
diff --git a/giscanner/doctemplates/Gjs/class.tmpl b/giscanner/doctemplates/Gjs/class.tmpl
index 3991ff31..435b31a5 100644
--- a/giscanner/doctemplates/Gjs/class.tmpl
+++ b/giscanner/doctemplates/Gjs/class.tmpl
@@ -4,7 +4,7 @@
from gi.repository import ${namespace.name}
${formatter.to_underscores(node.name).lower()} = ${namespace.name}.${node.name}(\
-% for property_, ix in zip(node.properties, range(len(node.properties))):
+% for ix, property_ in enumerate(node.properties):
% if property_.construct or property_.construct_only or property_.writable:
<link xref='${namespace.name}.${node.name}-${property_.name}'>${property_.name.replace('-', '_')}</link>=value\
% if ix != len(node.properties) - 1:
diff --git a/giscanner/doctemplates/Gjs/enum.tmpl b/giscanner/doctemplates/Gjs/enum.tmpl
index 840f79f5..2624c425 100644
--- a/giscanner/doctemplates/Gjs/enum.tmpl
+++ b/giscanner/doctemplates/Gjs/enum.tmpl
@@ -2,7 +2,7 @@
<%block name="details">
% if node.members:
<dl>
-% for member, ix in zip(node.members, range(len(node.members))):
+% for member in node.members:
<dt><p>${node.name}.${member.name.upper()} :</p></dt>
<dd>${formatter.format(node, member.doc)}</dd>
% endfor
diff --git a/giscanner/doctemplates/Gjs/function.tmpl b/giscanner/doctemplates/Gjs/function.tmpl
index d0fa096e..2039405d 100644
--- a/giscanner/doctemplates/Gjs/function.tmpl
+++ b/giscanner/doctemplates/Gjs/function.tmpl
@@ -35,7 +35,7 @@ ${', '.join('%s:%s' % (arg.argname, formatter.format_type(arg.type)) for arg in
<%block name="details">
% if node.parameters or node.retval:
<dl>
-% for arg, ix in zip(node.parameters, range(len(node.parameters))):
+% for arg in node.parameters:
<dt><p>${arg.argname} :</p></dt>
<dd>${formatter.format(node, arg.doc)}</dd>
% endfor
diff --git a/giscanner/doctemplates/Gjs/vfunc.tmpl b/giscanner/doctemplates/Gjs/vfunc.tmpl
index bba3f38d..2e5d8c94 100644
--- a/giscanner/doctemplates/Gjs/vfunc.tmpl
+++ b/giscanner/doctemplates/Gjs/vfunc.tmpl
@@ -10,7 +10,7 @@ ${', '.join('%s:%s' % (arg.argname, formatter.format_type(arg.type)) for arg in
<%block name="details">
% if node.parameters or node.retval:
<dl>
-% for arg, ix in zip(node.parameters, range(len(node.parameters))):
+% for arg in node.parameters:
<dt><p>${arg.argname} :</p></dt>
<dd>${formatter.format(node, arg.doc)}</dd>
% endfor
diff --git a/giscanner/doctemplates/Python/class.tmpl b/giscanner/doctemplates/Python/class.tmpl
index 3991ff31..435b31a5 100644
--- a/giscanner/doctemplates/Python/class.tmpl
+++ b/giscanner/doctemplates/Python/class.tmpl
@@ -4,7 +4,7 @@
from gi.repository import ${namespace.name}
${formatter.to_underscores(node.name).lower()} = ${namespace.name}.${node.name}(\
-% for property_, ix in zip(node.properties, range(len(node.properties))):
+% for ix, property_ in enumerate(node.properties):
% if property_.construct or property_.construct_only or property_.writable:
<link xref='${namespace.name}.${node.name}-${property_.name}'>${property_.name.replace('-', '_')}</link>=value\
% if ix != len(node.properties) - 1:
diff --git a/giscanner/doctemplates/Python/enum.tmpl b/giscanner/doctemplates/Python/enum.tmpl
index 840f79f5..2624c425 100644
--- a/giscanner/doctemplates/Python/enum.tmpl
+++ b/giscanner/doctemplates/Python/enum.tmpl
@@ -2,7 +2,7 @@
<%block name="details">
% if node.members:
<dl>
-% for member, ix in zip(node.members, range(len(node.members))):
+% for member in node.members:
<dt><p>${node.name}.${member.name.upper()} :</p></dt>
<dd>${formatter.format(node, member.doc)}</dd>
% endfor
diff --git a/giscanner/doctemplates/Python/function.tmpl b/giscanner/doctemplates/Python/function.tmpl
index fa705bd0..23fde041 100644
--- a/giscanner/doctemplates/Python/function.tmpl
+++ b/giscanner/doctemplates/Python/function.tmpl
@@ -24,7 +24,7 @@
</%block>
<%block name="synopsis">
<synopsis><code mime="text/x-python">
-% if len(node.all_parameters) != 0:
+% if node.all_parameters:
@accepts(\
${', '.join((formatter.format_type(arg.type) for arg in node.all_parameters))}\
)
@@ -40,7 +40,7 @@ ${', '.join((formatter.format_parameter_name(node, arg) for arg in node.all_para
<%block name="details">
% if node.all_parameters or node.retval:
<dl>
-% for arg, ix in zip(node.all_parameters, range(len(node.all_parameters))):
+% for ix, arg in enumerate(node.all_parameters):
<dt><p>${formatter.format_parameter_name(node, arg)} :</p></dt>
<dd>${formatter.format(node, arg.doc)}</dd>
% endfor
diff --git a/giscanner/doctemplates/Python/signal.tmpl b/giscanner/doctemplates/Python/signal.tmpl
index 9b277466..abb3a3ae 100644
--- a/giscanner/doctemplates/Python/signal.tmpl
+++ b/giscanner/doctemplates/Python/signal.tmpl
@@ -6,7 +6,7 @@
<%block name="synopsis">
<synopsis><code mime="text/x-python">
def callback(${formatter.to_underscores(node.parent.name).lower()}, \
-% for arg, ix in zip(node.parameters, range(len(node.parameters))):
+% for arg in node.parameters:
${arg.argname}, \
% endfor
user_param1, ...)
@@ -16,7 +16,7 @@ user_param1, ...)
<dl>
<dt><p>${formatter.to_underscores(node.parent.name).lower()} :</p></dt>
<dd><p>instance of ${namespace.name}.${node.parent.name} that is emitting the signal</p></dd>
-% for arg, ix in zip(node.parameters, range(len(node.parameters))):
+% for arg in node.parameters:
<dt><p>${arg.argname} :</p></dt>
<dd>${formatter.format(node, arg.doc)}</dd>
% endfor
diff --git a/giscanner/doctemplates/Python/vfunc.tmpl b/giscanner/doctemplates/Python/vfunc.tmpl
index 65f856a5..6f7e6920 100644
--- a/giscanner/doctemplates/Python/vfunc.tmpl
+++ b/giscanner/doctemplates/Python/vfunc.tmpl
@@ -1,7 +1,7 @@
<%inherit file="/base.tmpl"/>
<%block name="synopsis">
<synopsis><code mime="text/x-python">
-% if len(node.parameters) != 0:
+% if node.parameters:
@accepts(\
${', '.join((formatter.format_type(arg.type) for arg in node.parameters))}\
)
@@ -16,7 +16,7 @@ ${', '.join((arg.argname for arg in node.parameters))}\
<%block name="details">
% if node.parameters or node.retval:
<dl>
-% for arg, ix in zip(node.parameters, range(len(node.parameters))):
+% for arg in node.parameters:
<dt><p>${arg.argname} :</p></dt>
<dd>${formatter.format(node, arg.doc)}</dd>
% endfor