]> granicus.if.org Git - python/commitdiff
Whitespace normalization.
authorTim Peters <tim.peters@gmail.com>
Thu, 18 Oct 2001 21:57:37 +0000 (21:57 +0000)
committerTim Peters <tim.peters@gmail.com>
Thu, 18 Oct 2001 21:57:37 +0000 (21:57 +0000)
19 files changed:
Lib/ConfigParser.py
Lib/compiler/__init__.py
Lib/compiler/ast.py
Lib/compiler/future.py
Lib/compiler/misc.py
Lib/compiler/pyassem.py
Lib/compiler/pycodegen.py
Lib/compiler/symbols.py
Lib/compiler/transformer.py
Lib/compiler/visitor.py
Lib/test/pickletester.py
Lib/test/regrtest.py
Lib/test/test_binascii.py
Lib/test/test_cpickle.py
Lib/test/test_email.py
Lib/test/test_os.py
Lib/test/test_pickle.py
Lib/test/test_socket_ssl.py
Lib/test/test_zlib.py

index 788c6593ad5ae73c30175464ab7f867aee1c16aa..190b6942f35bad5d504e3cbda1338a6c403dc90a 100644 (file)
@@ -309,7 +309,7 @@ class ConfigParser:
     def getboolean(self, section, option):
         states = {'1': 1, 'yes': 1, 'true': 1, 'on': 1,
                   '0': 0, 'no': 0, 'false': 0, 'off': 0}
-        v = self.get(section, option)       
+        v = self.get(section, option)
         if not states.has_key(v.lower()):
             raise ValueError, 'Not a boolean: %s' % v
         return states[v.lower()]
index 1267b0c780956e4651b6cb4cb5b42c57130077b7..13b05bfbe2274f39585ba297383b72843c7c694b 100644 (file)
@@ -15,7 +15,7 @@ walk(ast, visitor, verbose=None)
     See compiler.visitor for details.
 
 compile(source, filename, mode, flags=None, dont_inherit=None)
-    Returns a code object.  A replacement for the builtin compile() function. 
+    Returns a code object.  A replacement for the builtin compile() function.
 
 compileFile(filename)
     Generates a .pyc file by compiling filename.
@@ -24,4 +24,3 @@ compileFile(filename)
 from transformer import parse, parseFile
 from visitor import walk
 from pycodegen import compile, compileFile
-
index 9a5d53cafcdef048b205c6272f11b82dc1b62f60..23c463b39895b552baac93f3a9a8177fee0391f8 100644 (file)
@@ -438,7 +438,7 @@ class Function(Node):
             self.varargs = 1
         if flags & CO_VARKEYWORDS:
             self.kwargs = 1
-    
+
 
 
     def getChildren(self):
index 09ffe4a544660f81dea933204dd5019751f3b1fa..868b7cbb52280ba64f1886e16f43932b75c67294 100644 (file)
@@ -16,7 +16,7 @@ def is_future(stmt):
 class FutureParser:
 
     features = ("nested_scopes", "generators", "division")
-    
+
     def __init__(self):
         self.found = {} # set
 
@@ -70,4 +70,3 @@ if __name__ == "__main__":
         walk(tree, v)
         print v.found
         print
-
index b4bbe78050c261b60ef44f51f10bba3422a8b3e4..6d5eaa83b0d3f57775da7d60be1d022ec7fa878a 100644 (file)
@@ -72,4 +72,3 @@ def set_filename(filename, tree):
         node = worklist.pop(0)
         node.filename = filename
         worklist.extend(node.getChildNodes())
-        
index cc2d10828b034b8e86b837705c812b4f8590175a..26b900135c490f807fcb732be3a9b41c6074848b 100644 (file)
@@ -55,7 +55,7 @@ class FlowGraph:
         # these edges to get the blocks emitted in the right order,
         # however. :-(  If a client needs to remove these edges, call
         # pruneEdges().
-        
+
         self.current.addNext(block)
         self.startBlock(block)
 
@@ -110,13 +110,13 @@ class FlowGraph:
 
         # XXX This is a total mess.  There must be a better way to get
         # the code blocks in the right order.
-        
+
         self.fixupOrderHonorNext(blocks, default_next)
         self.fixupOrderForward(blocks, default_next)
 
     def fixupOrderHonorNext(self, blocks, default_next):
         """Fix one problem with DFS.
-        
+
         The DFS uses child block, but doesn't know about the special
         "next" block.  As a result, the DFS can order blocks so that a
         block isn't next to the right block for implicit control
@@ -200,14 +200,14 @@ class FlowGraph:
         for c in chains:
             for b in c:
                 blocks.append(b)
-            
+
     def getBlocks(self):
         return self.blocks.elements()
 
     def getRoot(self):
         """Return nodes appropriate for use with dominator"""
         return self.entry
-    
+
     def getContainedGraphs(self):
         l = []
         for b in self.getBlocks():
@@ -246,7 +246,7 @@ class Block:
     def __str__(self):
         insts = map(str, self.insts)
         return "<block %s %d:\n%s>" % (self.label, self.bid,
-                                       string.join(insts, '\n')) 
+                                       string.join(insts, '\n'))
 
     def emit(self, inst):
         op = inst[0]
@@ -331,7 +331,7 @@ class PyFlowGraph(FlowGraph):
         self.argcount = getArgCount(args)
         self.klass = klass
         if optimized:
-            self.flags = CO_OPTIMIZED | CO_NEWLOCALS 
+            self.flags = CO_OPTIMIZED | CO_NEWLOCALS
         else:
             self.flags = 0
         self.consts = []
@@ -567,7 +567,7 @@ class PyFlowGraph(FlowGraph):
     for name, obj in locals().items():
         if name[:9] == "_convert_":
             opname = name[9:]
-            _converters[opname] = obj            
+            _converters[opname] = obj
     del name, obj, opname
 
     def makeByteCode(self):
@@ -623,7 +623,7 @@ class PyFlowGraph(FlowGraph):
                 elt = elt.getCode()
             l.append(elt)
         return tuple(l)
-            
+
 def isJump(opname):
     if opname[:4] == 'JUMP':
         return 1
@@ -654,7 +654,7 @@ def twobyte(val):
 
 class LineAddrTable:
     """lnotab
-    
+
     This class builds the lnotab, which is documented in compile.c.
     Here's a brief recap:
 
@@ -717,7 +717,7 @@ class LineAddrTable:
 
     def getTable(self):
         return string.join(map(chr, self.lnotab), '')
-    
+
 class StackDepthTracker:
     # XXX 1. need to keep track of stack depth on jumps
     # XXX 2. at least partly as a result, this code is broken
@@ -792,7 +792,7 @@ class StackDepthTracker:
         ('BINARY_', -1),
         ('LOAD_', 1),
         ]
-    
+
     def UNPACK_SEQUENCE(self, count):
         return count-1
     def BUILD_TUPLE(self, count):
@@ -820,5 +820,5 @@ class StackDepthTracker:
             return -2
     def DUP_TOPX(self, argc):
         return argc
-    
+
 findDepth = StackDepthTracker().findDepth
index 3cdf108badd9f9726bcfc657948f438cf113b5f0..88767a48470407ced124e3f14684ab5e568b7e16 100644 (file)
@@ -36,7 +36,7 @@ END_FINALLY = 4
 
 class BlockStack(misc.Stack):
     __super_init = misc.Stack.__init__
-    
+
     def __init__(self):
         self.__super_init(self)
         self.loop = None
@@ -59,7 +59,7 @@ def compile(source, filename, mode, flags=None, dont_inherit=None):
     """Replacement for builtin compile() function"""
     if flags is not None or dont_inherit is not None:
         raise RuntimeError, "not implemented yet"
-    
+
     if mode == "single":
         gen = Interactive(source, filename)
     elif mode == "exec":
@@ -198,7 +198,7 @@ class CodeGenerator:
     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?
@@ -312,7 +312,7 @@ class CodeGenerator:
             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.
@@ -513,7 +513,7 @@ class CodeGenerator:
             self.emit('CONTINUE_LOOP', loop_block)
             self.nextBlock()
         elif kind == END_FINALLY:
-            msg = "'continue' not allowed inside 'finally' clause (%s, %d)"  
+            msg = "'continue' not allowed inside 'finally' clause (%s, %d)"
             raise SyntaxError, msg % (node.filename, node.lineno)
 
     def visitTest(self, node, jump):
@@ -558,7 +558,7 @@ class CodeGenerator:
 
     # list comprehensions
     __list_count = 0
-    
+
     def visitListComp(self, node):
         self.set_lineno(node)
         # setup list
@@ -568,7 +568,7 @@ class CodeGenerator:
         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_)
@@ -583,7 +583,7 @@ class CodeGenerator:
         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()
@@ -594,7 +594,7 @@ class CodeGenerator:
             self.emit('JUMP_ABSOLUTE', start)
             self.startBlock(anchor)
         self._implicitNameOp('DELETE', append)
-        
+
         self.__list_count = self.__list_count - 1
 
     def visitListCompFor(self, node):
@@ -675,7 +675,7 @@ class CodeGenerator:
         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]
@@ -707,7 +707,7 @@ class CodeGenerator:
             self.nextBlock(lElse)
             self.visit(node.else_)
         self.nextBlock(end)
-    
+
     def visitTryFinally(self, node):
         body = self.newBlock()
         final = self.newBlock()
@@ -746,7 +746,7 @@ class CodeGenerator:
     def visitName(self, node):
         self.set_lineno(node)
         self.loadName(node.name)
-        
+
     def visitPass(self, node):
         self.set_lineno(node)
 
@@ -1139,7 +1139,7 @@ class ModuleCodeGenerator(NestedScopeMixin, CodeGenerator):
     __super_init = CodeGenerator.__init__
 
     scopes = None
-    
+
     def __init__(self, tree):
         self.graph = pyassem.PyFlowGraph("<module>", tree.filename)
         self.futures = future.find_futures(tree)
@@ -1154,7 +1154,7 @@ class ExpressionCodeGenerator(NestedScopeMixin, CodeGenerator):
 
     scopes = None
     futures = ()
-    
+
     def __init__(self, tree):
         self.graph = pyassem.PyFlowGraph("<expression>", tree.filename)
         self.__super_init()
@@ -1171,7 +1171,7 @@ class InteractiveCodeGenerator(NestedScopeMixin, CodeGenerator):
 
     scopes = None
     futures = ()
-    
+
     def __init__(self, tree):
         self.graph = pyassem.PyFlowGraph("<interactive>", tree.filename)
         self.__super_init()
@@ -1201,8 +1201,8 @@ class AbstractFunctionCode:
         else:
             name = func.name
         args, hasTupleArg = generateArgList(func.argnames)
-        self.graph = pyassem.PyFlowGraph(name, func.filename, args, 
-                                         optimized=1) 
+        self.graph = pyassem.PyFlowGraph(name, func.filename, args,
+                                         optimized=1)
         self.isLambda = isLambda
         self.super_init()
 
@@ -1234,7 +1234,7 @@ class AbstractFunctionCode:
             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))
@@ -1249,7 +1249,7 @@ class AbstractFunctionCode:
     unpackTuple = unpackSequence
 
 class FunctionCodeGenerator(NestedScopeMixin, AbstractFunctionCode,
-                            CodeGenerator): 
+                            CodeGenerator):
     super_init = CodeGenerator.__init__ # call be other init
     scopes = None
 
