mirror of
				https://github.com/python/cpython.git
				synced 2025-11-04 03:44:55 +00:00 
			
		
		
		
	process_nodes(): New function.
main(): Moved the node processing between input and ouptut to process_nodes().
This commit is contained in:
		
							parent
							
								
									4fe6caaaf0
								
							
						
					
					
						commit
						711fe02ac3
					
				
					 1 changed files with 10 additions and 6 deletions
				
			
		| 
						 | 
					@ -286,6 +286,15 @@ def dump(nodes, fp):
 | 
				
			||||||
        fp.write(node.dump())
 | 
					        fp.write(node.dump())
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					def process_nodes(nodes, columns, letters):
 | 
				
			||||||
 | 
					    nodes.sort()
 | 
				
			||||||
 | 
					    collapse(nodes)
 | 
				
			||||||
 | 
					    if letters:
 | 
				
			||||||
 | 
					        return format_html_letters(nodes, columns)
 | 
				
			||||||
 | 
					    else:
 | 
				
			||||||
 | 
					        return format_html(nodes, columns)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def main():
 | 
					def main():
 | 
				
			||||||
    import getopt
 | 
					    import getopt
 | 
				
			||||||
    ifn = "-"
 | 
					    ifn = "-"
 | 
				
			||||||
| 
						 | 
					@ -307,12 +316,7 @@ def main():
 | 
				
			||||||
    for fn in args:
 | 
					    for fn in args:
 | 
				
			||||||
        nodes = nodes + load(open(fn))
 | 
					        nodes = nodes + load(open(fn))
 | 
				
			||||||
    num_nodes = len(nodes)
 | 
					    num_nodes = len(nodes)
 | 
				
			||||||
    nodes.sort()
 | 
					    html = process_nodes(nodes, columns, letters)
 | 
				
			||||||
    collapse(nodes)
 | 
					 | 
				
			||||||
    if letters:
 | 
					 | 
				
			||||||
        html = format_html_letters(nodes, columns)
 | 
					 | 
				
			||||||
    else:
 | 
					 | 
				
			||||||
        html = format_html(nodes, columns)
 | 
					 | 
				
			||||||
    program = os.path.basename(sys.argv[0])
 | 
					    program = os.path.basename(sys.argv[0])
 | 
				
			||||||
    if ofn == "-":
 | 
					    if ofn == "-":
 | 
				
			||||||
        sys.stdout.write(html)
 | 
					        sys.stdout.write(html)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue