mirror of
				https://github.com/python/cpython.git
				synced 2025-11-04 15:41:43 +00:00 
			
		
		
		
	Whitespace normalization.
This commit is contained in:
		
							parent
							
								
									0bc2ab9a20
								
							
						
					
					
						commit
						3daf304f3b
					
				
					 2 changed files with 21 additions and 21 deletions
				
			
		| 
						 | 
				
			
			@ -72,7 +72,7 @@ def _Import(self, t):
 | 
			
		|||
            self.write(a.name)
 | 
			
		||||
            if a.asname:
 | 
			
		||||
                self.write(" as "+a.asname)
 | 
			
		||||
                
 | 
			
		||||
 | 
			
		||||
    def _ImportFrom(self, t):
 | 
			
		||||
        self.fill("from ")
 | 
			
		||||
        self.write(t.module)
 | 
			
		||||
| 
						 | 
				
			
			@ -105,13 +105,13 @@ def _Return(self, t):
 | 
			
		|||
 | 
			
		||||
    def _Pass(self, t):
 | 
			
		||||
        self.fill("pass")
 | 
			
		||||
        
 | 
			
		||||
 | 
			
		||||
    def _Break(self, t):
 | 
			
		||||
        self.fill("break")
 | 
			
		||||
 | 
			
		||||
    def _Continue(self, t):
 | 
			
		||||
        self.fill("continue")
 | 
			
		||||
        
 | 
			
		||||
 | 
			
		||||
    def _Delete(self, t):
 | 
			
		||||
        self.fill("del ")
 | 
			
		||||
        self.dispatch(t.targets)
 | 
			
		||||
| 
						 | 
				
			
			@ -122,7 +122,7 @@ def _Assert(self, t):
 | 
			
		|||
        if t.msg:
 | 
			
		||||
            self.write(", ")
 | 
			
		||||
            self.dispatch(t.msg)
 | 
			
		||||
        
 | 
			
		||||
 | 
			
		||||
    def _Exec(self, t):
 | 
			
		||||
        self.fill("exec ")
 | 
			
		||||
        self.dispatch(t.body)
 | 
			
		||||
| 
						 | 
				
			
			@ -160,7 +160,7 @@ def _Yield(self, t):
 | 
			
		|||
            self.write(" (")
 | 
			
		||||
            self.dispatch(t.value)
 | 
			
		||||
            self.write(")")
 | 
			
		||||
                  
 | 
			
		||||
 | 
			
		||||
    def _Raise(self, t):
 | 
			
		||||
        self.fill('raise ')
 | 
			
		||||
        if t.type:
 | 
			
		||||
| 
						 | 
				
			
			@ -171,13 +171,13 @@ def _Raise(self, t):
 | 
			
		|||
        if t.tback:
 | 
			
		||||
            self.write(", ")
 | 
			
		||||
            self.dispatch(t.tback)
 | 
			
		||||
      
 | 
			
		||||
 | 
			
		||||
    def _TryExcept(self, t):
 | 
			
		||||
        self.fill("try")
 | 
			
		||||
        self.enter()
 | 
			
		||||
        self.dispatch(t.body)
 | 
			
		||||
        self.leave()
 | 
			
		||||
        
 | 
			
		||||
 | 
			
		||||
        for ex in t.handlers:
 | 
			
		||||
            self.dispatch(ex)
 | 
			
		||||
        if t.orelse:
 | 
			
		||||
| 
						 | 
				
			
			@ -207,7 +207,7 @@ def _excepthandler(self, t):
 | 
			
		|||
        self.enter()
 | 
			
		||||
        self.dispatch(t.body)
 | 
			
		||||
        self.leave()
 | 
			
		||||
        
 | 
			
		||||
 | 
			
		||||
    def _ClassDef(self, t):
 | 
			
		||||
        self.write("\n")
 | 
			
		||||
        self.fill("class "+t.name)
 | 
			
		||||
| 
						 | 
				
			
			@ -268,7 +268,7 @@ def _While(self, t):
 | 
			
		|||
            self.enter()
 | 
			
		||||
            self.dispatch(t.orelse)
 | 
			
		||||
            self.leave
 | 
			
		||||
            
 | 
			
		||||
 | 
			
		||||
    def _With(self, t):
 | 
			
		||||
        self.fill("with ")
 | 
			
		||||
        self.dispatch(t.context_expr)
 | 
			
		||||
| 
						 | 
				
			
			@ -290,7 +290,7 @@ def _Repr(self, t):
 | 
			
		|||
        self.write("`")
 | 
			
		||||
        self.dispatch(t.value)
 | 
			
		||||
        self.write("`")
 | 
			
		||||
        
 | 
			
		||||
 | 
			
		||||
    def _Num(self, t):
 | 
			
		||||
        self.write(repr(t.n))
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -307,14 +307,14 @@ def _ListComp(self, t):
 | 
			
		|||
        for gen in t.generators:
 | 
			
		||||
            self.dispatch(gen)
 | 
			
		||||
        self.write("]")
 | 
			
		||||
        
 | 
			
		||||
 | 
			
		||||
    def _GeneratorExp(self, t):
 | 
			
		||||
        self.write("(")
 | 
			
		||||
        self.dispatch(t.elt)
 | 
			
		||||
        for gen in t.generators:
 | 
			
		||||
            self.dispatch(gen)
 | 
			
		||||
        self.write(")")
 | 
			
		||||
        
 | 
			
		||||
 | 
			
		||||
    def _comprehension(self, t):
 | 
			
		||||
        self.write(" for ")
 | 
			
		||||
        self.dispatch(t.target)
 | 
			
		||||
| 
						 | 
				
			
			@ -331,7 +331,7 @@ def _IfExp(self, t):
 | 
			
		|||
        if t.orelse:
 | 
			
		||||
            self.write(" else ")
 | 
			
		||||
            self.dispatch(t.orelse)
 | 
			
		||||
            
 | 
			
		||||
 | 
			
		||||
    def _Dict(self, t):
 | 
			
		||||
        self.write("{")
 | 
			
		||||
        for k,v in zip(t.keys, t.values):
 | 
			
		||||
| 
						 | 
				
			
			@ -386,7 +386,7 @@ def _BoolOp(self, t):
 | 
			
		|||
            self.write(" %s " % self.boolops[t.op.__class__])
 | 
			
		||||
            self.dispatch(v)
 | 
			
		||||
        self.write(")")
 | 
			
		||||
        
 | 
			
		||||
 | 
			
		||||
    def _Attribute(self,t):
 | 
			
		||||
        self.dispatch(t.value)
 | 
			
		||||
        self.write(".")
 | 
			
		||||
| 
						 | 
				
			
			@ -425,7 +425,7 @@ def _Subscript(self, t):
 | 
			
		|||
    # slice
 | 
			
		||||
    def _Ellipsis(self, t):
 | 
			
		||||
        self.write("...")
 | 
			
		||||
        
 | 
			
		||||
 | 
			
		||||
    def _Index(self, t):
 | 
			
		||||
        self.dispatch(t.value)
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -444,7 +444,7 @@ def _ExtSlice(self, t):
 | 
			
		|||
            if i != 0:
 | 
			
		||||
                self.write(': ')
 | 
			
		||||
            self.dispatch(d)
 | 
			
		||||
            
 | 
			
		||||
 | 
			
		||||
    # others
 | 
			
		||||
    def _arguments(self, t):
 | 
			
		||||
        first = True
 | 
			
		||||
| 
						 | 
				
			
			@ -472,13 +472,13 @@ def _keyword(self, t):
 | 
			
		|||
        self.write(t.arg)
 | 
			
		||||
        self.write("=")
 | 
			
		||||
        self.dispatch(t.value)
 | 
			
		||||
        
 | 
			
		||||
 | 
			
		||||
    def _Lambda(self, t):
 | 
			
		||||
        self.write("lambda ")
 | 
			
		||||
        self.dispatch(t.args)
 | 
			
		||||
        self.write(": ")
 | 
			
		||||
        self.dispatch(t.body)
 | 
			
		||||
        
 | 
			
		||||
 | 
			
		||||
def roundtrip(filename, output=sys.stdout):
 | 
			
		||||
    source = open(filename).read()
 | 
			
		||||
    tree = compile(source, filename, "exec", 0x400)
 | 
			
		||||
| 
						 | 
				
			
			@ -511,6 +511,6 @@ def main(args):
 | 
			
		|||
    else:
 | 
			
		||||
        for a in args:
 | 
			
		||||
            roundtrip(a)
 | 
			
		||||
            
 | 
			
		||||
 | 
			
		||||
if __name__=='__main__':
 | 
			
		||||
    main(sys.argv[1:])
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue