mirror of
				https://github.com/python/cpython.git
				synced 2025-10-31 21:51:50 +00:00 
			
		
		
		
	Some cleanup in the Tools directory.
This commit is contained in:
		
							parent
							
								
									61ea12c9a0
								
							
						
					
					
						commit
						c20740109d
					
				
					 8 changed files with 53 additions and 49 deletions
				
			
		|  | @ -10,7 +10,6 @@ | |||
| import time | ||||
| import os | ||||
| import sys | ||||
| import functools | ||||
| import itertools | ||||
| import threading | ||||
| import subprocess | ||||
|  |  | |||
|  | @ -120,8 +120,11 @@ def display(self, update_board=True): | |||
|                             random.randrange(1, 7))) | ||||
|                     self.scr.addch(j + 1, i + 1, self.char) | ||||
|                     self.scr.attrset(0) | ||||
|                     if not live: self.boring = 0 | ||||
|                 elif s == 2 and live: d[i,j] = 1       # Survival | ||||
|                     if not live: | ||||
|                         self.boring = 0 | ||||
|                 elif s == 2 and live: | ||||
|                     # Survival | ||||
|                     d[i, j] = 1 | ||||
|                 elif live: | ||||
|                     # Death | ||||
|                     self.scr.addch(j + 1, i + 1, ' ') | ||||
|  | @ -145,6 +148,7 @@ def erase_menu(stdscr, menu_y): | |||
|     stdscr.move(menu_y + 1, 0) | ||||
|     stdscr.clrtoeol() | ||||
| 
 | ||||
| 
 | ||||
| def display_menu(stdscr, menu_y): | ||||
|     "Display the menu of possible keystroke commands" | ||||
|     erase_menu(stdscr, menu_y) | ||||
|  | @ -158,6 +162,7 @@ def display_menu(stdscr, menu_y): | |||
|         'E)rase the board, R)andom fill, S)tep once or C)ontinuously, Q)uit') | ||||
|     stdscr.attrset(0) | ||||
| 
 | ||||
| 
 | ||||
| def keyloop(stdscr): | ||||
|     # Clear the screen and display the menu of keys | ||||
|     stdscr.clear() | ||||
|  | @ -224,11 +229,17 @@ def keyloop(stdscr): | |||
|                 board.display(update_board=False) | ||||
|             elif c in 'Ss': | ||||
|                 board.display() | ||||
|             else: pass                  # Ignore incorrect keys | ||||
|         elif c == curses.KEY_UP and ypos > 0:            ypos -= 1 | ||||
|         elif c == curses.KEY_DOWN and ypos < board.Y-1:  ypos += 1 | ||||
|         elif c == curses.KEY_LEFT and xpos > 0:          xpos -= 1 | ||||
|         elif c == curses.KEY_RIGHT and xpos < board.X-1: xpos += 1 | ||||
|             else: | ||||
|                 # Ignore incorrect keys | ||||
|                 pass | ||||
|         elif c == curses.KEY_UP and ypos > 0: | ||||
|             ypos -= 1 | ||||
|         elif c == curses.KEY_DOWN and ypos + 1 < board.Y: | ||||
|             ypos += 1 | ||||
|         elif c == curses.KEY_LEFT and xpos > 0: | ||||
|             xpos -= 1 | ||||
|         elif c == curses.KEY_RIGHT and xpos + 1 < board.X: | ||||
|             xpos += 1 | ||||
|         elif c == curses.KEY_MOUSE: | ||||
|             mouse_id, mouse_x, mouse_y, mouse_z, button_state = curses.getmouse() | ||||
|             if (mouse_x > 0 and mouse_x < board.X + 1 and | ||||
|  |  | |||
|  | @ -812,7 +812,6 @@ def sync(self): | |||
| 
 | ||||
| def test_basic(): | ||||
|     "Basic non-gui self-test." | ||||
|     import os | ||||
|     a = Sheet() | ||||
|     for x in range(1, 11): | ||||
|         for y in range(1, 11): | ||||
|  |  | |||
|  | @ -163,7 +163,6 @@ | |||
| import getopt | ||||
| import token | ||||
| import tokenize | ||||
| import operator | ||||
| 
 | ||||
| __version__ = '1.5' | ||||
| 
 | ||||
|  |  | |||
|  | @ -1,8 +1,6 @@ | |||
| # -*- coding: utf-8 -*- | ||||
| # This file should be kept compatible with both Python 2.6 and Python >= 3.0. | ||||
| 
 | ||||
| import functools | ||||
| import hashlib | ||||
| import itertools | ||||
| import os | ||||
| import platform | ||||
|  |  | |||
|  | @ -1,6 +1,5 @@ | |||
| "Usage: unparse.py <path to source file>" | ||||
| import sys | ||||
| import math | ||||
| import ast | ||||
| import tokenize | ||||
| import io | ||||
|  |  | |||
|  | @ -35,7 +35,9 @@ | |||
| WITH THE USE OR PERFORMANCE OF THIS SOFTWARE ! | ||||
| """ | ||||
| 
 | ||||
| import sys, time, operator, platform | ||||
| import sys | ||||
| import time | ||||
| import platform | ||||
| from CommandLine import * | ||||
| 
 | ||||
| try: | ||||
|  | @ -962,8 +964,6 @@ def main(self): | |||
|                 bench.name = reportfile | ||||
|                 pickle.dump(bench,f) | ||||
|                 f.close() | ||||
|             except IOError as reason: | ||||
|                 print('* Error opening/writing reportfile') | ||||
|             except IOError as reason: | ||||
|                 print('* Error opening/writing reportfile %s: %s' % ( | ||||
|                     reportfile, | ||||
|  |  | |||
|  | @ -32,7 +32,6 @@ | |||
| import zipfile | ||||
| 
 | ||||
| from textwrap import dedent | ||||
| from operator import itemgetter | ||||
| 
 | ||||
| SCRIPT = sys.argv[0] | ||||
| VERSION = "3.2" | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Florent Xicluna
						Florent Xicluna