mirror of
				https://github.com/jlu5/PyLink.git
				synced 2025-10-31 06:57:21 +01:00 
			
		
		
		
	How on earth does this uid generator even work? It badly needs a rewrite...
This commit is contained in:
		
							parent
							
								
									f7244ee6b7
								
							
						
					
					
						commit
						93b1a11651
					
				
							
								
								
									
										10
									
								
								utils.py
									
									
									
									
									
								
							
							
						
						
									
										10
									
								
								utils.py
									
									
									
									
									
								
							| @ -6,16 +6,16 @@ global bot_commands | ||||
| bot_commands = {} | ||||
| 
 | ||||
| # From http://www.inspircd.org/wiki/Modules/spanningtree/UUIDs.html | ||||
| chars = string.digits + string.ascii_uppercase | ||||
| chars = string.ascii_uppercase + string.digits | ||||
| iters = [iter(chars) for _ in range(6)] | ||||
| a = [next(i) for i in iters] | ||||
| uidchars = [next(char) for char in iters] | ||||
| 
 | ||||
| def next_uid(sid, level=-1): | ||||
|     try: | ||||
|         a[level] = next(iters[level]) | ||||
|         return sid + ''.join(a) | ||||
|         uidchars[level] = next(iters[level]) | ||||
|         return sid + ''.join(uidchars) | ||||
|     except StopIteration: | ||||
|         return UID(level-1) | ||||
|         return next_uid(sid, level-1) | ||||
| 
 | ||||
| def msg(irc, target, text, notice=False): | ||||
|     command = 'NOTICE' if notice else 'PRIVMSG' | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 James Lu
						James Lu