1.1 --- a/micropython/__init__.py Tue Jul 10 01:36:34 2012 +0200
1.2 +++ b/micropython/__init__.py Tue Jul 10 18:54:33 2012 +0200
1.3 @@ -446,9 +446,9 @@
1.4
1.5 # Status information.
1.6
1.7 - self.completed = 0
1.8 - self.vacuumed = 0
1.9 - self.finalised = 0
1.10 + self.completed = False
1.11 + self.vacuumed = False
1.12 + self.finalised = False
1.13
1.14 def get_modules(self):
1.15
1.16 @@ -472,7 +472,7 @@
1.17 self.get_module("__builtins__").complete()
1.18 self.get_module("__main__").complete()
1.19
1.20 - self.completed = 1
1.21 + self.completed = True
1.22
1.23 # General maintenance.
1.24
1.25 @@ -493,7 +493,7 @@
1.26 else:
1.27 del self.modules[name]
1.28
1.29 - self.vacuumed = 1
1.30 + self.vacuumed = True
1.31
1.32 def finalise(self, objtable):
1.33
1.34 @@ -512,7 +512,7 @@
1.35 for module in self.get_modules():
1.36 module.finalise(objtable)
1.37
1.38 - self.finalised = 1
1.39 + self.finalised = True
1.40
1.41 # Name accounting.
1.42
1.43 @@ -1054,7 +1054,7 @@
1.44 if self.verbose:
1.45 print >>sys.stderr, "Loaded", name
1.46 self.loading.remove(module)
1.47 - module.loaded = 1
1.48 + module.loaded = True
1.49
1.50 # Record each module as imported by any importer.
1.51
2.1 --- a/micropython/ast.py Tue Jul 10 01:36:34 2012 +0200
2.2 +++ b/micropython/ast.py Tue Jul 10 18:54:33 2012 +0200
2.3 @@ -67,8 +67,8 @@
2.4
2.5 # Status flags.
2.6
2.7 - self.in_exception_handler = 0
2.8 - self.in_assignment = 0 # for slicing and subscript
2.9 + self.in_exception_handler = False
2.10 + self.in_assignment = False # for slicing and subscript
2.11
2.12 # Reset the assembler.
2.13
2.14 @@ -512,12 +512,12 @@
2.15
2.16 self.record_value(self.has_immediate_usage(node.nodes))
2.17
2.18 - self.in_assignment = 1
2.19 + self.in_assignment = True
2.20
2.21 for n in node.nodes:
2.22 self.dispatch(n)
2.23
2.24 - self.in_assignment = 0
2.25 + self.in_assignment = False
2.26 self.discard_value()
2.27
2.28 def visitAssAttr(self, node):
2.29 @@ -729,7 +729,7 @@
2.30 self._endFor(node, temp_iterator, next_block, exit_block, else_block, node.else_)
2.31
2.32 def visitIf(self, node):
2.33 - first = 1
2.34 + first = True
2.35 next_block = None
2.36 exit_block = self.new_block()
2.37
2.38 @@ -756,7 +756,7 @@
2.39 self.new_op(JumpIfFalse(next_block, working="status"))
2.40
2.41 self.dispatch(body)
2.42 - first = 0
2.43 + first = False
2.44
2.45 if next_block is not None:
2.46 self.set_block(next_block)
2.47 @@ -863,9 +863,9 @@
2.48
2.49 # Produce the handler code, then jump to the exit.
2.50
2.51 - self.in_exception_handler = 1
2.52 + self.in_exception_handler = True
2.53 self.dispatch(handler)
2.54 - self.in_exception_handler = 0
2.55 + self.in_exception_handler = False
2.56
2.57 self.new_op(Jump(exit_block))
2.58
3.1 --- a/micropython/code.py Tue Jul 10 01:36:34 2012 +0200
3.2 +++ b/micropython/code.py Tue Jul 10 18:54:33 2012 +0200
3.3 @@ -248,8 +248,8 @@
3.4
3.5 for n in nodes:
3.6 if not self.is_immediate_user(n):
3.7 - return 0
3.8 - return 1
3.9 + return False
3.10 + return True
3.11
3.12 # Temporary storage administration.
3.13
3.14 @@ -361,23 +361,23 @@
3.15 """
3.16
3.17 if not self.check_op(op):
3.18 - return 0
3.19 + return False
3.20
3.21 # Add the operation to the current block.
3.22
3.23 self.optimiser.set_new("working", op)
3.24 self.blocks[-1].append(op)
3.25 - return 1
3.26 + return True
3.27
3.28 def insert_op(self, i, op):
3.29
3.30 "Insert at index 'i' in the current block the instruction 'op'."
3.31
3.32 if not self.check_op(op):
3.33 - return 0
3.34 + return False
3.35
3.36 self.blocks[-1].insert(i, op)
3.37 - return 1
3.38 + return True
3.39
3.40 def check_op(self, op):
3.41
3.42 @@ -387,14 +387,14 @@
3.43 # still available and was not recorded.
3.44
3.45 if isinstance(op, LoadTemp) and op.attr is None:
3.46 - return 0
3.47 + return False
3.48
3.49 # Optimise load operations employed by this instruction.
3.50
3.51 if self.optimiser.optimise_away_no_operations(op) or self.optimiser.optimise_unused_handlers(op):
3.52 - return 0
3.53 + return False
3.54
3.55 - return 1
3.56 + return True
3.57
3.58 def remove_op(self):
3.59
4.1 --- a/micropython/data.py Tue Jul 10 01:36:34 2012 +0200
4.2 +++ b/micropython/data.py Tue Jul 10 18:54:33 2012 +0200
4.3 @@ -73,7 +73,7 @@
4.4 self.namespace = {}
4.5 self.globals = set()
4.6 self.lambdas = {} # only really useful for functions
4.7 - self.finalised = 0
4.8 + self.finalised = False
4.9
4.10 # Attributes accessed on objects, potentially narrowing their types.
4.11 # Specific namespaces should define known names during initialisation.
4.12 @@ -138,9 +138,9 @@
4.13 def vacuum_item(self, name):
4.14 if self.has_key(name):
4.15 del self[name]
4.16 - return 1
4.17 + return True
4.18 else:
4.19 - return 0
4.20 + return False
4.21
4.22 def add_lambda(self, obj):
4.23 attr = Attr(None, self, obj.name)
4.24 @@ -319,9 +319,9 @@
4.25 if not self.namespace.has_key(name):
4.26 self.globals.add(name)
4.27 self.define_scope(name, "global")
4.28 - return 1
4.29 + return True
4.30 else:
4.31 - return 0
4.32 + return False
4.33
4.34 # Attribute positioning.
4.35
4.36 @@ -347,13 +347,13 @@
4.37 for i, attr in enumerate(self.values()):
4.38 attr.position = i
4.39
4.40 - self.finalised = 1
4.41 + self.finalised = True
4.42
4.43 def unfinalise_attributes(self):
4.44
4.45 "Open attribute definitions to editing and subsequent finalisation."
4.46
4.47 - self.finalised = 0
4.48 + self.finalised = False
4.49
4.50 # Attribute usage methods.
4.51
4.52 @@ -984,7 +984,7 @@
4.53 "A class providing dictionaries which retain no information."
4.54
4.55 def has_key(self, name):
4.56 - return 0
4.57 + return False
4.58
4.59 def __setitem__(self, name, value):
4.60 pass
4.61 @@ -1143,14 +1143,14 @@
4.62 "Return whether this attribute defines more than one class."
4.63
4.64 if self.assignments > 1:
4.65 - have_class = 0
4.66 + have_class = False
4.67 for obj in self.get_values():
4.68 if isinstance(obj, Class):
4.69 if have_class:
4.70 - return 1
4.71 - have_class = 1
4.72 -
4.73 - return 0
4.74 + return True
4.75 + have_class = True
4.76 +
4.77 + return False
4.78
4.79 def defined_within_hierarchy(self):
4.80
4.81 @@ -1174,14 +1174,14 @@
4.82 context.has_subclass(self.parent) or
4.83 self.parent.has_subclass(context))
4.84 ):
4.85 - return 0
4.86 -
4.87 - return 1
4.88 + return False
4.89 +
4.90 + return True
4.91
4.92 # Instance attributes are not defined within a hierarchy.
4.93
4.94 else:
4.95 - return 0
4.96 + return False
4.97
4.98 def defined_outside_hierarchy(self):
4.99
4.100 @@ -1205,14 +1205,14 @@
4.101 context.has_subclass(self.parent) or
4.102 self.parent.has_subclass(context))
4.103 ):
4.104 - return 0
4.105 -
4.106 - return 1
4.107 + return False
4.108 +
4.109 + return True
4.110
4.111 # Instance attributes are not defined within a hierarchy.
4.112
4.113 else:
4.114 - return 0
4.115 + return False
4.116
4.117 def __repr__(self):
4.118 if self.position is not None:
4.119 @@ -1356,11 +1356,11 @@
4.120 # NOTE: Hack to prevent damage to exceptions.
4.121
4.122 if name == "_pc":
4.123 - return 0
4.124 + return False
4.125
4.126 if not NamespaceDict.vacuum_item(self, name):
4.127 self.instattr.remove(name)
4.128 - return 1
4.129 + return True
4.130
4.131 def finalise_attributes(self):
4.132
4.133 @@ -1371,14 +1371,14 @@
4.134
4.135 self.finalise_class_attributes()
4.136 self.finalise_instance_attributes()
4.137 - self.finalised = 1
4.138 + self.finalised = True
4.139
4.140 def unfinalise_attributes(self):
4.141
4.142 "Open attribute definitions to editing and subsequent finalisation."
4.143
4.144 self.reset_caches()
4.145 - self.finalised = 0
4.146 + self.finalised = False
4.147
4.148 # Convenience methods for accessing functions and methods.
4.149
4.150 @@ -1685,10 +1685,10 @@
4.151
4.152 if name is None:
4.153 self.name = "lambda#%d" % new_lambda()
4.154 - self._is_lambda = 1
4.155 + self._is_lambda = True
4.156 else:
4.157 self.name = name
4.158 - self._is_lambda = 0
4.159 + self._is_lambda = False
4.160
4.161 self.parent = parent
4.162 self.argnames = argnames
4.163 @@ -1804,11 +1804,11 @@
4.164 if self.dynamic is None:
4.165 for attr in self.default_attrs:
4.166 if not attr.is_strict_constant() and self.dynamic_def:
4.167 - self.dynamic = 1
4.168 + self.dynamic = True
4.169 self._make_dynamic()
4.170 break
4.171 else:
4.172 - self.dynamic = 0
4.173 + self.dynamic = False
4.174
4.175 return self.dynamic
4.176
4.177 @@ -1831,9 +1831,9 @@
4.178
4.179 if name not in self.argnames and not self.has_key(name):
4.180 self.globals.add(name)
4.181 - return 1
4.182 + return True
4.183 else:
4.184 - return 0
4.185 + return False
4.186
4.187 def parameters(self):
4.188
4.189 @@ -1899,8 +1899,8 @@
4.190
4.191 for cls in self.parent.descendants:
4.192 if name in cls.relocated:
4.193 - return 1
4.194 - return 0
4.195 + return True
4.196 + return False
4.197
4.198 # Administrative methods.
4.199
4.200 @@ -1909,7 +1909,7 @@
4.201
4.202 def vacuum_item(self, name):
4.203 del self.lambdas[name]
4.204 - return 1
4.205 + return True
4.206
4.207 def finalise_attributes(self):
4.208
4.209 @@ -1949,7 +1949,7 @@
4.210
4.211 self.local_usage = nothers
4.212 self.all_local_usage = nparams + nothers
4.213 - self.finalised = 1
4.214 + self.finalised = True
4.215
4.216 def _finalise_parameters(self):
4.217 if not self.argnames:
4.218 @@ -2174,22 +2174,22 @@
4.219 self.count = count
4.220
4.221 def __eq__(self, other):
4.222 - return 0
4.223 + return False
4.224
4.225 __lt__ = __le__ = __eq__
4.226
4.227 def __ne__(self, other):
4.228 - return 1
4.229 + return True
4.230
4.231 def __gt__(self, other):
4.232 if isinstance(other, AtLeast):
4.233 - return 0
4.234 + return False
4.235 else:
4.236 return self.count > other
4.237
4.238 def __ge__(self, other):
4.239 if isinstance(other, AtLeast):
4.240 - return 0
4.241 + return False
4.242 else:
4.243 return self.count >= other
4.244
5.1 --- a/micropython/graph.py Tue Jul 10 01:36:34 2012 +0200
5.2 +++ b/micropython/graph.py Tue Jul 10 18:54:33 2012 +0200
5.3 @@ -88,11 +88,11 @@
5.4 attr = objtable.access(objname, attrname)
5.5 except TableError:
5.6 #print >>sys.stderr, "%s.%s not found!" % (objname, attrname)
5.7 - return 0
5.8 + return False
5.9
5.10 for value in attr.get_values():
5.11 if isinstance(value, allowed_types):
5.12 - return 1
5.13 - return 0
5.14 + return True
5.15 + return False
5.16
5.17 # vim: tabstop=4 expandtab shiftwidth=4
6.1 --- a/micropython/inspect.py Tue Jul 10 01:36:34 2012 +0200
6.2 +++ b/micropython/inspect.py Tue Jul 10 18:54:33 2012 +0200
6.3 @@ -111,19 +111,19 @@
6.4
6.5 self.optimisations = self.importer.optimisations
6.6 self.builtins = self.importer.modules.get("__builtins__")
6.7 - self.loaded = 0
6.8 - self.completed = 0
6.9 + self.loaded = False
6.10 + self.completed = False
6.11
6.12 # Current expression state.
6.13
6.14 self.expr = None
6.15 - self.in_assignment = 0 # For slice and subscript handling.
6.16 + self.in_assignment = False # For slice and subscript handling.
6.17
6.18 # Namespace state.
6.19
6.20 - self.in_method = 0 # Find instance attributes in all methods.
6.21 - self.in_function = 0 # Note function presence, affecting definitions.
6.22 - self.in_loop = 0 # Note loop "membership", affecting assignments.
6.23 + self.in_method = False # Find instance attributes in all methods.
6.24 + self.in_function = False # Note function presence, affecting definitions.
6.25 + self.in_loop = False # Note loop "membership", affecting assignments.
6.26 self.namespaces = []
6.27 self.functions = []
6.28
6.29 @@ -139,7 +139,7 @@
6.30
6.31 def complete(self):
6.32 if not self.completed:
6.33 - self.completed = 1
6.34 + self.completed = True
6.35 self.process()
6.36 if self.importer.verbose:
6.37 print >>sys.stderr, "Completed import of", self.full_name()
6.38 @@ -794,19 +794,19 @@
6.39 # Previous namespace is the class.
6.40
6.41 if self.in_class(namespaces):
6.42 - self.in_method = 1
6.43 + self.in_method = True
6.44
6.45 in_function = self.in_function
6.46 in_loop = self.in_loop
6.47 - self.in_function = 1
6.48 - self.in_loop = 0
6.49 + self.in_function = True
6.50 + self.in_loop = False
6.51
6.52 self.namespaces = namespaces
6.53 self.dispatch(node.code)
6.54
6.55 self.in_loop = in_loop
6.56 self.in_function = in_function
6.57 - self.in_method = 0
6.58 + self.in_method = False
6.59
6.60 # Specific handler methods.
6.61
6.62 @@ -818,10 +818,10 @@
6.63
6.64 def visitAssign(self, node):
6.65 self.expr = self.dispatch(node.expr)
6.66 - self.in_assignment = 1
6.67 + self.in_assignment = True
6.68 for n in node.nodes:
6.69 self.dispatch(n)
6.70 - self.in_assignment = 0
6.71 + self.in_assignment = False
6.72
6.73 def visitAssAttr(self, node):
6.74 expr = self.dispatch(node.expr)
6.75 @@ -1061,7 +1061,7 @@
6.76 self.use_name("StopIteration")
6.77
6.78 in_loop = self.in_loop
6.79 - self.in_loop = 1
6.80 + self.in_loop = True
6.81 self.dispatch(node.list)
6.82
6.83 # NOTE: Could generate AST nodes for the actual operations instead of
6.84 @@ -1249,7 +1249,7 @@
6.85 self.use_name("next")
6.86
6.87 in_loop = self.in_loop
6.88 - self.in_loop = 1
6.89 + self.in_loop = True
6.90 self.dispatch(node.list)
6.91
6.92 # NOTE: Could generate AST nodes for the actual operations instead of
6.93 @@ -1409,7 +1409,7 @@
6.94 # Propagate attribute usage to branches.
6.95
6.96 in_loop = self.in_loop
6.97 - self.in_loop = 1
6.98 + self.in_loop = True
6.99
6.100 # The test is evaluated initially and again in the loop.
6.101
7.1 --- a/micropython/objectset.py Tue Jul 10 01:36:34 2012 +0200
7.2 +++ b/micropython/objectset.py Tue Jul 10 18:54:33 2012 +0200
7.3 @@ -42,12 +42,12 @@
7.4
7.5 def __repr__(self):
7.6 out = ["{"]
7.7 - first = 1
7.8 + first = True
7.9 for key, value in self.items():
7.10 if not first:
7.11 out.append(", ")
7.12 else:
7.13 - first = 0
7.14 + first = False
7.15 out.append(repr(key))
7.16 if value:
7.17 out.append(" : ")
8.1 --- a/micropython/opt.py Tue Jul 10 01:36:34 2012 +0200
8.2 +++ b/micropython/opt.py Tue Jul 10 18:54:33 2012 +0200
8.3 @@ -365,7 +365,7 @@
8.4 """
8.5
8.6 if not (isinstance(unit, Function) and unit.is_method()):
8.7 - return 0
8.8 + return False
8.9
8.10 expr = self.get_active_value("working")
8.11 return expr and isinstance(expr, LoadName) and expr.attr.name == "self"
8.12 @@ -378,9 +378,9 @@
8.13
8.14 parent = unit.parent
8.15 if parent is context or parent.has_subclass(context) or context.has_subclass(parent):
8.16 - return 1
8.17 + return True
8.18
8.19 - return 0
8.20 + return False
8.21
8.22 def have_empty_handler(self, instruction):
8.23
8.24 @@ -531,8 +531,8 @@
8.25
8.26 if self.should_optimise_unused_handlers() and self.have_empty_handler(instruction):
8.27 self.translation.remove_op()
8.28 - return 1
8.29 + return True
8.30 else:
8.31 - return 0
8.32 + return False
8.33
8.34 # vim: tabstop=4 expandtab shiftwidth=4
9.1 --- a/micropython/report.py Tue Jul 10 01:36:34 2012 +0200
9.2 +++ b/micropython/report.py Tue Jul 10 18:54:33 2012 +0200
9.3 @@ -335,12 +335,12 @@
9.4 names.sort()
9.5
9.6 self._names_list_start(label, classes)
9.7 - first = 1
9.8 + first = True
9.9 for name in names:
9.10 if not first:
9.11 self.stream.write("<br />")
9.12 self.stream.write(name)
9.13 - first = 0
9.14 + first = False
9.15 self._names_list_end()
9.16
9.17 def _attrcombined(self, name, node):
9.18 @@ -350,7 +350,7 @@
9.19 if attrnames:
9.20 break
9.21 else:
9.22 - return 0
9.23 + return False
9.24
9.25 self._name_start()
9.26 self.stream.write(name)
9.27 @@ -359,7 +359,7 @@
9.28 self._attrnames(attrnames)
9.29 self._popup_end()
9.30 self._name_end()
9.31 - return 1
9.32 + return True
9.33
9.34 def _attrnames(self, attrnames):
9.35 self._names_list(attrnames, "attributes", "attrnames")
9.36 @@ -686,14 +686,14 @@
9.37
9.38 if bases and not (len(bases) == 1 and bases[0].name == "object"):
9.39 self.stream.write("(")
9.40 - first = 1
9.41 + first = True
9.42 for base in bases:
9.43 if not first:
9.44 self.stream.write(", ")
9.45
9.46 self._object_name_ref(base.module, base)
9.47
9.48 - first = 0
9.49 + first = False
9.50 self.stream.write(")")
9.51
9.52 self.stream.write(":\n")
9.53 @@ -755,7 +755,7 @@
9.54 self._keyword("from")
9.55 self._module_link(node.modname)
9.56 self._keyword("import", 1)
9.57 - first = 1
9.58 + first = True
9.59 for name, alias in node.names:
9.60 if not first:
9.61 self.stream.write(", ")
9.62 @@ -763,7 +763,7 @@
9.63 if alias:
9.64 self._keyword("as", 1)
9.65 self._name(alias)
9.66 - first = 0
9.67 + first = False
9.68 self.stream.write("</div>\n")
9.69
9.70 def visitFunction(self, node):
9.71 @@ -799,17 +799,17 @@
9.72 def visitGlobal(self, node):
9.73 self.stream.write("<div class='global nowrap'>\n")
9.74 self._keyword("global")
9.75 - first = 1
9.76 + first = True
9.77 for name in node.names:
9.78 if not first:
9.79 self.stream.write(", ")
9.80 self.stream.write(name)
9.81 - first = 0
9.82 + first = False
9.83 self.stream.write("</div>\n")
9.84
9.85 def visitIf(self, node):
9.86 self.stream.write("<div class='if nowrap'>\n")
9.87 - first = 1
9.88 + first = True
9.89 for compare, stmt in node.tests:
9.90 self.stream.write("<div>\n")
9.91 if first:
9.92 @@ -822,7 +822,7 @@
9.93 self.stream.write("<div class='body nowrap'>\n")
9.94 self.dispatch(stmt)
9.95 self.stream.write("</div>\n")
9.96 - first = 0
9.97 + first = False
9.98 if node.else_ is not None:
9.99 self.stream.write("<div>\n")
9.100 self._keyword("else", trailing=0)
9.101 @@ -836,7 +836,7 @@
9.102 def visitImport(self, node):
9.103 self.stream.write("<div class='import nowrap'>\n")
9.104 self._keyword("import")
9.105 - first = 1
9.106 + first = True
9.107 for name, alias in node.names:
9.108 if not first:
9.109 self.stream.write(",\n")
9.110 @@ -844,7 +844,7 @@
9.111 if alias:
9.112 self._keyword("as", 1)
9.113 self._name(alias)
9.114 - first = 0
9.115 + first = False
9.116 self.stream.write("</div>\n")
9.117
9.118 def visitPass(self, node):
9.119 @@ -870,14 +870,14 @@
9.120 if node.dest is not None:
9.121 self.stream.write(">>\n")
9.122 self.dispatch(node.dest)
9.123 - first = 0
9.124 + first = False
9.125 else:
9.126 - first = 1
9.127 + first = True
9.128 for n in node.nodes:
9.129 if not first:
9.130 self.stream.write(",\n")
9.131 self.dispatch(n)
9.132 - first = 0
9.133 + first = False
9.134 self.stream.write("</div>\n")
9.135
9.136 def visitRaise(self, node):
9.137 @@ -985,12 +985,12 @@
9.138 def _visitBitBinary(self, node, symbol):
9.139 name = operator_functions[node.__class__.__name__]
9.140 self._span_start(name)
9.141 - first = 1
9.142 + first = True
9.143 for node in node.nodes:
9.144 if not first:
9.145 self._op(symbol, name, 1)
9.146 self.dispatch(node)
9.147 - first = 0
9.148 + first = False
9.149 self._span_end()
9.150
9.151 def _visitBinary(self, node, symbol):
9.152 @@ -1015,12 +1015,12 @@
9.153
9.154 def visitAnd(self, node):
9.155 self._span_start("and")
9.156 - first = 1
9.157 + first = True
9.158 for n in node.nodes:
9.159 if not first:
9.160 self._keyword("and", 1)
9.161 self.dispatch(n)
9.162 - first = 0
9.163 + first = False
9.164 self._span_end()
9.165
9.166 def visitAssAttr(self, node):
9.167 @@ -1075,22 +1075,22 @@
9.168 self.dispatch(node.node)
9.169 self._span_start("call")
9.170 self.stream.write("(")
9.171 - first = 1
9.172 + first = True
9.173 for arg in node.args:
9.174 if not first:
9.175 self.stream.write(", ")
9.176 self.dispatch(arg)
9.177 - first = 0
9.178 + first = False
9.179 if node.star_args is not None:
9.180 if not first:
9.181 self.stream.write(", *")
9.182 self.dispatch(node.star_args)
9.183 - first = 0
9.184 + first = False
9.185 if node.dstar_args is not None:
9.186 if not first:
9.187 self.stream.write(", **")
9.188 self.dispatch(node.dstar_args)
9.189 - first = 0
9.190 + first = False
9.191 self.stream.write(")")
9.192 self._span_end()
9.193 self._span_end()
9.194 @@ -1277,12 +1277,12 @@
9.195
9.196 def visitOr(self, node):
9.197 self._span_start("or")
9.198 - first = 1
9.199 + first = True
9.200 for n in node.nodes:
9.201 if not first:
9.202 self._keyword("or", 1)
9.203 self.dispatch(n)
9.204 - first = 0
9.205 + first = False
9.206 self._span_end()
9.207
9.208 def visitPower(self, node):
9.209 @@ -1306,7 +1306,7 @@
9.210
9.211 def visitSliceobj(self, node):
9.212 self._span_start("sliceobj")
9.213 - first = 1
9.214 + first = True
9.215 for n in node.nodes:
9.216 if not first:
9.217 self.stream.write(":")
9.218 @@ -1320,12 +1320,12 @@
9.219 self._span_start("subscript")
9.220 self.dispatch(node.expr)
9.221 self.stream.write("[")
9.222 - first = 1
9.223 + first = True
9.224 for sub in node.subs:
9.225 if not first:
9.226 self.stream.write(", ")
9.227 self.dispatch(sub)
9.228 - first = 0
9.229 + first = False
9.230 self.stream.write("]")
9.231 self._span_end()
9.232
9.233 @@ -1340,29 +1340,29 @@
9.234 # Output preparation methods.
9.235
9.236 def _sequence(self, node):
9.237 - first = 1
9.238 + first = True
9.239 for n in node.nodes:
9.240 if not first:
9.241 self.stream.write(", ")
9.242 self.dispatch(n)
9.243 - first = 0
9.244 + first = False
9.245
9.246 def _mapping(self, node):
9.247 - first = 1
9.248 + first = True
9.249 for k, v in node.items:
9.250 if not first:
9.251 self.stream.write(", ")
9.252 self.dispatch(k)
9.253 self.stream.write(" : ")
9.254 self.dispatch(v)
9.255 - first = 0
9.256 + first = False
9.257
9.258 def _parameters(self, fn, node):
9.259 nparams = len(fn.positional_names)
9.260 ndefaults = len(fn.defaults)
9.261 first_with_default = nparams - ndefaults
9.262
9.263 - first = 1
9.264 + first = True
9.265 for n, param in enumerate(fn.positional_names):
9.266 if not first:
9.267 self.stream.write(", ")
9.268 @@ -1377,7 +1377,7 @@
9.269 n_default = n - first_with_default
9.270 if n_default >= 0:
9.271 self._default(fn.defaults[n_default])
9.272 - first = 0
9.273 + first = False
9.274
9.275 if fn.has_star:
9.276 if not first:
9.277 @@ -1392,7 +1392,7 @@
9.278 def _tuple_parameter(self, parameters, node):
9.279 self.stream.write("(")
9.280
9.281 - first = 1
9.282 + first = True
9.283 for param in parameters:
9.284 if not first:
9.285 self.stream.write(", ")
9.286 @@ -1404,7 +1404,7 @@
9.287 else:
9.288 self._assname(param, node)
9.289
9.290 - first = 0
9.291 + first = False
9.292
9.293 self.stream.write(")")
9.294
10.1 --- a/micropython/table.py Tue Jul 10 01:36:34 2012 +0200
10.2 +++ b/micropython/table.py Tue Jul 10 18:54:33 2012 +0200
10.3 @@ -124,8 +124,8 @@
10.4 break
10.5 element = self.displaced[i + offset]
10.6 if attr is not None and element is not None:
10.7 - return 0
10.8 - return 1
10.9 + return False
10.10 + return True
10.11
10.12 def _add_row(self, offset, attributes, len_displaced):
10.13
10.14 @@ -312,10 +312,10 @@
10.15
10.16 possible = []
10.17 for objname, attributes in self.table.items():
10.18 - found = 1
10.19 + found = True
10.20 for name in names:
10.21 if not attributes.has_key(name):
10.22 - found = 0
10.23 + found = False
10.24 break
10.25 if found:
10.26 possible.append(objname)
10.27 @@ -332,10 +332,10 @@
10.28
10.29 possible = []
10.30 for objname, attributes in self.table.items():
10.31 - found = 0
10.32 + found = False
10.33 for name in names:
10.34 if attributes.has_key(name):
10.35 - found = 1
10.36 + found = True
10.37 break
10.38 if found:
10.39 possible.append(objname)
10.40 @@ -398,8 +398,8 @@
10.41 for objname in fn(names):
10.42 attributes = self.table[objname]
10.43
10.44 - is_static = 0
10.45 - is_instance = 0
10.46 + is_static = False
10.47 + is_instance = False
10.48
10.49 for name in names:
10.50 if not attributes.has_key(name):
10.51 @@ -409,14 +409,14 @@
10.52 if isinstance(attr, (Class, Module)):
10.53 pass
10.54 elif attr.is_static_attribute():
10.55 - is_static = 1
10.56 + is_static = True
10.57 else:
10.58 - is_instance = 1
10.59 + is_instance = True
10.60
10.61 if is_static and not is_instance:
10.62 - is_static = 1
10.63 + is_static = True
10.64 else:
10.65 - is_static = 0
10.66 + is_static = False
10.67
10.68 possible.append((objname, is_static))
10.69
11.1 --- a/micropython/trans.py Tue Jul 10 01:36:34 2012 +0200
11.2 +++ b/micropython/trans.py Tue Jul 10 18:54:33 2012 +0200
11.3 @@ -443,13 +443,13 @@
11.4
11.5 # Find keyword arguments in advance in order to help resolve targets.
11.6
11.7 - have_keywords = 0
11.8 + have_keywords = False
11.9
11.10 for arg in args:
11.11 if isinstance(arg, compiler.ast.Keyword):
11.12 employed_keywords.add(arg.name)
11.13 keyword_args.append(arg)
11.14 - have_keywords = 1
11.15 + have_keywords = True
11.16 elif not have_keywords:
11.17 positional_args.append(arg)
11.18
11.19 @@ -461,7 +461,7 @@
11.20
11.21 if target is None or isinstance(context, Instance):
11.22 ncontext = 1
11.23 - expect_testable_self = 0
11.24 + expect_testable_self = False
11.25
11.26 # Handle calls to classes by obtaining the instantiator function.
11.27 # A context is reserved for the new instance, but this is not provided
11.28 @@ -470,25 +470,25 @@
11.29
11.30 elif isinstance(target, Class):
11.31 ncontext = 1
11.32 - expect_testable_self = 0
11.33 + expect_testable_self = False
11.34 target = target.get_instantiator()
11.35
11.36 # Method calls via classes.
11.37
11.38 elif isinstance(context, Class):
11.39 ncontext = 0
11.40 - expect_testable_self = 1
11.41 + expect_testable_self = True
11.42
11.43 # Function calls.
11.44
11.45 else:
11.46 ncontext = 0
11.47 - expect_testable_self = 0
11.48 + expect_testable_self = False
11.49
11.50 # Traverse the positional arguments adding them using the incrementing
11.51 # frame position.
11.52
11.53 - first = 1
11.54 + first = True
11.55 frame_pos = ncontext
11.56 temp_first_argument = None
11.57
11.58 @@ -511,7 +511,7 @@
11.59
11.60 temp_first_argument = self.optimiser.optimise_temp_storage()
11.61
11.62 - first = 0
11.63 + first = False
11.64 frame_pos += 1
11.65
11.66 # Adjust the invocation frame for unknown invocations.