SynergyObject.__init__()   A
last analyzed

Complexity

Conditions 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
c 2
b 0
f 0
dl 0
loc 4
rs 10
cc 1
1
from intelligine.cst import OBJ_SMELL, INSTANCE_CLASS
2
from intelligine.synergy.Simulation import Simulation
3
from synergine_xyz.SynergyObject import SynergyObject as XyzSynergyObject
4
5
6
class SynergyObject(XyzSynergyObject):
7
8
    def __init__(self, collection, context):
9
        super().__init__(collection, context)
10
        self._smell = None
11
        context.metas.value.set(INSTANCE_CLASS, self.get_id(), self.__class__)
12
13
    def _set_smell(self, smell_type):
14
        self._smell = smell_type
15
        self._context.metas.value.set(OBJ_SMELL, self.get_id(), smell_type)
16
        Simulation.add_smell(smell_type)
17
18
    def get_smell(self):
19
        if not self._smell:
20
            raise Exception('Smell type not defined')
21
        return self._smell
22