mirror of
				https://github.com/craigerl/aprsd.git
				synced 2025-11-03 21:20:23 -05:00 
			
		
		
		
	Cleaned up trailing whitespace
This commit is contained in:
		
							parent
							
								
									7dc1c5d8fd
								
							
						
					
					
						commit
						60fa3ffcd4
					
				@ -23,38 +23,38 @@ def fuzzy(hour, minute, degree=1):
 | 
			
		||||
	Supports two degrees of fuzziness. Set with degree = 1 or degree = 2
 | 
			
		||||
	When degree = 1, time is in quantum of 5 minutes.
 | 
			
		||||
	When degree = 2, time is in quantum of 15 minutes.'''
 | 
			
		||||
	
 | 
			
		||||
 | 
			
		||||
	if degree<=0 or degree>2:
 | 
			
		||||
		print 'Please use a degree of 1 or 2. Using fuzziness degree=1'
 | 
			
		||||
		degree = 1	
 | 
			
		||||
	
 | 
			
		||||
		degree = 1
 | 
			
		||||
 | 
			
		||||
	begin = 'It\'s '
 | 
			
		||||
	
 | 
			
		||||
 | 
			
		||||
	f0 = 'almost '
 | 
			
		||||
	f1 = 'exactly '
 | 
			
		||||
	f2 = 'around '
 | 
			
		||||
	
 | 
			
		||||
 | 
			
		||||
	b0 = ' past '
 | 
			
		||||
	b1 = ' to '
 | 
			
		||||
	
 | 
			
		||||
 | 
			
		||||
	hourList = ('One', 'Two', 'Three', 'Four', 'Five', 'Six', 'Seven', 'Eight', 'Nine', 'Ten', 'Eleven', 'Twelve')
 | 
			
		||||
	
 | 
			
		||||
 | 
			
		||||
	s1 = s2 = s3 = s4 = ''
 | 
			
		||||
	base = 5
 | 
			
		||||
	
 | 
			
		||||
 | 
			
		||||
	if degree == 1:
 | 
			
		||||
		base = 5
 | 
			
		||||
		val = ('Five', 'Ten', 'Quarter', 'Twenty', 'Twenty-Five', 'Half')
 | 
			
		||||
	elif degree == 2:
 | 
			
		||||
		base = 15
 | 
			
		||||
		val = ('Quarter', 'Half')
 | 
			
		||||
	
 | 
			
		||||
 | 
			
		||||
	dmin = minute % base # to find whether we have to use 'almost', 'exactly' or 'around'
 | 
			
		||||
	if minute > 30:
 | 
			
		||||
		pos = int((60 - minute) / base) #position in the tuple 'val'
 | 
			
		||||
	else:
 | 
			
		||||
		pos = int(minute / base)
 | 
			
		||||
	
 | 
			
		||||
 | 
			
		||||
	if dmin == 0:
 | 
			
		||||
		s1 = f1
 | 
			
		||||
		pos = pos - 1
 | 
			
		||||
@ -66,9 +66,9 @@ def fuzzy(hour, minute, degree=1):
 | 
			
		||||
		s1 = f0
 | 
			
		||||
		if minute > 30:
 | 
			
		||||
			pos = pos -1
 | 
			
		||||
	
 | 
			
		||||
 | 
			
		||||
	s2 = val[pos]
 | 
			
		||||
	
 | 
			
		||||
 | 
			
		||||
	if minute <= base/2:               # Case like "It's around/exactly Ten"
 | 
			
		||||
		s2 = s3 = ''
 | 
			
		||||
		s4 = hourList[hour - 12 - 1]
 | 
			
		||||
@ -82,7 +82,7 @@ def fuzzy(hour, minute, degree=1):
 | 
			
		||||
		else:
 | 
			
		||||
			s3 = b0  # past
 | 
			
		||||
			s4 = hourList[hour - 12 - 1]
 | 
			
		||||
	
 | 
			
		||||
 | 
			
		||||
	return begin + s1 + s2 + s3 + s4
 | 
			
		||||
 | 
			
		||||
def main():
 | 
			
		||||
@ -90,13 +90,13 @@ def main():
 | 
			
		||||
	stm = time.localtime()
 | 
			
		||||
	h = stm.tm_hour
 | 
			
		||||
	m = stm.tm_min
 | 
			
		||||
	
 | 
			
		||||
 | 
			
		||||
	if len(sys.argv)>=2:
 | 
			
		||||
		try:
 | 
			
		||||
			deg = int(sys.argv[1])
 | 
			
		||||
		except:
 | 
			
		||||
			print 'Please use a degree of 1 or 2. Using fuzziness degree=1'
 | 
			
		||||
			
 | 
			
		||||
 | 
			
		||||
		if len(sys.argv)>=3:
 | 
			
		||||
			tm = sys.argv[2].split(':')
 | 
			
		||||
			try:
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user