index bf9a7243d444e139ce1cac92b37a6dc7d93c7920..200341fa29f8a5f3ebbec470126a1fed7da25f56 100644 (file)
@@ -131,7 +131,7 @@ class Scope:
         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):
@@ -172,7 +172,7 @@ class Scope:
 
 class ModuleScope(Scope):
     __super_init = Scope.__init__
-    
+
     def __init__(self):
         self.__super_init("global", self)
 
@@ -183,7 +183,7 @@ class LambdaScope(FunctionScope):
     __super_init = Scope.__init__
 
     __counter = 1
-    
+
     def __init__(self, module, klass=None):
         i = self.__counter
         self.__counter += 1
@@ -199,7 +199,7 @@ class SymbolVisitor:
     def __init__(self):
         self.scopes = {}
         self.klass = None
-        
+
     # node that define new scopes
 
     def visitModule(self, node):
@@ -217,7 +217,7 @@ class SymbolVisitor:
         self._do_args(scope, node.argnames)
         self.visit(node.code, scope)
         self.handle_free_vars(scope, parent)
-        
+
     def visitLambda(self, node, parent):
         for n in node.defaults:
             self.visit(n, parent)
@@ -326,7 +326,7 @@ class SymbolVisitor:
             self.visit(node.lower, scope, 0)
         if node.upper:
             self.visit(node.upper, scope, 0)
-            
+
     def visitAugAssign(self, node, scope):
         # If the LHS is a name, then this counts as assignment.
         # Otherwise, it's just use.
@@ -371,8 +371,8 @@ if __name__ == "__main__":
 
     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)
index 88b3dac1bf335042b095777e5fe11819167171f4..987556102facbb71dd690d9b02d6d8452a93d9cb 100644 (file)
@@ -692,14 +692,14 @@ class Transformer:
         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 = ''
@@ -743,7 +743,7 @@ class Transformer:
         # here, Render it harmless. (genc discards ('discard',
         # ('const', xxxx)) Nodes)
         return Discard(Const(None))
-    
+
     def com_arglist(self, nodelist):
         # varargslist:
         #   (fpdef ['=' test] ',')* ('*' NAME [',' ('**'|'*' '*') NAME]
@@ -805,7 +805,7 @@ class Transformer:
         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 = []
@@ -854,7 +854,7 @@ class Transformer:
     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
 
@@ -922,7 +922,7 @@ class Transformer:
                             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]
@@ -1023,7 +1023,7 @@ class Transformer:
             # list_if: 'if' test [list_iter]
 
             # XXX should raise SyntaxError for assignment
-            
+
             lineno = node[1][2]
             fors = []
             while node:
@@ -1100,7 +1100,7 @@ class Transformer:
         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:
@@ -1145,7 +1145,7 @@ class Transformer:
     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]'
index 0560619c849dc8ffcf32e0b7f1e13d5e3aca7147..d7ae864127980a07376e25faaeebc93381420175 100644 (file)
@@ -78,7 +78,7 @@ class ExampleASTVisitor(ASTVisitor):
     you still have to do.
     """
     examples = {}
-    
+
     def dispatch(self, node, *args):
         self.node = node
         meth = self._cache.get(node.__class__, None)
index 0f36d667fb2a749454e1eb8c4deb08b5dfc0d9be..01e7a938e2cf859418b3bae36e206a1d8c1d946f 100644 (file)
@@ -75,7 +75,7 @@ BINDATA = ']q\x01(K\x00L1L\nG@\x00\x00\x00\x00\x00\x00\x00' + \
           '\x00\x80J\x00\x00\x00\x80(U\x03abcq\x04h\x04(c__main__\n' + \
           'C\nq\x05oq\x06}q\x07(U\x03fooq\x08K\x01U\x03barq\tK\x02ubh' + \
           '\x06tq\nh\nK\x05e.'
-    
+
 def create_data():
     c = C()
     c.foo = 1
index 1f9efa724a2979bc27ca565911751d759e50aa35..05318966dc21b6539e9151209207f3bee3d0ae64 100755 (executable)
@@ -199,7 +199,7 @@ def main(tests=None, testdir=None, verbose=0, quiet=0, generate=0,
     good.sort()
     bad.sort()
     skipped.sort()
-    
+
     if good and not quiet:
         if not bad and not skipped and len(good) > 1:
             print "All",
index 97461f0fb3a80c062b63a10fd806d19bcce272f0..c14f894c0d50ee579f974db1f9e0eb75f5a435cb 100755 (executable)
@@ -113,4 +113,3 @@ else:
 
 # Verify the treatment of Unicode strings
 verify(binascii.hexlify(u'a') == '61', "hexlify failed for Unicode")
-
index 3aebcc05f87e11576df9b791f46efad4b925ed06..8047bc54ee3756fd68f72aa5d1aa09d7186886a1 100644 (file)
@@ -4,7 +4,7 @@ from pickletester import AbstractPickleTests, AbstractPickleModuleTests
 from test_support import run_unittest
 
 class cPickleTests(AbstractPickleTests, AbstractPickleModuleTests):
-    
+
     def setUp(self):
         self.dumps = cPickle.dumps
         self.loads = cPickle.loads
index e0180f7c76b51b9d1a46aae01412e6fd2b4b17b6..4298ec2f871aae900a6838b73aafcf86379c6bcc 100644 (file)
@@ -291,7 +291,7 @@ class TestLongHeaders(unittest.TestCase):
         self.assertEqual(sfp.getvalue(), """\
 From: test@dom.ain
 References: <0@dom.ain> <1@dom.ain> <2@dom.ain> <3@dom.ain> <4@dom.ain>
-       <5@dom.ain> <6@dom.ain> <7@dom.ain> <8@dom.ain> <9@dom.ain>
+\t<5@dom.ain> <6@dom.ain> <7@dom.ain> <8@dom.ain> <9@dom.ain>
 
 Test""")
 
index 6adf109f86d0bce43036c40453ec7b4daac6f120..ae3bcc3f4ea42b0e376c3d98b3802ae2bf37dc71 100644 (file)
@@ -68,7 +68,7 @@ class StatAttributeTests(unittest.TestCase):
         f = open(self.fname, 'wb')
         f.write("ABC")
         f.close()
-        
+
     def tearDown(self):
         os.unlink(self.fname)
         os.rmdir(TESTFN)
@@ -133,7 +133,7 @@ class StatAttributeTests(unittest.TestCase):
         except TypeError:
             pass
 
-            
+
     def test_statvfs_attributes(self):
         if not hasattr(os, "statvfs"):
             return
index e8c7f3037c6f9326bc27614ac01334b2d6481650..06a554e05e30d9b47a9546752a4e0de74dfb551f 100644 (file)
@@ -8,7 +8,7 @@ class PickleTests(AbstractPickleTests, AbstractPickleModuleTests):
     def setUp(self):
         self.dumps = pickle.dumps
         self.loads = pickle.loads
-        
+
     module = pickle
     error = KeyError
 
index 9cf9cfeac60d7df13f4aeefd31d5b01647ed289e..2645876328cade70c3562fc97055e445f40c2824 100644 (file)
@@ -25,6 +25,3 @@ socket.RAND_add("this is a random string", 75.0)
 f = urllib.urlopen('https://sf.net')
 buf = f.read()
 f.close()
-
-
-
index 915f582abe2fc3968161b7fafc626e3ca0aabbd3..88815160f8b8c0e632c5dcaad2488a60ed68cbbd 100644 (file)
@@ -95,7 +95,7 @@ if decomp2 != buf:
     print "max_length decompressobj failed"
 else:
     print "max_length decompressobj succeeded"
-    
+
 # Misc tests of max_length
 deco = zlib.decompressobj(-12)
 try: