Brain.get_context()   A
last analyzed

Complexity

Conditions 1

Size

Total Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 2
rs 10
cc 1
1
from intelligine.cst import BRAIN_SCHEMA
2
3
4
class Brain():
5
6
    _brain_parts = {}
7
8
    def __init__(self, context, host):
9
        self._context = context
10
        self._host = host
11
        self._parts = {}
12
        self._init_parts()
13
14
    def _init_parts(self):
15
        for brain_part_name in self._brain_parts:
16
            self._parts[brain_part_name] = self._brain_parts[brain_part_name](self)
17
        self._context.metas.value.set(BRAIN_SCHEMA, self._host.__class__, self._brain_parts)
18
19
    def get_part(self, name):
20
        return self._parts[name]
21
22
    def get_context(self):
23
        return self._context
24
25
    def get_host(self):
26
        return self._host