| 1 |  |  | from synergine.lib.eint import IncrementedNamedInt | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2 |  |  |  | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 3 |  |  |  | 
            
                                                        
            
                                    
            
            
                | 4 |  |  | class MetaSynergyCollections(): | 
            
                                                        
            
                                    
            
            
                | 5 |  |  |     COLS = IncrementedNamedInt.get('synergine.cols') | 
            
                                                        
            
                                    
            
            
                | 6 |  |  |  | 
            
                                                        
            
                                    
            
            
                | 7 |  |  |     def __init__(self, list): | 
            
                                                        
            
                                    
            
            
                | 8 |  |  |         self._list = list | 
            
                                                        
            
                                    
            
            
                | 9 |  |  |  | 
            
                                                        
            
                                    
            
            
                | 10 |  |  |     def get(self, col_name, allow_empty=False): | 
            
                                                        
            
                                    
            
            
                | 11 |  |  |         return self._list.get(self.COLS, col_name, allow_empty=allow_empty) | 
            
                                                        
            
                                    
            
            
                | 12 |  |  |  | 
            
                                                        
            
                                    
            
            
                | 13 |  |  |     def add_remove(self, object_id, add_col_name, remove_col_name): | 
            
                                                        
            
                                    
            
            
                | 14 |  |  |         self._list.add(self.COLS, add_col_name, object_id) | 
            
                                                        
            
                                    
            
            
                | 15 |  |  |         self._list.remove(self.COLS, remove_col_name, object_id) | 
            
                                                        
            
                                    
            
            
                | 16 |  |  |  | 
            
                                                        
            
                                    
            
            
                | 17 |  |  |     def add_remove_lists(self, object_id, add_cols_names, remove_cols_names, allow_empty=False): | 
            
                                                        
            
                                    
            
            
                | 18 |  |  |         for add_col_name in add_cols_names: | 
            
                                                        
            
                                    
            
            
                | 19 |  |  |             self._list.add(self.COLS, add_col_name, object_id) | 
            
                                                        
            
                                    
            
            
                | 20 |  |  |         for remove_col_name in remove_cols_names: | 
            
                                                        
            
                                    
            
            
                | 21 |  |  |             self._list.remove(self.COLS, remove_col_name, object_id, allow_empty=allow_empty) | 
            
                                                        
            
                                    
            
            
                | 22 |  |  |  | 
            
                                                        
            
                                    
            
            
                | 23 |  |  |     def add(self, object_id, col_name): | 
            
                                                        
            
                                    
            
            
                | 24 |  |  |         self._list.add(self.COLS, col_name, object_id) | 
            
                                                        
            
                                    
            
            
                | 25 |  |  |  | 
            
                                                        
            
                                    
            
            
                | 26 |  |  |     def add_list(self, object_id, col_names): | 
            
                                                        
            
                                    
            
            
                | 27 |  |  |         for col_name in col_names: | 
            
                                                        
            
                                    
            
            
                | 28 |  |  |             self.add(object_id, col_name) | 
            
                                                        
            
                                    
            
            
                | 29 |  |  |  | 
            
                                                        
            
                                    
            
            
                | 30 |  |  |     def remove(self, object_id, col_name, allow_not_in=False): | 
            
                                                        
            
                                    
            
            
                | 31 |  |  |         self._list.remove(self.COLS, col_name, object_id, allow_not_in=allow_not_in) | 
            
                                                        
            
                                    
            
            
                | 32 |  |  |  | 
            
                                                        
            
                                    
            
            
                | 33 |  |  |     def remove_list(self, object_id, col_names, allow_not_in=False): | 
            
                                                        
            
                                    
            
            
                | 34 |  |  |         for col_name in col_names: | 
            
                                                        
            
                                    
            
            
                | 35 |  |  |             self.remove(object_id, col_name, allow_not_in=allow_not_in) | 
            
                                                        
            
                                    
            
            
                | 36 |  |  |  |