mirror of
				https://github.com/python/cpython.git
				synced 2025-11-03 23:21:29 +00:00 
			
		
		
		
	Move the roulette() functionality out of the FaqDir class into the
FaqWizard class.
This commit is contained in:
		
							parent
							
								
									46ff1903a3
								
							
						
					
					
						commit
						525d52f8a4
					
				
					 1 changed files with 4 additions and 8 deletions
				
			
		| 
						 | 
				
			
			@ -325,12 +325,6 @@ def parse(self, file):
 | 
			
		|||
	sec, num = self.__okprog.group(1, 2)
 | 
			
		||||
	return string.atoi(sec), string.atoi(num)
 | 
			
		||||
 | 
			
		||||
    def roulette(self):
 | 
			
		||||
	self.__fill()
 | 
			
		||||
	import whrandom
 | 
			
		||||
	if not self.__files: return None
 | 
			
		||||
	return whrandom.choice(self.__files)
 | 
			
		||||
 | 
			
		||||
    def list(self):
 | 
			
		||||
	# XXX Caller shouldn't modify result
 | 
			
		||||
	self.__fill()
 | 
			
		||||
| 
						 | 
				
			
			@ -577,10 +571,12 @@ def do_recent(self):
 | 
			
		|||
	emit(TAIL_RECENT)
 | 
			
		||||
 | 
			
		||||
    def do_roulette(self):
 | 
			
		||||
	file = self.dir.roulette()
 | 
			
		||||
	if not file:
 | 
			
		||||
	import whrandom
 | 
			
		||||
	files = self.dir.list()
 | 
			
		||||
	if not files: 
 | 
			
		||||
	    self.error("No entries.")
 | 
			
		||||
	    return
 | 
			
		||||
	file = whrandom.choice(files)
 | 
			
		||||
	self.prologue(T_ROULETTE)
 | 
			
		||||
	self.dir.show(file)
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue