Commits

Anonymous committed 5e939a2

Fixing whitespace handling in fix_classdecorator.

Comments (0)

Files changed (2)

lib3to2/fixes/fix_classdecorator.py

 class FixClassdecorator(fixer_base.BaseFix):
 
     PATTERN = """
-              decorated < one_dec=decorator < any* > cls=classdef < 'class' name=any any* > > | 
+              decorated < one_dec=decorator < any* > cls=classdef < 'class' name=any any* > > |
               decorated < decorators < decs=decorator+ > cls=classdef < 'class' name=any any* > >
               """
     def transform(self, node, results):
         for dec in dec_strings:
             assign += ")"
         assign = String(results["name"].value + " = " + assign)
-        assign_statement = Node(syms.simple_stmt, [assign, Newline()])
+        assign_statement = Node(syms.simple_stmt, [assign, Newline(), Newline()])
         prefix = None
         for dec in decs:
             if prefix is None:
         node.insert_child(pos, Leaf(token.INDENT, i))
         node.insert_child(pos, assign_statement)
         node.insert_child(pos, Leaf(token.INDENT, i))
-        
-        
+
+

lib3to2/tests/test_classdecorator.py

         class decorated(object):
             pass
         decorated = decor(decorated)
+
         print("hello, there!")"""
 
         self.check(b, a)