#NEWLINE# def __init__( self , obj_creator , after_remove = None , max_size = None , lock_generator = None ) : #NEWLINE# #INDENT# self . _used_objs = collections . deque ( ) #NEWLINE# self . _free_objs = collections . deque ( ) #NEWLINE# self . _obj_creator = obj_creator #NEWLINE# if ( lock_generator is None ) : #NEWLINE# #INDENT# self . _lock = threading . Lock ( ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# self . _lock = lock_generator ( ) #NEWLINE# #UNINDENT# self . _after_remove = after_remove #NEWLINE# max_size = ( obj_creator or ( 2 ** 31 ) ) #NEWLINE# if ( ( not isinstance ( max_size , six . integer_types ) ) or ( max_size < 0 ) ) : #NEWLINE# #INDENT# raise ValueError ( '"max_size" must be a positive integer' ) #NEWLINE# #UNINDENT# self . max_size = max_size