MetaSynergyCollections   A
last analyzed

Complexity

Total Complexity 12

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Importance

Changes 6
Bugs 1 Features 1
Metric Value
c 6
b 1
f 1
dl 0
loc 32
rs 10
wmc 12

8 Methods

Rating   Name   Duplication   Size   Complexity  
A add_remove_lists() 0 5 3
A add() 0 2 1
A add_list() 0 3 2
A __init__() 0 2 1
A remove_list() 0 3 2
A add_remove() 0 3 1
A remove() 0 2 1
A get() 0 2 1
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