open source driving agent
				
			 
			
		 
		
		
		
		
		
		
			You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
	
	
		
		
			
	
	
		
			
				
					
						
							|  |  |  | from collections.abc import Callable
 | 
					
						
							|  |  |  | from functools import lru_cache
 | 
					
						
							|  |  |  | from typing import TypeVar
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | _RT = TypeVar("_RT")
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | class Freezable:
 | 
					
						
							|  |  |  |   _frozen: bool = False
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   def freeze(self):
 | 
					
						
							|  |  |  |     if not self._frozen:
 | 
					
						
							|  |  |  |       self._frozen = True
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   def __setattr__(self, *args, **kwargs):
 | 
					
						
							|  |  |  |     if self._frozen:
 | 
					
						
							|  |  |  |       raise Exception("cannot modify frozen object")
 | 
					
						
							|  |  |  |     super().__setattr__(*args, **kwargs)
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | def cache(user_function: Callable[..., _RT], /) -> Callable[..., _RT]:
 | 
					
						
							|  |  |  |   return lru_cache(maxsize=None)(user_function)
 |