[Zope-Checkins] CVS: Zope/lib/python/RestrictedPython/compiler_2_1 - __init__.py:1.3 ast.py:1.3 future.py:1.3 misc.py:1.3 pyassem.py:1.3 pycodegen.py:1.3 symbols.py:1.3 transformer.py:1.3 visitor.py:1.3
Martijn Pieters
mj@zope.com
Wed, 14 Aug 2002 17:44:32 -0400
Update of /cvs-repository/Zope/lib/python/RestrictedPython/compiler_2_1
In directory cvs.zope.org:/tmp/cvs-serv15625/compiler_2_1
Modified Files:
__init__.py ast.py future.py misc.py pyassem.py pycodegen.py
symbols.py transformer.py visitor.py
Log Message:
Clean up indentation and trailing whitespace.
=== Zope/lib/python/RestrictedPython/compiler_2_1/__init__.py 1.2 => 1.3 ===
--- Zope/lib/python/RestrictedPython/compiler_2_1/__init__.py:1.2 Fri Dec 21 14:34:48 2001
+++ Zope/lib/python/RestrictedPython/compiler_2_1/__init__.py Wed Aug 14 17:44:31 2002
@@ -21,4 +21,3 @@
from transformer import parse, parseFile
from visitor import walk
from pycodegen import compile
-
=== Zope/lib/python/RestrictedPython/compiler_2_1/ast.py 1.2 => 1.3 ===
--- Zope/lib/python/RestrictedPython/compiler_2_1/ast.py:1.2 Fri Dec 21 14:34:48 2001
+++ Zope/lib/python/RestrictedPython/compiler_2_1/ast.py Wed Aug 14 17:44:31 2002
@@ -496,7 +496,7 @@
self.varargs = 1
if flags & CO_VARKEYWORDS:
self.kwargs = 1
-
+
def _getChildren(self):
return self.name, self.argnames, self.defaults, self.flags, self.doc, self.code
=== Zope/lib/python/RestrictedPython/compiler_2_1/future.py 1.2 => 1.3 ===
--- Zope/lib/python/RestrictedPython/compiler_2_1/future.py:1.2 Fri Dec 21 14:34:48 2001
+++ Zope/lib/python/RestrictedPython/compiler_2_1/future.py Wed Aug 14 17:44:31 2002
@@ -17,7 +17,7 @@
class FutureParser:
features = ("nested_scopes",)
-
+
def __init__(self):
self.found = {} # set
@@ -76,4 +76,3 @@
walk(tree, v)
print v.found
print
-
=== Zope/lib/python/RestrictedPython/compiler_2_1/misc.py 1.2 => 1.3 ===
--- Zope/lib/python/RestrictedPython/compiler_2_1/misc.py:1.2 Fri Dec 21 14:34:48 2001
+++ Zope/lib/python/RestrictedPython/compiler_2_1/misc.py Wed Aug 14 17:44:31 2002
@@ -64,4 +64,3 @@
klass = klass[:MANGLE_LEN-tlen]
return "_%s%s" % (klass, name)
-
=== Zope/lib/python/RestrictedPython/compiler_2_1/pyassem.py 1.2 => 1.3 ===
--- Zope/lib/python/RestrictedPython/compiler_2_1/pyassem.py:1.2 Fri Dec 21 14:34:48 2001
+++ Zope/lib/python/RestrictedPython/compiler_2_1/pyassem.py Wed Aug 14 17:44:31 2002
@@ -657,7 +657,7 @@
class LineAddrTable:
"""lnotab
-
+
This class builds the lnotab, which is documented in compile.c.
Here's a brief recap:
=== Zope/lib/python/RestrictedPython/compiler_2_1/pycodegen.py 1.2 => 1.3 ===
--- Zope/lib/python/RestrictedPython/compiler_2_1/pycodegen.py:1.2 Fri Dec 21 14:34:48 2001
+++ Zope/lib/python/RestrictedPython/compiler_2_1/pycodegen.py Wed Aug 14 17:44:31 2002
@@ -143,7 +143,7 @@
NameFinder, FunctionGen, and ClassGen. These attributes can be
defined in the initClass() method, which is a hook for
initializing these methods after all the classes have been
- defined.
+ defined.
"""
optimized = 0 # is namespace access optimized?
@@ -245,7 +245,7 @@
self.emit(prefix + '_NAME', name)
def set_lineno(self, node, force=0):
- """Emit SET_LINENO if node has lineno attribute and it is
+ """Emit SET_LINENO if node has lineno attribute and it is
different than the last lineno emitted.
Returns true if SET_LINENO was emitted.
@@ -475,7 +475,7 @@
# list comprehensions
__list_count = 0
-
+
def visitListComp(self, node):
self.set_lineno(node)
# setup list
@@ -485,7 +485,7 @@
self.emit('DUP_TOP')
self.emit('LOAD_ATTR', 'append')
self._implicitNameOp('STORE', append)
-
+
stack = []
for i, for_ in zip(range(len(node.quals)), node.quals):
start, anchor = self.visit(for_)
@@ -500,7 +500,7 @@
self.visit(node.expr)
self.emit('CALL_FUNCTION', 1)
self.emit('POP_TOP')
-
+
for start, cont, anchor in stack:
if cont:
skip_one = self.newBlock()
@@ -511,7 +511,7 @@
self.emit('JUMP_ABSOLUTE', start)
self.startBlock(anchor)
self._implicitNameOp('DELETE', append)
-
+
self.__list_count = self.__list_count - 1
def visitListCompFor(self, node):
@@ -592,7 +592,7 @@
self.setups.pop()
self.emit('JUMP_FORWARD', lElse)
self.startBlock(handlers)
-
+
last = len(node.handlers) - 1
for i in range(len(node.handlers)):
expr, target, body = node.handlers[i]
@@ -623,7 +623,7 @@
self.nextBlock(lElse)
self.visit(node.else_)
self.nextBlock(end)
-
+
def visitTryFinally(self, node):
body = self.newBlock()
final = self.newBlock()
@@ -662,7 +662,7 @@
def visitName(self, node):
self.set_lineno(node)
self.loadName(node.name)
-
+
def visitPass(self, node):
self.set_lineno(node)
@@ -1104,7 +1104,7 @@
self.emit('CALL_FUNCTION', 0)
self.emit('BUILD_CLASS')
self.storeName(node.name)
-
+
class LGBScopeMixin:
"""Defines initClass() for Python 2.1-compatible scoping"""
@@ -1124,7 +1124,7 @@
__super_init = CodeGenerator.__init__
scopes = None
-
+
def __init__(self, filename):
self.graph = pyassem.PyFlowGraph("<module>", filename)
self.__super_init(filename)
@@ -1132,7 +1132,7 @@
class NestedScopeModuleCodeGenerator(NestedScopeMixin,
NestedScopeCodeGenerator):
__super_init = CodeGenerator.__init__
-
+
def __init__(self, filename):
self.graph = pyassem.PyFlowGraph("<module>", filename)
self.__super_init(filename)
@@ -1153,8 +1153,8 @@
else:
name = func.name
args, hasTupleArg = generateArgList(func.argnames)
- self.graph = pyassem.PyFlowGraph(name, filename, args,
- optimized=1)
+ self.graph = pyassem.PyFlowGraph(name, filename, args,
+ optimized=1)
self.isLambda = isLambda
self.super_init(filename)
@@ -1183,7 +1183,7 @@
if type(arg) == types.TupleType:
self.emit('LOAD_FAST', '.%d' % (i * 2))
self.unpackSequence(arg)
-
+
def unpackSequence(self, tup):
if VERSION > 1:
self.emit('UNPACK_SEQUENCE', len(tup))
@@ -1198,7 +1198,7 @@
unpackTuple = unpackSequence
class FunctionCodeGenerator(LGBScopeMixin, AbstractFunctionCode,
- CodeGenerator):
+ CodeGenerator):
super_init = CodeGenerator.__init__ # call be other init
scopes = None
=== Zope/lib/python/RestrictedPython/compiler_2_1/symbols.py 1.2 => 1.3 ===
--- Zope/lib/python/RestrictedPython/compiler_2_1/symbols.py:1.2 Fri Dec 21 14:34:48 2001
+++ Zope/lib/python/RestrictedPython/compiler_2_1/symbols.py Wed Aug 14 17:44:31 2002
@@ -130,7 +130,7 @@
rather than free.
Be careful to stop if a child does not think the name is
- free.
+ free.
"""
self.globals[name] = 1
if self.frees.has_key(name):
@@ -171,7 +171,7 @@
class ModuleScope(Scope):
__super_init = Scope.__init__
-
+
def __init__(self):
self.__super_init("global", self)
@@ -182,7 +182,7 @@
__super_init = Scope.__init__
__counter = 1
-
+
def __init__(self, module, klass=None):
i = self.__counter
self.__counter += 1
@@ -198,7 +198,7 @@
def __init__(self):
self.scopes = {}
self.klass = None
-
+
# node that define new scopes
def visitModule(self, node):
@@ -217,7 +217,7 @@
self.visit(node.code, scope)
self.handle_free_vars(scope, parent)
scope.DEBUG()
-
+
def visitLambda(self, node, parent):
for n in node.defaults:
self.visit(n, parent)
@@ -368,8 +368,8 @@
def get_names(syms):
return [s for s in [s.get_name() for s in syms.get_symbols()]
- if not (s.startswith('_[') or s.startswith('.'))]
-
+ if not (s.startswith('_[') or s.startswith('.'))]
+
for file in sys.argv[1:]:
print file
f = open(file)
=== Zope/lib/python/RestrictedPython/compiler_2_1/transformer.py 1.2 => 1.3 ===
--- Zope/lib/python/RestrictedPython/compiler_2_1/transformer.py:1.2 Fri Dec 21 14:34:48 2001
+++ Zope/lib/python/RestrictedPython/compiler_2_1/transformer.py Wed Aug 14 17:44:31 2002
@@ -659,14 +659,14 @@
n = Backquote(self.com_node(nodelist[1]))
n.lineno = nodelist[0][2]
return n
-
+
def atom_number(self, nodelist):
### need to verify this matches compile.c
k = eval(nodelist[0][1])
n = Const(k)
n.lineno = nodelist[0][2]
return n
-
+
def atom_string(self, nodelist):
### need to verify this matches compile.c
k = ''
@@ -699,7 +699,7 @@
# here, Render it harmless. (genc discards ('discard',
# ('const', xxxx)) Nodes)
return Discard(Const(None))
-
+
def com_arglist(self, nodelist):
# varargslist:
# (fpdef ['=' test] ',')* ('*' NAME [',' ('**'|'*' '*') NAME]
@@ -758,7 +758,7 @@
return node[1][1]
def com_fplist(self, node):
- # fplist: fpdef (',' fpdef)* [',']
+ # fplist: fpdef (',' fpdef)* [',']
if len(node) == 2:
return self.com_fpdef(node[1])
list = []
@@ -807,7 +807,7 @@
def com_try_finally(self, nodelist):
# try_fin_stmt: "try" ":" suite "finally" ":" suite
n = TryFinally(self.com_node(nodelist[2]),
- self.com_node(nodelist[5]))
+ self.com_node(nodelist[5]))
n.lineno = nodelist[0][2]
return n
@@ -875,7 +875,7 @@
raise SyntaxError, "can't assign to operator"
primary = self.com_apply_trailer(primary, ch)
return self.com_assign_trailer(primary, node[-1],
- assigning)
+ assigning)
node = node[1]
elif t == symbol.atom:
t = node[1][0]
@@ -970,7 +970,7 @@
# list_if: 'if' test [list_iter]
# XXX should raise SyntaxError for assignment
-
+
lineno = node[1][2]
fors = []
while node:
@@ -1047,7 +1047,7 @@
for i in range(1, len_nodelist, 2):
node = nodelist[i]
if node[0] == token.STAR or node[0] == token.DOUBLESTAR:
- break
+ break
kw, result = self.com_argument(node, kw)
args.append(result)
else:
@@ -1092,7 +1092,7 @@
def com_subscriptlist(self, primary, nodelist, assigning):
# slicing: simple_slicing | extended_slicing
# simple_slicing: primary "[" short_slice "]"
- # extended_slicing: primary "[" slice_list "]"
+ # extended_slicing: primary "[" slice_list "]"
# slice_list: slice_item ("," slice_item)* [","]
# backwards compat slice for '[i:j]'
=== Zope/lib/python/RestrictedPython/compiler_2_1/visitor.py 1.2 => 1.3 ===
--- Zope/lib/python/RestrictedPython/compiler_2_1/visitor.py:1.2 Fri Dec 21 14:34:48 2001
+++ Zope/lib/python/RestrictedPython/compiler_2_1/visitor.py Wed Aug 14 17:44:31 2002
@@ -79,7 +79,7 @@
you still have to do.
"""
examples = {}
-
+
def dispatch(self, node, *args):
self.node = node
meth = self._cache.get(node.__class__, None)